tags:

views:

106

answers:

1
+1  Q: 

Castor and IKVM

I've converted an api written in Java into a .net dll using IKVM, and so far it's been good.

It basically uses xml behind the scenes to access some web services. The api is 3rd party, and I have no access to the source code. The api uses Castor to (I believe) bind xml into objects.

However, when I started to use some of the more useful parts of the api, I came up with a problem with castor. My specific error is:

"Nested error: org.exolab.castor.mapping.MappingException: Could not find the class ..."

The class mentioned is part of the api. From scouring the web, it seems that castor cannot access the class because it's in a separate assembly from castor.

My problem is that I don't really understand enough about Classloaders in Java, and probably don't know enough about IKVM to sort this out.

Has anyone used IKVM with Castor (or some other library that possibly uses reflection on Java classes), and ran into this problem before?

A: 

Well, I'm surprised that nobody had any answers for this, so I posted my question to the ikvm mailing list, and got a reply.

The answer is indeed to do with the separation of the Castor library and the 3rd party api code I was using.

The solution I used was to add the option:

-classloader:ikvm.runtime.AppDomainAssemblyClassLoader

when compiling Castor with ikvmc.

This allowed Castor to communicate with the 3rd part api, and allowed me to grab a report from the web service.

Dave Arkell