You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Rogue angel <an...@mail.ru> on 2009/02/23 17:31:25 UTC

Geronimo sees jars in servlet, but in any object created within this servlet throws NoClassDefFoundError

Hello everyone!

I`m lost with geronimo 2.1.1! Situation:
I have a Geronimo 2.1.1 (on 2.1.3 the same problem). I need to register my
logger in geronimo wich extendeds standart JMSAppender. Within tests
everything with JMS messaging works just fine. I followed the guide to
connect JMS applications in Geronimo, described in the wiki. Example
application works just fine. BUT when i added my logger it breaks. Example
application throws exception on line with extended appender:

17:53:25,031 ERROR [[RegisterServlet]] Servlet.service() for servlet
RegisterServlet threw exception
java.lang.NoClassDefFoundError: javax/jms/Connection
        at webbjms.RegisterServlet.doGet(RegisterServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    ..............

So, before line with constructor javax/jms/Connection exists and in this
line it vanishes. 0_o
Have you ever seen situation when classes are visible within servlet, but
not visible in any other classes called in this servlet?

I tried:
- add jars into lib folder
- check jar versions, for both extended appender and example application is
equal.
- deployed jars into geronimo repository

Question: How to make any other class, except called servlet, to see jar
with Connection class in Geronimo?

Here is zip with test application and code
http://www.nabble.com/file/p22164907/webbJMS.zip webbJMS.zip 
In this example: UserServlet and AdminServlet are example application,
RegisterServlet - example application with registering appender and throws
NoClassDefFoundError.
-- 
View this message in context: http://www.nabble.com/Geronimo-sees-jars-in-servlet%2C-but-in-any-object-created-within-this-servlet-throws-NoClassDefFoundError-tp22164907s134p22164907.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo sees jars in servlet, but in any object created within this servlet throws NoClassDefFoundError

Posted by Rogue angel <an...@mail.ru>.
The problem was in log4j JMSAppender. When i tried to create an instance a
ClassDefFound error thowed. I think geronimo some how looks in jars versions
and rejects some of them.

My solution:
I created exact copy of JMSAppender in my project but with other name and
extends it and it`s works!

It would be helpful if some one will explain the issue reason.


djencks wrote:
> 
> I'm hoping someone else will have time to investigate this in more  
> detail.
> 
> I suspect you left out the next bit of stack trace which would show a  
> log4j class trying to load the Connection class.  This will fail  
> because the log4j classes are loaded in a classloader very near or at  
> the root of the classloader graph and certainly don't have and javaee  
> spec classes such as jms available.
> 
> I think people have dealt with this problem before and it would be  
> great to have a wiki page on what to do (if we don't already).
> 
> One solution is to hide all the log4j classes from your app using the  
> hidden-classes plan element and include a copy of  log4j in your app.
> 
> It may also be possible to just hide the jms appender classes and  
> include those in your app.
> 
> hopefully this will point you in a useful direction.
> 
> thanks
> david jencks
> 
> On Feb 23, 2009, at 8:31 AM, Rogue angel wrote:
> 
>>
>> Hello everyone!
>>
>> I`m lost with geronimo 2.1.1! Situation:
>> I have a Geronimo 2.1.1 (on 2.1.3 the same problem). I need to  
>> register my
>> logger in geronimo wich extendeds standart JMSAppender. Within tests
>> everything with JMS messaging works just fine. I followed the guide to
>> connect JMS applications in Geronimo, described in the wiki. Example
>> application works just fine. BUT when i added my logger it breaks.  
>> Example
>> application throws exception on line with extended appender:
>>
>> 17:53:25,031 ERROR [[RegisterServlet]] Servlet.service() for servlet
>> RegisterServlet threw exception
>> java.lang.NoClassDefFoundError: javax/jms/Connection
>>        at webbjms.RegisterServlet.doGet(RegisterServlet.java:118)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>>        at
>> org 
>> .apache 
>> .catalina 
>> .core 
>> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 
>> 290)
>>        at
>> org 
>> .apache 
>> .catalina 
>> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>    ..............
>>
>> So, before line with constructor javax/jms/Connection exists and in  
>> this
>> line it vanishes. 0_o
>> Have you ever seen situation when classes are visible within  
>> servlet, but
>> not visible in any other classes called in this servlet?
>>
>> I tried:
>> - add jars into lib folder
>> - check jar versions, for both extended appender and example  
>> application is
>> equal.
>> - deployed jars into geronimo repository
>>
>> Question: How to make any other class, except called servlet, to see  
>> jar
>> with Connection class in Geronimo?
>>
>> Here is zip with test application and code
>> http://www.nabble.com/file/p22164907/webbJMS.zip webbJMS.zip
>> In this example: UserServlet and AdminServlet are example application,
>> RegisterServlet - example application with registering appender and  
>> throws
>> NoClassDefFoundError.
>> -- 
>> View this message in context:
>> http://www.nabble.com/Geronimo-sees-jars-in-servlet%2C-but-in-any-object-created-within-this-servlet-throws-NoClassDefFoundError-tp22164907s134p22164907.html
>> Sent from the Apache Geronimo - Users mailing list archive at  
>> Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Geronimo-sees-jars-in-servlet%2C-but-in-any-object-created-within-this-servlet-throws-NoClassDefFoundError-tp22164907s134p22180374.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo sees jars in servlet, but in any object created within this servlet throws NoClassDefFoundError

Posted by Rogue angel <an...@mail.ru>.
Here`s full stacktrace:

10:26:26,578 ERROR [[RegisterServlet]] Servlet.service() for servlet
RegisterServlet threw exception
java.lang.NoClassDefFoundError: javax/jms/Connection
        at webbjms.RegisterServlet.doGet(RegisterServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at
org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
        at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:406)

        at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
        at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)

We have tried to play with geronimo-web.xml But it did not helped.


