geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Łukasz Budnik" <lukasz.bud...@gmail.com>
Subject Re: class loading: LinkageError: loader constraint violation
Date Tue, 16 Dec 2008 09:18:16 GMT
Hi Jarek,

I'm so sorry to call you Jacek last night.
I should be more careful next time! First two characters match, last
three not...

I have a work around for that. And if it's up to me - I'm happy
because my application deploys and runs :)

But it does not look good.

G2.1 with Tomcat uses Axis2 as JAX-WS provider.
When I expose some of my SLSBs methods as web services G2.1 adds Axis2
classes to the class loader (for example the Axis2 ServiceClient
class).

I'm not defining dependency for axis2-kernel (this package contains
ServiceClient class) explicitly because there will be class cast
exception during deployment.

Then I simply add:

<non-overridable-classes>
	<filter>org.apache.axiom.</filter>
</non-overridable-classes>

to my descriptors.

And it works. But it is a little bit tricky.

thanks and best regards!
Łukasz

2008/12/15 Łukasz Budnik <lukasz.budnik@gmail.com>:
> Hi Jacek,
>
> I'm using Geronimo 2.1 with Tomcat. I use axis2-kernel and axiom-api
> that are shipped with G 2.1.
>
> If Geronimo with Tomcat uses Axis2 as the JAX-WS provider then why,
> after adding explicit axis2-kernel dependency I have class cast
> exception:
>
>>>     [exec]     Error: Operation failed: start of
>>>     [exec]     org.xh.nuntius/EnterpriseContainer/0.2-dev/car failed
>>>     [exec]
>>>     [exec]             Unknown start exception
>>>     [exec]
>>>     [exec]             Configuration
>>> org.xh.nuntius/EnterpriseContainer/0.2-dev/car failed
>>>     [exec]     to start due to the following reasons:
>>>     [exec]
>>>     [exec]       The service
>>>     [exec]
>>> EJBModule=NuntiusEJB.jar,J2EEApplication=org.xh.nuntius/EnterpriseContainer/0.2-dev/car,StatelessSessionBean=ExecutionLoggerImpl,j2eeType=WS
>>> Link,name=ExecutionLoggerImpl
>>>     [exec]     did not start because
>>>     [exec]     org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver cannot
be
>>>     [exec]     cast to org.apache.axis2.engine.MessageReceiver
>
> Is there any way I can use axis2-kernel <dependency /> with JAX-WS?
>
> thanks
> Łukasz
>
> 2008/12/15 Jarek Gawor <jgawor@gmail.com>:
>> Lukasz,
>>
>> Are you deploying your app on Geronimo Tomcat assembly (which uses
>> Axis2 as the JAX-WS provider by default)? Does your application
>> contain any of the axis2 jars or its dependencies (such as Axiom,
>> etc.)? Also, looks like your application contains some code that
>> extends Axis2 API. What version of Axis2 was that code built with?
>>
>> In general, if you are witting a JAX-WS web services, you should stay
>> with the JAX-WS API in order to keep your application portable. For
>> example, you can use the @WebServiceRef (that is, Service AP) to
>> invoke other web services. If you are using proprietary Axis2 API (and
>> extensions of it) you have to make sure all of the code is built with
>> the same version of Axis2 as what is in Geronimo.
>>
>> Jarek
>>
>> On Mon, Dec 15, 2008 at 2:12 PM, Łukasz Budnik <lukasz.budnik@gmail.com> wrote:
>>> Hi all,
>>>
>>> I'm exposing some methods of my SLSB as WebServices (@WebService,
>>> @WebMethod) etc.
>>>
>>> All works.
>>>
>>> Recently I have added new functionality. I'm invoking external web
>>> services using Axis2: org.apache.axis2.client.ServiceClient.
>>>
>>> I added this dependency:
>>>
>>> <dependency>
>>>                <groupId>org.apache.axis2</groupId>
>>>                <artifactId>axis2-kernel</artifactId>
>>>                <version>1.3</version>
>>>                <type>jar</type>
>>>            </dependency>
>>>
>>> During deployment of my application (and of course @WebService SLSB)
>>> there is an error.
>>>
>>>     [exec]     Error: Operation failed: start of
>>>     [exec]     org.xh.nuntius/EnterpriseContainer/0.2-dev/car failed
>>>     [exec]
>>>     [exec]             Unknown start exception
>>>     [exec]
>>>     [exec]             Configuration
>>> org.xh.nuntius/EnterpriseContainer/0.2-dev/car failed
>>>     [exec]     to start due to the following reasons:
>>>     [exec]
>>>     [exec]       The service
>>>     [exec]
>>> EJBModule=NuntiusEJB.jar,J2EEApplication=org.xh.nuntius/EnterpriseContainer/0.2-dev/car,StatelessSessionBean=ExecutionLoggerImpl,j2eeType=WS
>>> Link,name=ExecutionLoggerImpl
>>>     [exec]     did not start because
>>>     [exec]     org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver cannot
be
>>>     [exec]     cast to org.apache.axis2.engine.MessageReceiver
>>>
>>> Not good...
>>>
>>> Hmmm...
>>>
>>> If I remove axis2-kernel dependency, application is deployed - which is weird.
>>>
>>> But when execution gets to:
>>>
>>> serviceClient.sendReceiveNonBlocking(OMXMLUtils.parseString(payload), callback);
>>>
>>> I get:
>>>
>>> LinkageError: loader constraint violation: when resolving method
>>> "org.apache.axis2.client.ServiceClient.sendReceiveNonBlocking(Lorg/apache/axiom/om/OMElement;Lorg/apache/axis2/client/async/AxisCallback;)V"
>>> the class loader (instance of
>>> org/apache/geronimo/kernel/classloader/JarFileClassLoader) of the
>>> current class, org/xh/nuntius/enterprise/broker/client/AsynchronousAxis2ServiceClient,
>>> and the class loader (instance of
>>> org/apache/geronimo/kernel/classloader/JarFileClassLoader) for
>>> resolved class, org/apache/axis2/client/ServiceClient, have different
>>> Class objects for the type org/apache/axiom/om/OMElement used in the
>>> signature
>>>
>>> I'm 100% confused.
>>>
>>> ServiceClient is defined in axis2-kernel. I cannot defined it
>>> explicitly because my @WebService will not be created.
>>>
>>> When I skip this dependency Geronimo somehow is adding it when doing
>>> @WebService stuff and there will be 2 different classes for
>>> org/apache/axiom/om/OMElement.
>>>
>>> Any ideas? Or maybe I should post this to Geronimo dev?
>>>
>>> best regards
>>> Łukasz
>>>
>>
>
Mime
View raw message