RE: NoSuchMethodError loading class in webapp from common class loader

2013-05-03 Thread Caldarale, Charles R
> From: Denise K. Erwin [mailto:dkerwi...@gmail.com] 
> Subject: RE: NoSuchMethodError loading class in webapp from common class 
> loader

> Not to say this affects your specific problem, but I see you referencing
> the Servlet 2.4 Specification.
> Tomcat 7 is based on Servlet Specification v3.0:

Which is compatible with 2.4, 2.5, etc., so it's not an issue.
 
 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



RE: NoSuchMethodError loading class in webapp from common class loader

2013-05-03 Thread Denise K. Erwin
> -Original Message-
> From: Bryan Baugher [mailto:bjb...@gmail.com]
> Sent: Friday, May 03, 2013 6:52 AM
> To: users@tomcat.apache.org
> Subject: NoSuchMethodError loading class in webapp from common class
> loader
> 
> Hi,
> 
> I am running Tomcat 7.0.28 on RHEL 6.2 with a single web app. The web app
in
> question uses reflection to load some implementations of our classes (kind
> of like a service loader) knowing the class name. I am trying to add
additional
> implementations by dropping them in the tomcat's lib directory but I keep
> seeing NoSuchMethodError for the constructor to the class.
> 
> I know the constructor is there because if I move the jar into the web
app's
> lib directory (webapp/[WEB_APP]/WEB_INF/lib) everything works.
> 
> I figure this must be some class loader issue I am not understanding but
> these docs[1][2] don't seem to indicate there should be any issue.
> 
> -Bryan
> 
> [1] - http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
> 
> [2] - http://download.oracle.com/otndocs/jcp/servlet-2.4-fr-spec-oth-
> JSpec/

Not to say this affects your specific problem, but I see you referencing
the Servlet 2.4 Specification.
Tomcat 7 is based on Servlet Specification v3.0:

http://jcp.org/en/jsr/detail?id=315

Regards, Denise





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



Re: NoSuchMethodError loading class in webapp from common class loader

2013-05-03 Thread Bryan Baugher
I was able to verify that you are correct the JVM treats those classes as
different which is why I was getting NoSuchMethodError. After experimenting
some more this method seems to be the wrong approach. Do you know of any
better approaches on how to add runtime dependencies to a webapp?


On Fri, May 3, 2013 at 9:45 AM, Bryan Baugher  wrote:

> Sorry I tried to leave on what I thought were unnecessary details.
>
> You are correct my constructor has arguments. One of the arguments comes
> from another dependency jar that exists in both the webapp and tomcat/lib
> so I think your guess (c) could be right. I guess the solution would be to
> move the dependency out of the webapp and into tomcat/lib.
>
>
> On Fri, May 3, 2013 at 9:16 AM, Konstantin Kolinko  > wrote:
>
>> 2013/5/3 Bryan Baugher :
>> > Hi,
>> >
>> > I am running Tomcat 7.0.28 on RHEL 6.2 with a single web app. The web
>> app
>> > in question uses reflection to load some implementations of our classes
>> > (kind of like a service loader) knowing the class name. I am trying to
>> add
>> > additional implementations by dropping them in the tomcat's lib
>> directory
>> > but I keep seeing NoSuchMethodError for the constructor to the class.
>> >
>> > I know the constructor is there because if I move the jar into the web
>> > app's lib directory (webapp/[WEB_APP]/WEB_INF/lib) everything works.
>> >
>> > I figure this must be some class loader issue I am not understanding but
>> > these docs[1][2] don't seem to indicate there should be any issue.
>> >
>> > -Bryan
>> >
>> > [1] - http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
>> >
>> > [2] -
>> http://download.oracle.com/otndocs/jcp/servlet-2.4-fr-spec-oth-JSpec/
>>
>> Using the common classloader is somewhat tricky,  because the "Webapp
>> classloader has priority" rule imposed by servlet spec does mess up
>> things, as explained in [1].
>>
>> Your description does not have enough details, nor source code, nor
>> stacktaces, and with such I would guess that you have the following:
>>
>> a) Your constructor has some arguments
>> b) The classes mentioned as argument types in that method can be
>> loaded both from common class loader and from webapp classloader. (If
>> they cannot be loaded from the former, you are also in trouble).
>> c) Classes loaded from different classloaders are considered different
>> by JVM (even if they have the same name and bytecode),.
>> You are asking for a method specifying its arguments by using classes
>> loaded by webapp classloader and they do not match the ones loaded by
>> common classloader
>>
>> Just a guess.
>>
>> Best regards,
>> Konstantin Kolinko
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>
>
> --
> -Bryan
>



