Re: Could not instantiate JAXBContext when using with IKVM

Jeroen Frijters <[email protected]> Mon, 11 May 2015 13:09:59 +0000
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <[email protected]>
Hi Vadim,

This is typically caused by class loader issues. IKVM has no gloabl CLASSPATH setting like Java, so it has to derive the equivalent the main application. However, this means that if your main application dynamically loads your DLL it won’t be able to resolve classes in it via the application class loader.

The easiest workaround is to explictly add your DLL to the bootstrap class loader:

ikvm.runtime.Startup.addBootClassPathAssembly(typeof(SomeTypeInYourAssembly).Assembly);

Regards,
Jeroen

From: Vadim Bauer [mailto:[email protected]]
Sent: Monday, May 11, 2015 14:53
To: [email protected]
Subject: [Ikvm-developers] Could not instantiate JAXBContext when using with IKVM

Hello,

I have a situation where I get a avax.xml.bind.JAXBException : Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "myContextPath" enthält ObjectFactory.class oder jaxb.index nicht.

If I use the my converted DLL inside a application(console) App.exe ---> myJarDLL then jaxb context can be created and the context path is found. Everything is fine.
Now I have created some  business logic in C#  that uses functionality of the jardll. In the end I have this constellation:  App.exe ---> BusinessDLL -->myJarDLL This is also working fine:
The final situation is actually this: (Windows Service)DLL --> BusinessDLL --> myJarDLL. And this is the point where I get this exception.

The next step I did was to create a NUnit testcase that tested myJarDLL NUnit  --> myJarDLL. Also at this point I got an javax.xml.bind.JAXBException.
This means for me that I can not use myJarDLL inside an another DLL. That only thing that is working is app.exe --> myJarDLL.

Do you know why the context path is not found when I myJarDLL is used inside a dll?


Context: The arrow (-->) means referencing here.
ikvm Version 8.0.5449.1


best regards,
v.

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y

_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers