You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tim Funk <fu...@joedog.org> on 2006/05/22 19:28:09 UTC

Re: Classloader bug?

Its not a bug. A jar needs to contain classes, not other jars.

-Tim

Asaf Lahav wrote:

>  
> 
> I think encountered a tomcat classloader bug.
> 
> I have a jar file that contains several other jar files.
> 
> I expected the classloader to be aware of the jar files that are packaged
> inside it.
> 
> Anyhow,
> 
> I kept getting classnotfound exceptions until I extracted the contained jars
> out from the containing jar.
> 
>  
> 
> p.s,
> 
> the problematic jar file is:
> 
> aspectj-1.5.0.jar (of aspectJ)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Classloader bug?

Posted by Mark Petrovic <ms...@gmail.com>.
I remember long ago I had a similar problem, where it appeared that a jar of
jars was "working' as you basically describe, but for others running my
code, it didn't "work".

The problem:  I had overlooked the fact that during my runtime invocation,
the jars were actually on the classpath via oversight.  And in fact, the
jars inside the jar file were not responsible for the success of the runtime
instance at all.

I'm not saying this is your problem, but it can happen.  I know of no
instances where a classloader will look inside a jar for other jar files.
You can write a classloader to do this, but generally it cannot be assumed
of an arbitrary classloader working on your behalf.

On 5/22/06, Asaf Lahav <as...@primagrid.com> wrote:
>
> Then there is something I don't understand or don't know about... because
> when I run the same code under a regular environment (which is not under
> the
> tomcat webclassloader) it works perfectly... and I have the same set of
> dependencies as I have in the tomcat environment.
>
>
>
>
>
> In one environment, the class loader seems to be aware of the jars that
> are
> contained inside the aspectJ jar, in the other environment (which is the
> tomcat), the class loader is not aware of the jars that are contained
> inside
> the aspectj jar.
>
> What is it that makes the difference?
>
>
>
>
>
> Asaf Lahav
>
>
>
> VP R&D, Prima Grid LTD.
>
>
>
> Cellular:  972-54-4717955
>
>
>
> Phone:   972-3-6540255
>
>
>
> Fax:       972-3-6540254
>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Tim Funk [mailto:funkman@joedog.org]
> Sent: Monday, May 22, 2006 7:52 PM
> To: Tomcat Users List
> Subject: Re: Classloader bug?
>
>
>
> Let me try again ...
>
>
>
> Its not a bug. A jar can contain resources, but if it contains other jars
> -
>
> they will be treated like any other resource in jar file. The classloader
>
> does not recursively load jars inside of jars.
>
>
>
> -Tim
>
>
>
> Asaf Lahav wrote:
>
> > Well,
>
> >
>
> > A jar may contain any types of resources.
>
> >
>
> > Further more,
>
> >
>
> > When I'm using the aspectj jar from regular environment (which is not
> using
>
> > the tomcat webclassloader) it works like a charm...
>
> >
>
> > I would expect the webclassloader to behave just as the native java
>
> > classloader does.
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > Asaf Lahav
>
> >
>
> >
>
> >
>
> > VP R&D, Prima Grid LTD.
>
> >
>
> >
>
> >
>
> > Cellular:  972-54-4717955
>
> >
>
> >
>
> >
>
> > Phone:   972-3-6540255
>
> >
>
> >
>
> >
>
> > Fax:       972-3-6540254
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > -----Original Message-----
>
> > From: Tim Funk [mailto:funkman@joedog.org]
>
> > Sent: Monday, May 22, 2006 7:28 PM
>
> > To: Tomcat Users List
>
> > Subject: Re: Classloader bug?
>
> >
>
> >
>
> >
>
> > Its not a bug. A jar needs to contain classes, not other jars.
>
> >
>
> >
>
> >
>
> > -Tim
>
> >
>
> >
>
> >
>
> > Asaf Lahav wrote:
>
> >
>
> >
>
> >
>
> >
>
> >>
>
> >
>
> >
>
> >
>
> >>I think encountered a tomcat classloader bug.
>
> >
>
> >
>
> >
>
> >>I have a jar file that contains several other jar files.
>
> >
>
> >
>
> >
>
> >>I expected the classloader to be aware of the jar files that are
> packaged
>
> >
>
> >
>
> >>inside it.
>
> >
>
> >
>
> >
>
> >>Anyhow,
>
> >
>
> >
>
> >
>
> >>I kept getting classnotfound exceptions until I extracted the contained
>
> >
>
> > jars
>
> >
>
> >
>
> >>out from the containing jar.
>
> >
>
> >
>
> >
>
> >>
>
> >
>
> >
>
> >
>
> >>p.s,
>
> >
>
> >
>
> >
>
> >>the problematic jar file is:
>
> >
>
> >
>
> >
>
> >>aspectj-1.5.0.jar (of aspectJ)
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > ---------------------------------------------------------------------
>
> >
>
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>
> >
>
> > For additional commands, e-mail: users-help@tomcat.apache.org
>
> >
>
> >
>
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