-- 
-Bryan


RE: NoSuchMethodError loading class in webapp from common class loader

2013-05-03 Thread Caldarale, Charles R
> From: Bryan Baugher [mailto:bjb...@gmail.com] 
> Subject: Re: NoSuchMethodError loading class in webapp from common class 
> loader

> One of the arguments comes from another dependency jar that exists 
> in both the webapp and tomcat/lib

Never, never, never put the same class in the webapp and tomcat/lib - that is a 
guarantee of nasty class resolution failures.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



Re: NoSuchMethodError loading class in webapp from common class loader

2013-05-03 Thread Bryan Baugher
Sorry I tried to leave on what I thought were unnecessary details.

You are correct my constructor has arguments. One of the arguments comes
from another dependency jar that exists in both the webapp and tomcat/lib
so I think your guess (c) could be right. I guess the solution would be to
move the dependency out of the webapp and into tomcat/lib.


On Fri, May 3, 2013 at 9:16 AM, Konstantin Kolinko
wrote:

> 2013/5/3 Bryan Baugher :
> > Hi,
> >
> > I am running Tomcat 7.0.28 on RHEL 6.2 with a single web app. The web app
> > in question uses reflection to load some implementations of our classes
> > (kind of like a service loader) knowing the class name. I am trying to
> add
> > additional implementations by dropping them in the tomcat's lib directory
> > but I keep seeing NoSuchMethodError for the constructor to the class.
> >
> > I know the constructor is there because if I move the jar into the web
> > app's lib directory (webapp/[WEB_APP]/WEB_INF/lib) everything works.
> >
> > I figure this must be some class loader issue I am not understanding but
> > these docs[1][2] don't seem to indicate there should be any issue.
> >
> > -Bryan
> >
> > [1] - http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
> >
> > [2] -
> http://download.oracle.com/otndocs/jcp/servlet-2.4-fr-spec-oth-JSpec/
>
> Using the common classloader is somewhat tricky,  because the "Webapp
> classloader has priority" rule imposed by servlet spec does mess up
> things, as explained in [1].
>
> Your description does not have enough details, nor source code, nor
> stacktaces, and with such I would guess that you have the following:
>
> a) Your constructor has some arguments
> b) The classes mentioned as argument types in that method can be
> loaded both from common class loader and from webapp classloader. (If
> they cannot be loaded from the former, you are also in trouble).
> c) Classes loaded from different classloaders are considered different
> by JVM (even if they have the same name and bytecode),.
> You are asking for a method specifying its arguments by using classes
> loaded by webapp classloader and they do not match the ones loaded by
> common classloader
>
> Just a guess.
>
> Best regards,
> Konstantin Kolinko
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


-- 
-Bryan


Re: NoSuchMethodError loading class in webapp from common class loader

2013-05-03 Thread Konstantin Kolinko
2013/5/3 Bryan Baugher :
> Hi,
>
> I am running Tomcat 7.0.28 on RHEL 6.2 with a single web app. The web app
> in question uses reflection to load some implementations of our classes
> (kind of like a service loader) knowing the class name. I am trying to add
> additional implementations by dropping them in the tomcat's lib directory
> but I keep seeing NoSuchMethodError for the constructor to the class.
>
> I know the constructor is there because if I move the jar into the web
> app's lib directory (webapp/[WEB_APP]/WEB_INF/lib) everything works.
>
> I figure this must be some class loader issue I am not understanding but
> these docs[1][2] don't seem to indicate there should be any issue.
>
> -Bryan
>
> [1] - http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
>
> [2] - http://download.oracle.com/otndocs/jcp/servlet-2.4-fr-spec-oth-JSpec/

Using the common classloader is somewhat tricky,  because the "Webapp
classloader has priority" rule imposed by servlet spec does mess up
things, as explained in [1].

Your description does not have enough details, nor source code, nor
stacktaces, and with such I would guess that you have the following:

a) Your constructor has some arguments
b) The classes mentioned as argument types in that method can be
loaded both from common class loader and from webapp classloader. (If
they cannot be loaded from the former, you are also in trouble).
c) Classes loaded from different classloaders are considered different
by JVM (even if they have the same name and bytecode),.
You are asking for a method specifying its arguments by using classes
loaded by webapp classloader and they do not match the ones loaded by
common classloader

Just a guess.

Best regards,
Konstantin Kolinko

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