Re: Could not instantiate JAXBContext when using with IKVM

Vadim Bauer <[email protected]> Wed, 13 May 2015 12:53:25 +0200
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <[email protected]>
Hello Jeroen,
thank you for the hint. I was suspecting some sort of a class loading issue but din't finde a solution on the web.

Adding ObjectFactory worked in my case.

cheers V


> Am 11.05.2015 um 15:09 schrieb Jeroen Frijters <[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
signature.asc (application/pgp-signature, 496 B)
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQEcBAEBCgAGBQJVUy0mAAoJELdzQenwcEFT8c8H/2grcBxYmym6xXC0gAT/rIbN
3m5/DYXWnoLbB08DBFG0UTkAuldxOD+1Dw0OuKrVm0lC19ku5jp3rNHhp1qzle6a
KeGZhjOHKXDyfnUX0itlRUV3QIS6oHdicNEJj0j9Hu1AbX59M8mr3CVyBL55WwrE
Uh1ygCSP+RnOy4wgLlXqZqoVDuIitjqRlSvnQ/1QbVQ78Yt106N7f3DXzj8KKrRA
ZEREFc/pYEKgDLhBSk6BOB1hUDR6Rsvkjv7XDadPFOJQALiiLHi8+lEy+Q+Q5vxw
B8+MwHsUQ4WIRu2QPTou/pSV7DPbSBjLqWBQaTYioEHx9xkNIULahNOSWtBd50g=
=kLY5
-----END PGP SIGNATURE-----