djencks wrote:
> 
> I'm hoping someone else will have time to investigate this in more  
> detail.
> 
> I suspect you left out the next bit of stack trace which would show a  
> log4j class trying to load the Connection class.  This will fail  
> because the log4j classes are loaded in a classloader very near or at  
> the root of the classloader graph and certainly don't have and javaee  
> spec classes such as jms available.
> 
> I think people have dealt with this problem before and it would be  
> great to have a wiki page on what to do (if we don't already).
> 
> One solution is to hide all the log4j classes from your app using the  
> hidden-classes plan element and include a copy of  log4j in your app.
> 
> It may also be possible to just hide the jms appender classes and  
> include those in your app.
> 
> hopefully this will point you in a useful direction.
> 
> thanks
> david jencks
> 
> On Feb 23, 2009, at 8:31 AM, Rogue angel wrote:
> 
>>
>> Hello everyone!
>>
>> I`m lost with geronimo 2.1.1! Situation:
>> I have a Geronimo 2.1.1 (on 2.1.3 the same problem). I need to  
>> register my
>> logger in geronimo wich extendeds standart JMSAppender. Within tests
>> everything with JMS messaging works just fine. I followed the guide to
>> connect JMS applications in Geronimo, described in the wiki. Example
>> application works just fine. BUT when i added my logger it breaks.  
>> Example
>> application throws exception on line with extended appender:
>>
>> 17:53:25,031 ERROR [[RegisterServlet]] Servlet.service() for servlet
>> RegisterServlet threw exception
>> java.lang.NoClassDefFoundError: javax/jms/Connection
>>        at webbjms.RegisterServlet.doGet(RegisterServlet.java:118)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>>        at
>> org 
>> .apache 
>> .catalina 
>> .core 
>> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 
>> 290)
>>        at
>> org 
>> .apache 
>> .catalina 
>> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>    ..............
>>
>> So, before line with constructor javax/jms/Connection exists and in  
>> this
>> line it vanishes. 0_o
>> Have you ever seen situation when classes are visible within  
>> servlet, but
>> not visible in any other classes called in this servlet?
>>
>> I tried:
>> - add jars into lib folder
>> - check jar versions, for both extended appender and example  
>> application is
>> equal.
>> - deployed jars into geronimo repository
>>
>> Question: How to make any other class, except called servlet, to see  
>> jar
>> with Connection class in Geronimo?
>>
>> Here is zip with test application and code
>> http://www.nabble.com/file/p22164907/webbJMS.zip webbJMS.zip
>> In this example: UserServlet and AdminServlet are example application,
>> RegisterServlet - example application with registering appender and  
>> throws
>> NoClassDefFoundError.
>> -- 
>> View this message in context:
>> http://www.nabble.com/Geronimo-sees-jars-in-servlet%2C-but-in-any-object-created-within-this-servlet-throws-NoClassDefFoundError-tp22164907s134p22164907.html
>> Sent from the Apache Geronimo - Users mailing list archive at  
>> Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Geronimo-sees-jars-in-servlet%2C-but-in-any-object-created-within-this-servlet-throws-NoClassDefFoundError-tp22164907s134p22177881.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Geronimo sees jars in servlet, but in any object created within this servlet throws NoClassDefFoundError

Posted by David Jencks <da...@yahoo.com>.
I'm hoping someone else will have time to investigate this in more  
detail.

I suspect you left out the next bit of stack trace which would show a  
log4j class trying to load the Connection class.  This will fail  
because the log4j classes are loaded in a classloader very near or at  
the root of the classloader graph and certainly don't have and javaee  
spec classes such as jms available.

I think people have dealt with this problem before and it would be  
great to have a wiki page on what to do (if we don't already).

One solution is to hide all the log4j classes from your app using the  
hidden-classes plan element and include a copy of  log4j in your app.

It may also be possible to just hide the jms appender classes and  
include those in your app.

hopefully this will point you in a useful direction.

thanks
david jencks

On Feb 23, 2009, at 8:31 AM, Rogue angel wrote:

>
> Hello everyone!
>
> I`m lost with geronimo 2.1.1! Situation:
> I have a Geronimo 2.1.1 (on 2.1.3 the same problem). I need to  
> register my
> logger in geronimo wich extendeds standart JMSAppender. Within tests
> everything with JMS messaging works just fine. I followed the guide to
> connect JMS applications in Geronimo, described in the wiki. Example
> application works just fine. BUT when i added my logger it breaks.  
> Example
> application throws exception on line with extended appender:
>
> 17:53:25,031 ERROR [[RegisterServlet]] Servlet.service() for servlet
> RegisterServlet threw exception
> java.lang.NoClassDefFoundError: javax/jms/Connection
>        at webbjms.RegisterServlet.doGet(RegisterServlet.java:118)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>        at
> org 
> .apache 
> .catalina 
> .core 
> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 
> 290)
>        at
> org 
> .apache 
> .catalina 
> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>    ..............
>
> So, before line with constructor javax/jms/Connection exists and in  
> this
> line it vanishes. 0_o
> Have you ever seen situation when classes are visible within  
> servlet, but
> not visible in any other classes called in this servlet?
>
> I tried:
> - add jars into lib folder
> - check jar versions, for both extended appender and example  
> application is
> equal.
> - deployed jars into geronimo repository
>
> Question: How to make any other class, except called servlet, to see  
> jar
> with Connection class in Geronimo?
>
> Here is zip with test application and code
> http://www.nabble.com/file/p22164907/webbJMS.zip webbJMS.zip
> In this example: UserServlet and AdminServlet are example application,
> RegisterServlet - example application with registering appender and  
> throws
> NoClassDefFoundError.
> -- 
> View this message in context: http://www.nabble.com/Geronimo-sees-jars-in-servlet%2C-but-in-any-object-created-within-this-servlet-throws-NoClassDefFoundError-tp22164907s134p22164907.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>