-- 
Mark
AE6RT

RE: Classloader bug?

Posted by Asaf Lahav <as...@primagrid.com>.
Then there is something I don't understand or don't know about... because
when I run the same code under a regular environment (which is not under the
tomcat webclassloader) it works perfectly... and I have the same set of
dependencies as I have in the tomcat environment.

 

 

In one environment, the class loader seems to be aware of the jars that are
contained inside the aspectJ jar, in the other environment (which is the
tomcat), the class loader is not aware of the jars that are contained inside
the aspectj jar.

What is it that makes the difference?

 

 

Asaf Lahav

 

VP R&D, Prima Grid LTD.

 

Cellular:  972-54-4717955

 

Phone:   972-3-6540255

 

Fax:       972-3-6540254

 

 

 

 

-----Original Message-----
From: Tim Funk [mailto:funkman@joedog.org] 
Sent: Monday, May 22, 2006 7:52 PM
To: Tomcat Users List
Subject: Re: Classloader bug?

 

Let me try again ...

 

Its not a bug. A jar can contain resources, but if it contains other jars - 

they will be treated like any other resource in jar file. The classloader 

does not recursively load jars inside of jars.

 

-Tim

 

Asaf Lahav wrote:

> Well, 

> 

> A jar may contain any types of resources.

> 

> Further more, 

> 

> When I'm using the aspectj jar from regular environment (which is not
using

> the tomcat webclassloader) it works like a charm...

> 

> I would expect the webclassloader to behave just as the native java

> classloader does.

> 

>  

> 

>  

> 

> Asaf Lahav

> 

>  

> 

> VP R&D, Prima Grid LTD.

> 

>  

> 

> Cellular:  972-54-4717955

> 

>  

> 

> Phone:   972-3-6540255

> 

>  

> 

> Fax:       972-3-6540254

> 

>  

> 

>  

> 

>  

> 

>  

> 

> -----Original Message-----

> From: Tim Funk [mailto:funkman@joedog.org] 

> Sent: Monday, May 22, 2006 7:28 PM

> To: Tomcat Users List

> Subject: Re: Classloader bug?

> 

>  

> 

> Its not a bug. A jar needs to contain classes, not other jars.

> 

>  

> 

> -Tim

> 

>  

> 

> Asaf Lahav wrote:

> 

>  

> 

> 

>> 

> 

> 

> 

>>I think encountered a tomcat classloader bug.

> 

> 

> 

>>I have a jar file that contains several other jar files.

> 

> 

> 

>>I expected the classloader to be aware of the jar files that are packaged

> 

> 

>>inside it.

> 

> 

> 

>>Anyhow,

> 

> 

> 

>>I kept getting classnotfound exceptions until I extracted the contained

> 

> jars

> 

> 

>>out from the containing jar.

> 

> 

> 

>> 

> 

> 

> 

>>p.s,

> 

> 

> 

>>the problematic jar file is:

> 

> 

