You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Gordon Dickens <go...@verizon.net> on 2008/01/18 21:58:48 UTC
Service Unit Classpath
Hello,
In an effort to minimize the clutter of our ServiceMix (v3.2.1)
lib/optional directory I would like to bundle dependent jars within
their corresponding service units.
The problem I am running into is with a service unit that requires
several cryptix jars for decryption.
The jar definitions are defined within the SUs pom.xml as
<dependency>
<groupId>cryptix</groupId>
<artifactId>cryptix-jce-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>cryptix</groupId>
<artifactId>certpath-api-compat</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>cryptix</groupId>
<artifactId>cryptix-jce-provider</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>cryptix</groupId>
<artifactId>cryptix-message-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>cryptix</groupId>
<artifactId>cryptix-openpgp-provider</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>cryptix</groupId>
<artifactId>cryptix-pki-api</artifactId>
<version>1.0</version>
</dependency>
The SUs xbean.xml contains
<classpath>
<location>lib/certpath-api-compat-1.0.jar</location>
<location>lib/cryptix-jce-api-1.0.jar</location>
<location>lib/cryptix-jce-provider-1.0.jar</location>
<location>lib/cryptix-message-api-1.0.jar</location>
<location>lib/cryptix-openpgp-provider-1.0.jar</location>
<location>lib/cryptix-pki-api-1.0.jar</location>
<location>.</location>
</classpath>
These jars are being included in the deployment jar and in the
servicemix/data directory I see the service unit expanded with the jars
in the SUs exploded lib directory.
The page http://servicemix.apache.org/classloaders.html leads me to
believe that I am doing this correctly.
When this service runs I get java.lang.NoClassDefFoundError:
cryptix/message/MessageException.
Can anyone shed light on this issue?
Thanks in advance,
Gordon Dickens
Re: Service Unit Classpath
Posted by Gordon Dickens <gd...@anexinet.com>.
Should I open an issue with this in Jira?
Gordon Dickens wrote:
> Hello,
>
> In an effort to minimize the clutter of our ServiceMix (v3.2.1)
> lib/optional directory I would like to bundle dependent jars within
> their corresponding service units.
>
> The problem I am running into is with a service unit that requires
> several cryptix jars for decryption.
>
> The jar definitions are defined within the SUs pom.xml as
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>cryptix-jce-api</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>certpath-api-compat</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>cryptix-jce-provider</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>cryptix-message-api</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>cryptix-openpgp-provider</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>cryptix-pki-api</artifactId>
> <version>1.0</version>
> </dependency>
>
>
> The SUs xbean.xml contains
>
> <classpath>
> <location>lib/certpath-api-compat-1.0.jar</location>
> <location>lib/cryptix-jce-api-1.0.jar</location>
> <location>lib/cryptix-jce-provider-1.0.jar</location>
> <location>lib/cryptix-message-api-1.0.jar</location>
> <location>lib/cryptix-openpgp-provider-1.0.jar</location>
> <location>lib/cryptix-pki-api-1.0.jar</location>
> <location>.</location>
> </classpath>
>
> These jars are being included in the deployment jar and in the
> servicemix/data directory I see the service unit expanded with the jars
> in the SUs exploded lib directory.
>
> The page http://servicemix.apache.org/classloaders.html leads me to
> believe that I am doing this correctly.
>
> When this service runs I get java.lang.NoClassDefFoundError:
> cryptix/message/MessageException.
>
> Can anyone shed light on this issue?
>
> Thanks in advance,
> Gordon Dickens
> .
>
>
Re: Service Unit Classpath
Posted by Guillaume Nodet <gn...@gmail.com>.
Where are these classes loaded from ? The class that actually
load these classes must be in the same classloader. Do you have
clean lib and lib/optional folders ?
On Jan 22, 2008 6:02 PM, Gordon Dickens <gd...@anexinet.com> wrote:
> I did try defining with the explicit classpath (as below). I also tried
> setting the "self-first" and "parent-first" settings within separate
> tests and still the same result.
>
> I want the classes to be loaded from jars within the SU, but it seems as
> though they are only loading when they are in the
> ServiceMix/lib/optional directory.
>
> Any other suggestions?
>
> Thanks,
> Gordon Dickens
>
> Guillaume Nodet wrote:
> > Have you tried without defining the <classpath/> element explicitely ?
> > The component will create the correct classloader by defaut.
> > Anyway, if this does not work, the problem may be completely different.
> > It depends on where the classes are loaded from: are they loaded from
> the
> > SU or from the component or even container for some reason ?
> >
> >
> > On Jan 18, 2008 9:58 PM, Gordon Dickens <go...@verizon.net>
> wrote:
> >
> >
> >> Hello,
> >>
> >> In an effort to minimize the clutter of our ServiceMix (v3.2.1)
> >> lib/optional directory I would like to bundle dependent jars within
> >> their corresponding service units.
> >>
> >> The problem I am running into is with a service unit that requires
> >> several cryptix jars for decryption.
> >>
> >> The jar definitions are defined within the SUs pom.xml as
> >> <dependency>
> >> <groupId>cryptix</groupId>
> >> <artifactId>cryptix-jce-api</artifactId>
> >> <version>1.0</version>
> >> </dependency>
> >> <dependency>
> >> <groupId>cryptix</groupId>
> >> <artifactId>certpath-api-compat</artifactId>
> >> <version>1.0</version>
> >> </dependency>
> >> <dependency>
> >> <groupId>cryptix</groupId>
> >> <artifactId>cryptix-jce-provider</artifactId>
> >> <version>1.0</version>
> >> </dependency>
> >> <dependency>
> >> <groupId>cryptix</groupId>
> >> <artifactId>cryptix-message-api</artifactId>
> >> <version>1.0</version>
> >> </dependency>
> >> <dependency>
> >> <groupId>cryptix</groupId>
> >> <artifactId>cryptix-openpgp-provider</artifactId>
> >> <version>1.0</version>
> >> </dependency>
> >> <dependency>
> >> <groupId>cryptix</groupId>
> >> <artifactId>cryptix-pki-api</artifactId>
> >> <version>1.0</version>
> >> </dependency>
> >>
> >>
> >> The SUs xbean.xml contains
> >>
> >> <classpath>
> >> <location>lib/certpath-api-compat-1.0.jar</location>
> >> <location>lib/cryptix-jce-api-1.0.jar</location>
> >> <location>lib/cryptix-jce-provider-1.0.jar</location>
> >> <location>lib/cryptix-message-api-1.0.jar</location>
> >> <location>lib/cryptix-openpgp-provider-1.0.jar</location>
> >> <location>lib/cryptix-pki-api-1.0.jar</location>
> >> <location>.</location>
> >> </classpath>
> >>
> >> These jars are being included in the deployment jar and in the
> >> servicemix/data directory I see the service unit expanded with the jars
> >> in the SUs exploded lib directory.
> >>
> >> The page http://servicemix.apache.org/classloaders.html leads me to
> >> believe that I am doing this correctly.
> >>
> >> When this service runs I get java.lang.NoClassDefFoundError:
> >> cryptix/message/MessageException.
> >>
> >> Can anyone shed light on this issue?
> >>
> >> Thanks in advance,
> >> Gordon Dickens
> >>
> >>
> >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> > .
> >
> >
>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
Re: Service Unit Classpath
Posted by Gordon Dickens <gd...@anexinet.com>.
Thanks Andreas, I will read the article and hope it sheds some light on
this issue. Classpath issues are the one of the biggest pains of Java.
Regards,
Gordon Dickens
Andreas Schaefer wrote:
> NoClassDefFoundError means that there is a linkage problem meaning a
> class is loaded by a parent class loader which does not have access to
> the children class loaders' classes. You must make sure that the class
> referencing to the MessageException is loaded by the same class loader
> as the MessageException.
>
> Unfortunately there is not much you can do to figure out what is wrong
> except these two:
> - Use "-vebose:class" flag when you start Smx which will could
> indicate what class is trying to load MessageException
> - Instrument URL Class Loader. For that have a look at my articles at
> OnJava.com: http://www.onjava.com/pub/a/onjava/2004/06/30/classloader2.html
>
> Hope this helps and let me know if that worked or not
>
> Andreas Schaefer
> CEO of Madplanet.com Inc.
> andreas.schaefer@madplanet.com
>
>
> On Jan 22, 2008, at 9:02 AM, Gordon Dickens wrote:
>
>
>> I did try defining with the explicit classpath (as below). I also
>> tried setting the "self-first" and "parent-first" settings within
>> separate tests and still the same result.
>>
>> I want the classes to be loaded from jars within the SU, but it
>> seems as though they are only loading when they are in the
>> ServiceMix/lib/optional directory.
>>
>> Any other suggestions?
>>
>> Thanks,
>> Gordon Dickens
>>
>> Guillaume Nodet wrote:
>>
>>> Have you tried without defining the <classpath/> element
>>> explicitely ?
>>> The component will create the correct classloader by defaut.
>>> Anyway, if this does not work, the problem may be completely
>>> different.
>>> It depends on where the classes are loaded from: are they loaded
>>> from the
>>> SU or from the component or even container for some reason ?
>>>
>>>
>>> On Jan 18, 2008 9:58 PM, Gordon Dickens <go...@verizon.net>
>>> wrote:
>>>
>>>
>>>
>>>> Hello,
>>>>
>>>> In an effort to minimize the clutter of our ServiceMix (v3.2.1)
>>>> lib/optional directory I would like to bundle dependent jars within
>>>> their corresponding service units.
>>>>
>>>> The problem I am running into is with a service unit that requires
>>>> several cryptix jars for decryption.
>>>>
>>>> The jar definitions are defined within the SUs pom.xml as
>>>> <dependency>
>>>> <groupId>cryptix</groupId>
>>>> <artifactId>cryptix-jce-api</artifactId>
>>>> <version>1.0</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>cryptix</groupId>
>>>> <artifactId>certpath-api-compat</artifactId>
>>>> <version>1.0</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>cryptix</groupId>
>>>> <artifactId>cryptix-jce-provider</artifactId>
>>>> <version>1.0</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>cryptix</groupId>
>>>> <artifactId>cryptix-message-api</artifactId>
>>>> <version>1.0</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>cryptix</groupId>
>>>> <artifactId>cryptix-openpgp-provider</artifactId>
>>>> <version>1.0</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>cryptix</groupId>
>>>> <artifactId>cryptix-pki-api</artifactId>
>>>> <version>1.0</version>
>>>> </dependency>
>>>>
>>>>
>>>> The SUs xbean.xml contains
>>>>
>>>> <classpath>
>>>> <location>lib/certpath-api-compat-1.0.jar</location>
>>>> <location>lib/cryptix-jce-api-1.0.jar</location>
>>>> <location>lib/cryptix-jce-provider-1.0.jar</location>
>>>> <location>lib/cryptix-message-api-1.0.jar</location>
>>>> <location>lib/cryptix-openpgp-provider-1.0.jar</location>
>>>> <location>lib/cryptix-pki-api-1.0.jar</location>
>>>> <location>.</location>
>>>> </classpath>
>>>>
>>>> These jars are being included in the deployment jar and in the
>>>> servicemix/data directory I see the service unit expanded with the
>>>> jars
>>>> in the SUs exploded lib directory.
>>>>
>>>> The page http://servicemix.apache.org/classloaders.html leads me to
>>>> believe that I am doing this correctly.
>>>>
>>>> When this service runs I get java.lang.NoClassDefFoundError:
>>>> cryptix/message/MessageException.
>>>>
>>>> Can anyone shed light on this issue?
>>>>
>>>> Thanks in advance,
>>>> Gordon Dickens
>>>>
>>>>
>>>>
>>>
>>> --
>>> Cheers,
>>> Guillaume Nodet
>>> ------------------------
>>> Blog: http://gnodet.blogspot.com/
>>> .
>>>
>>>
>>>
>
> .
>
>
Re: Service Unit Classpath
Posted by Andreas Schaefer <an...@madplanet.com>.
NoClassDefFoundError means that there is a linkage problem meaning a
class is loaded by a parent class loader which does not have access to
the children class loaders' classes. You must make sure that the class
referencing to the MessageException is loaded by the same class loader
as the MessageException.
Unfortunately there is not much you can do to figure out what is wrong
except these two:
- Use "-vebose:class" flag when you start Smx which will could
indicate what class is trying to load MessageException
- Instrument URL Class Loader. For that have a look at my articles at
OnJava.com: http://www.onjava.com/pub/a/onjava/2004/06/30/classloader2.html
Hope this helps and let me know if that worked or not
Andreas Schaefer
CEO of Madplanet.com Inc.
andreas.schaefer@madplanet.com
On Jan 22, 2008, at 9:02 AM, Gordon Dickens wrote:
> I did try defining with the explicit classpath (as below). I also
> tried setting the "self-first" and "parent-first" settings within
> separate tests and still the same result.
>
> I want the classes to be loaded from jars within the SU, but it
> seems as though they are only loading when they are in the
> ServiceMix/lib/optional directory.
>
> Any other suggestions?
>
> Thanks,
> Gordon Dickens
>
> Guillaume Nodet wrote:
>> Have you tried without defining the <classpath/> element
>> explicitely ?
>> The component will create the correct classloader by defaut.
>> Anyway, if this does not work, the problem may be completely
>> different.
>> It depends on where the classes are loaded from: are they loaded
>> from the
>> SU or from the component or even container for some reason ?
>>
>>
>> On Jan 18, 2008 9:58 PM, Gordon Dickens <go...@verizon.net>
>> wrote:
>>
>>
>>> Hello,
>>>
>>> In an effort to minimize the clutter of our ServiceMix (v3.2.1)
>>> lib/optional directory I would like to bundle dependent jars within
>>> their corresponding service units.
>>>
>>> The problem I am running into is with a service unit that requires
>>> several cryptix jars for decryption.
>>>
>>> The jar definitions are defined within the SUs pom.xml as
>>> <dependency>
>>> <groupId>cryptix</groupId>
>>> <artifactId>cryptix-jce-api</artifactId>
>>> <version>1.0</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>cryptix</groupId>
>>> <artifactId>certpath-api-compat</artifactId>
>>> <version>1.0</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>cryptix</groupId>
>>> <artifactId>cryptix-jce-provider</artifactId>
>>> <version>1.0</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>cryptix</groupId>
>>> <artifactId>cryptix-message-api</artifactId>
>>> <version>1.0</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>cryptix</groupId>
>>> <artifactId>cryptix-openpgp-provider</artifactId>
>>> <version>1.0</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>cryptix</groupId>
>>> <artifactId>cryptix-pki-api</artifactId>
>>> <version>1.0</version>
>>> </dependency>
>>>
>>>
>>> The SUs xbean.xml contains
>>>
>>> <classpath>
>>> <location>lib/certpath-api-compat-1.0.jar</location>
>>> <location>lib/cryptix-jce-api-1.0.jar</location>
>>> <location>lib/cryptix-jce-provider-1.0.jar</location>
>>> <location>lib/cryptix-message-api-1.0.jar</location>
>>> <location>lib/cryptix-openpgp-provider-1.0.jar</location>
>>> <location>lib/cryptix-pki-api-1.0.jar</location>
>>> <location>.</location>
>>> </classpath>
>>>
>>> These jars are being included in the deployment jar and in the
>>> servicemix/data directory I see the service unit expanded with the
>>> jars
>>> in the SUs exploded lib directory.
>>>
>>> The page http://servicemix.apache.org/classloaders.html leads me to
>>> believe that I am doing this correctly.
>>>
>>> When this service runs I get java.lang.NoClassDefFoundError:
>>> cryptix/message/MessageException.
>>>
>>> Can anyone shed light on this issue?
>>>
>>> Thanks in advance,
>>> Gordon Dickens
>>>
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> .
>>
>>
>
Re: Service Unit Classpath
Posted by Gordon Dickens <gd...@anexinet.com>.
I did try defining with the explicit classpath (as below). I also tried
setting the "self-first" and "parent-first" settings within separate
tests and still the same result.
I want the classes to be loaded from jars within the SU, but it seems as
though they are only loading when they are in the
ServiceMix/lib/optional directory.
Any other suggestions?
Thanks,
Gordon Dickens
Guillaume Nodet wrote:
> Have you tried without defining the <classpath/> element explicitely ?
> The component will create the correct classloader by defaut.
> Anyway, if this does not work, the problem may be completely different.
> It depends on where the classes are loaded from: are they loaded from the
> SU or from the component or even container for some reason ?
>
>
> On Jan 18, 2008 9:58 PM, Gordon Dickens <go...@verizon.net> wrote:
>
>
>> Hello,
>>
>> In an effort to minimize the clutter of our ServiceMix (v3.2.1)
>> lib/optional directory I would like to bundle dependent jars within
>> their corresponding service units.
>>
>> The problem I am running into is with a service unit that requires
>> several cryptix jars for decryption.
>>
>> The jar definitions are defined within the SUs pom.xml as
>> <dependency>
>> <groupId>cryptix</groupId>
>> <artifactId>cryptix-jce-api</artifactId>
>> <version>1.0</version>
>> </dependency>
>> <dependency>
>> <groupId>cryptix</groupId>
>> <artifactId>certpath-api-compat</artifactId>
>> <version>1.0</version>
>> </dependency>
>> <dependency>
>> <groupId>cryptix</groupId>
>> <artifactId>cryptix-jce-provider</artifactId>
>> <version>1.0</version>
>> </dependency>
>> <dependency>
>> <groupId>cryptix</groupId>
>> <artifactId>cryptix-message-api</artifactId>
>> <version>1.0</version>
>> </dependency>
>> <dependency>
>> <groupId>cryptix</groupId>
>> <artifactId>cryptix-openpgp-provider</artifactId>
>> <version>1.0</version>
>> </dependency>
>> <dependency>
>> <groupId>cryptix</groupId>
>> <artifactId>cryptix-pki-api</artifactId>
>> <version>1.0</version>
>> </dependency>
>>
>>
>> The SUs xbean.xml contains
>>
>> <classpath>
>> <location>lib/certpath-api-compat-1.0.jar</location>
>> <location>lib/cryptix-jce-api-1.0.jar</location>
>> <location>lib/cryptix-jce-provider-1.0.jar</location>
>> <location>lib/cryptix-message-api-1.0.jar</location>
>> <location>lib/cryptix-openpgp-provider-1.0.jar</location>
>> <location>lib/cryptix-pki-api-1.0.jar</location>
>> <location>.</location>
>> </classpath>
>>
>> These jars are being included in the deployment jar and in the
>> servicemix/data directory I see the service unit expanded with the jars
>> in the SUs exploded lib directory.
>>
>> The page http://servicemix.apache.org/classloaders.html leads me to
>> believe that I am doing this correctly.
>>
>> When this service runs I get java.lang.NoClassDefFoundError:
>> cryptix/message/MessageException.
>>
>> Can anyone shed light on this issue?
>>
>> Thanks in advance,
>> Gordon Dickens
>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> .
>
>
Re: Service Unit Classpath
Posted by Guillaume Nodet <gn...@gmail.com>.
Have you tried without defining the <classpath/> element explicitely ?
The component will create the correct classloader by defaut.
Anyway, if this does not work, the problem may be completely different.
It depends on where the classes are loaded from: are they loaded from the
SU or from the component or even container for some reason ?
On Jan 18, 2008 9:58 PM, Gordon Dickens <go...@verizon.net> wrote:
> Hello,
>
> In an effort to minimize the clutter of our ServiceMix (v3.2.1)
> lib/optional directory I would like to bundle dependent jars within
> their corresponding service units.
>
> The problem I am running into is with a service unit that requires
> several cryptix jars for decryption.
>
> The jar definitions are defined within the SUs pom.xml as
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>cryptix-jce-api</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>certpath-api-compat</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>cryptix-jce-provider</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>cryptix-message-api</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>cryptix-openpgp-provider</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>cryptix</groupId>
> <artifactId>cryptix-pki-api</artifactId>
> <version>1.0</version>
> </dependency>
>
>
> The SUs xbean.xml contains
>
> <classpath>
> <location>lib/certpath-api-compat-1.0.jar</location>
> <location>lib/cryptix-jce-api-1.0.jar</location>
> <location>lib/cryptix-jce-provider-1.0.jar</location>
> <location>lib/cryptix-message-api-1.0.jar</location>
> <location>lib/cryptix-openpgp-provider-1.0.jar</location>
> <location>lib/cryptix-pki-api-1.0.jar</location>
> <location>.</location>
> </classpath>
>
> These jars are being included in the deployment jar and in the
> servicemix/data directory I see the service unit expanded with the jars
> in the SUs exploded lib directory.
>
> The page http://servicemix.apache.org/classloaders.html leads me to
> believe that I am doing this correctly.
>
> When this service runs I get java.lang.NoClassDefFoundError:
> cryptix/message/MessageException.
>
> Can anyone shed light on this issue?
>
> Thanks in advance,
> Gordon Dickens
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/