Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Classloading issue for overwritten classes
Classloading issue for overwritten classes [message #633779] Tue, 19 October 2010 12:24 Go to next message
Philipp Leusmann is currently offline Philipp LeusmannFriend
Messages: 36
Registered: July 2009
Member
Hi,

we are experiencing classloading issues when using JaxWS Webservices
with JBoss.

For whatever reason, JBoss chose to overwrite several classes which are
already contained in the JDK. for example they reimplemented the whole
javax.xml.ws package.
In my special case I receive a ClassCastException, when trying to cast a
org.jboss.ws.core.jaxws.client.ClientImpl to
javax.xml.ws.BindingProvider. Of cource ClientImpl implements the
BindingProvider.

So I suspect the VM is trying to cast the ClientImpl to the
JDK-implementation of BindingProvider.

So, is there any way to convince Equinox to always load classes from the
jboss-jar instead of the jar in the JDK?
Will I need to implement a custom ClassLoader to achieve this?

One more thing i'd like to mention. The casting worked previously, but I
needed to move the class perfoming the cast to another bundle.
Previously it was in Bundle B, which is a dependency for Bundle A, and
it worked. After moving it to Bundle A, it stopped working.
Why is that?

Hope somebody can help.


--

Sincerely,

Philipp Leusmann
System Developer

Ebcot Business Solutions GmbH
Kreuzherrenstrasse 2
D-52062 Aachen

Telefon: +49 - (0)241 - 90 06 72 05
Fax: +49 - (0)241 - 4 09 15 81

http://www.ebcot.de

Reg.-Nr. HRB 116 74, Amtsgericht Aachen. Hauptsitz Aachen
Vertretungsberechtigte Geschäftsführer:
Andreas Hauser, Michael Kalinowski, Oliver Wolff
Re: Classloading issue for overwritten classes [message #633795 is a reply to message #633779] Tue, 19 October 2010 13:16 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
All bundles involved that you want to load the javax.xml.ws from the jboss bundle will need to use Import-Package header for the javax.xml.ws package. In addition the Import-Package will need to have matching attributes to force the framework to resolve the import to the export provided by the jboss bundle. I hope the jboss bundle exports the package with a specific version. If so then you can specify a version range on your Import-Package header:

Import-Package: javax.xml.ws; version="1.0"

The framework also exports the javax.xml.ws package but at no version so specifying version="1.0" will force the framework to wire your bundle to the exporter of javax.xml.ws with at least a version of 1.0.

As to why the code worked in bundle B but not in bundle A, did bundle be depend on the jboss bundle by using Import-Package: javax.xml.ws or Require-Bundle? If so then it likely is loading the javax.xml.ws package through that constraint.

HTH

Tom.
Re: Classloading issue for overwritten classes [message #633805 is a reply to message #633795] Tue, 19 October 2010 13:43 Go to previous message
Philipp Leusmann is currently offline Philipp LeusmannFriend
Messages: 36
Registered: July 2009
Member
Hi Tom,

thanks for your help.

In both bundles it was configured as a required bundle.

Seconds before reading your answer I took the chance to move the bundle
containing the jboss-resources up in the list of required bundles. And
it worked!

OSGi is really, really strange!

Thanks anyway,
Philipp

Am 19.10.2010 15:16, schrieb Thomas Watson:
> All bundles involved that you want to load the javax.xml.ws from the
> jboss bundle will need to use Import-Package header for the javax.xml.ws
> package. In addition the Import-Package will need to have matching
> attributes to force the framework to resolve the import to the export
> provided by the jboss bundle. I hope the jboss bundle exports the
> package with a specific version. If so then you can specify a version
> range on your Import-Package header:
>
> Import-Package: javax.xml.ws; version="1.0"
>
> The framework also exports the javax.xml.ws package but at no version so
> specifying version="1.0" will force the framework to wire your bundle to
> the exporter of javax.xml.ws with at least a version of 1.0.
>
> As to why the code worked in bundle B but not in bundle A, did bundle be
> depend on the jboss bundle by using Import-Package: javax.xml.ws or
> Require-Bundle? If so then it likely is loading the javax.xml.ws package
> through that constraint.
>
> HTH
>
> Tom.
>

--

Sincerely,

Philipp Leusmann
System Developer

Ebcot Business Solutions GmbH
Kreuzherrenstrasse 2
D-52062 Aachen

Telefon: +49 - (0)241 - 90 06 72 05
Fax: +49 - (0)241 - 4 09 15 81

http://www.ebcot.de

Reg.-Nr. HRB 116 74, Amtsgericht Aachen. Hauptsitz Aachen
Vertretungsberechtigte Geschäftsführer:
Andreas Hauser, Michael Kalinowski, Oliver Wolff
Previous Topic:Classes missing in deployment environment
Next Topic:Equinox and JNI
Goto Forum:
  


Current Time: Fri Apr 26 05:03:19 GMT 2024

Powered by FUDForum. Page generated in 0.02367 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top