> 

>>aspectj-1.5.0.jar (of aspectJ)

> 

> 

>  

> 

>  

> 

> ---------------------------------------------------------------------

> 

> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org

> 

> For additional commands, e-mail: users-help@tomcat.apache.org

> 

> 

 

---------------------------------------------------------------------

To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org

For additional commands, e-mail: users-help@tomcat.apache.org


Re: Classloader bug?

Posted by Tim Funk <fu...@joedog.org>.
Let me try again ...

Its not a bug. A jar can contain resources, but if it contains other jars - 
they will be treated like any other resource in jar file. The classloader 
does not recursively load jars inside of jars.

-Tim

Asaf Lahav wrote:
> Well, 
> 
> A jar may contain any types of resources.
> 
> Further more, 
> 
> When I'm using the aspectj jar from regular environment (which is not using
> the tomcat webclassloader) it works like a charm...
> 
> I would expect the webclassloader to behave just as the native java
> classloader does.
> 
>  
> 
>  
> 
> Asaf Lahav
> 
>  
> 
> VP R&D, Prima Grid LTD.
> 
>  
> 
> Cellular:  972-54-4717955
> 
>  
> 
> Phone:   972-3-6540255
> 
>  
> 
> Fax:       972-3-6540254
> 
>  
> 
>  
> 
>  
> 
>  
> 
> -----Original Message-----
> From: Tim Funk [mailto:funkman@joedog.org] 
> Sent: Monday, May 22, 2006 7:28 PM
> To: Tomcat Users List
> Subject: Re: Classloader bug?
> 
>  
> 
> Its not a bug. A jar needs to contain classes, not other jars.
> 
>  
> 
> -Tim
> 
>  
> 
> Asaf Lahav wrote:
> 
>  
> 
> 
>> 
> 
> 
> 
>>I think encountered a tomcat classloader bug.
> 
> 
> 
>>I have a jar file that contains several other jar files.
> 
> 
> 
>>I expected the classloader to be aware of the jar files that are packaged
> 
> 
>>inside it.
> 
> 
> 
>>Anyhow,
> 
> 
> 
>>I kept getting classnotfound exceptions until I extracted the contained
> 
> jars
> 
> 
>>out from the containing jar.
> 
> 
> 
>> 
> 
> 
> 
>>p.s,
> 
> 
> 
>>the problematic jar file is:
> 
> 
> 
>>aspectj-1.5.0.jar (of aspectJ)
> 
> 
>  
> 
>  
> 
> ---------------------------------------------------------------------
> 
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> 
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Classloader bug?

Posted by Asaf Lahav <as...@primagrid.com>.
Well, 

A jar may contain any types of resources.

Further more, 

When I'm using the aspectj jar from regular environment (which is not using
the tomcat webclassloader) it works like a charm...

I would expect the webclassloader to behave just as the native java
classloader does.

 

 

Asaf Lahav

 

VP R&D, Prima Grid LTD.

 

Cellular:  972-54-4717955

 

Phone:   972-3-6540255

 

Fax:       972-3-6540254

 

 

 

 

-----Original Message-----
From: Tim Funk [mailto:funkman@joedog.org] 
Sent: Monday, May 22, 2006 7:28 PM
To: Tomcat Users List
Subject: Re: Classloader bug?

 

Its not a bug. A jar needs to contain classes, not other jars.

 

-Tim

 

Asaf Lahav wrote:

 

>  

> 

> I think encountered a tomcat classloader bug.

> 

> I have a jar file that contains several other jar files.

> 

> I expected the classloader to be aware of the jar files that are packaged

> inside it.

> 

> Anyhow,

> 

> I kept getting classnotfound exceptions until I extracted the contained
jars

> out from the containing jar.

> 

>  

> 

> p.s,

> 

> the problematic jar file is:

> 

> aspectj-1.5.0.jar (of aspectJ)

 

 

---------------------------------------------------------------------

To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org

For additional commands, e-mail: users-help@tomcat.apache.org