Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Commons logging / log4j : ClassNotFound in JSP when using embedded Jetty/Jasper
Commons logging / log4j : ClassNotFound in JSP when using embedded Jetty/Jasper [message #100131] Fri, 19 October 2007 22:04 Go to next message
Florian Georg is currently offline Florian GeorgFriend
Messages: 27
Registered: July 2009
Junior Member
There were already discussions related to that, but I tried for hours
and couldn't find a solution by now.

I created a bundle, which hosts a web application (Axis 2 web app) under
<bundle.path>/web/WebContent and configured the Jetty Service and Jasper
Servlet accordingly:

==================
=== plugin.xml ===
==================
<extension
point="org.eclipse.equinox.http.registry.httpcontexts">
<httpcontext
id="soda.httpcontext">
<resource-mapping
bundle="org.knime.soda.server.runtime"
path="/web/WebContent">
</resource-mapping>
</httpcontext>
</extension>
<extension
point="org.eclipse.equinox.http.registry.resources">
<resource
alias="/"
base-name="/"
httpcontextId="soda.httpcontext">
</resource>
</extension>
<extension
point="org.eclipse.equinox.http.registry.servlets">
<servlet
alias="/*.jsp"
class="org.eclipse.equinox.jsp.jasper.registry.JSPFactory"
httpcontextId="soda.httpcontext">
</servlet>
</extension>

==================
==== Manifest ====
==================
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.osgi.services,
org.eclipse.osgi.util,
javax.servlet,
javax.servlet.jsp,
org.eclipse.equinox.http.registry,
org.eclipse.equinox.http.servlet,
org.eclipse.equinox.http.jetty,
org.mortbay.jetty,
org.eclipse.equinox.jsp.jasper,
org.eclipse.equinox.jsp.jasper.registry
Eclipse-LazyStart: true
Bundle-ClassPath: .




Now when I open the jsp, say
http://localhost:8080/axis2-web/index.jsp
I get some class loading issues while Jasper compiles the JSP page:


==================
Oct 19, 2007 11:31:05 PM org.mortbay.jetty.servlet.ServletHandler handle
SEVERE: /axis2-web/index.jsp:
org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: No suitable Log
constructor [Ljava.lang.Class;@131303f for
org.apache.commons.logging.impl.Log4JLogger (Caused by
java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by
org.apache.commons.logging.LogConfigurationException: No suitable Log
constructor [Ljava.lang.Class;@131303f for
org.apache.commons.logging.impl.Log4JLogger (Caused by
java.lang.NoClassDefFoundError: org/apache/log4j/Category))
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(L ogFactoryImpl.java:543)
at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(L ogFactoryImpl.java:235)
at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(L ogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java :351)
at
org.apache.jasper.EmbeddedServletOptions.<init>(EmbeddedServletOptions.java:43)
at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:97 )
at org.eclipse.equinox.jsp.jasper.JspServlet.init(JspServlet.ja va:81)
at
org.eclipse.equinox.http.registry.internal.ServletManager$Se rvletWrapper.initializeDelegate(ServletManager.java:195)
at
org.eclipse.equinox.http.registry.internal.ServletManager$Se rvletWrapper.service(ServletManager.java:179)
at
org.eclipse.equinox.http.servlet.internal.ServletRegistratio n.handleRequest(ServletRegistration.java:90)
at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.proce ssAlias(ProxyServlet.java:109)
at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.servi ce(ProxyServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at
org.eclipse.equinox.http.jetty.internal.HttpServerManager$In ternalHttpServiceServlet.service(HttpServerManager.java:288)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder .java:428)
at
org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHan dler.java:677)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandl er.java:568)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java: 820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.ja va:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:8 37)
at
org.mortbay.http.SocketListener.handleConnection(SocketListe ner.java:245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:3 57)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:5 34)
Caused by: org.apache.commons.logging.LogConfigurationException: No
suitable Log constructor [Ljava.lang.Class;@131303f for
org.apache.commons.logging.impl.Log4JLogger (Caused by
java.lang.NoClassDefFoundError: org/apache/log4j/Category)
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstru ctor(LogFactoryImpl.java:413)
at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(L ogFactoryImpl.java:529)
... 25 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstru ctor(LogFactoryImpl.java:410)
... 26 more

==================



I tried every bundle/package import combination I could think of with no
success. Does anybody have an idea what is going wrong? I know that
commons logging is not a natural fit for eclipse class loading strategies...
I really would like to use the embedded server, not the servletbridge..


Thanks for any hints...

-- Florian
Re: Commons logging / log4j : ClassNotFound in JSP when using embedded Jetty/Jasper [message #100203 is a reply to message #100131] Mon, 22 October 2007 14:44 Go to previous message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
That sounds strange. Normally commons logging should be able to catch this
sort of a problem.
You might want to set breakpoints in LogFactoryImpl.getLogClassName.

Are you using the commons.logging that comes from Orbit? (...and comes with
the SDK)
I can only guess that a system property is being used to explicitly bind
commons logging to log4J?

If you _really_ want/need to use log4j you can create a fragment of the
commons logging bundle that adds the log4j imports.

HTH
-Simon

"Florian Georg" <florian.georg@ch.ibm.com> wrote in message
news:ffb9h8$dtg$1@build.eclipse.org...
> There were already discussions related to that, but I tried for hours and
> couldn't find a solution by now.
>
> I created a bundle, which hosts a web application (Axis 2 web app) under
> <bundle.path>/web/WebContent and configured the Jetty Service and Jasper
> Servlet accordingly:
>
> ==================
> === plugin.xml ===
> ==================
> <extension
> point="org.eclipse.equinox.http.registry.httpcontexts">
> <httpcontext
> id="soda.httpcontext">
> <resource-mapping
> bundle="org.knime.soda.server.runtime"
> path="/web/WebContent">
> </resource-mapping>
> </httpcontext>
> </extension>
> <extension
> point="org.eclipse.equinox.http.registry.resources">
> <resource
> alias="/"
> base-name="/"
> httpcontextId="soda.httpcontext">
> </resource>
> </extension>
> <extension
> point="org.eclipse.equinox.http.registry.servlets">
> <servlet
> alias="/*.jsp"
> class="org.eclipse.equinox.jsp.jasper.registry.JSPFactory"
> httpcontextId="soda.httpcontext">
> </servlet>
> </extension>
>
> ==================
> ==== Manifest ====
> ==================
> Require-Bundle: org.eclipse.core.runtime,
> org.eclipse.osgi.services,
> org.eclipse.osgi.util,
> javax.servlet,
> javax.servlet.jsp,
> org.eclipse.equinox.http.registry,
> org.eclipse.equinox.http.servlet,
> org.eclipse.equinox.http.jetty,
> org.mortbay.jetty,
> org.eclipse.equinox.jsp.jasper,
> org.eclipse.equinox.jsp.jasper.registry
> Eclipse-LazyStart: true
> Bundle-ClassPath: .
>
>
>
>
> Now when I open the jsp, say
> http://localhost:8080/axis2-web/index.jsp
> I get some class loading issues while Jasper compiles the JSP page:
>
>
> ==================
> Oct 19, 2007 11:31:05 PM org.mortbay.jetty.servlet.ServletHandler handle
> SEVERE: /axis2-web/index.jsp:
> org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException: No suitable Log
> constructor [Ljava.lang.Class;@131303f for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by
> org.apache.commons.logging.LogConfigurationException: No suitable Log
> constructor [Ljava.lang.Class;@131303f for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
> at
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(L ogFactoryImpl.java:543)
> at
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(L ogFactoryImpl.java:235)
> at
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(L ogFactoryImpl.java:209)
> at org.apache.commons.logging.LogFactory.getLog(LogFactory.java :351)
> at
> org.apache.jasper.EmbeddedServletOptions.<init>(EmbeddedServletOptions.java:43)
> at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:97 )
> at org.eclipse.equinox.jsp.jasper.JspServlet.init(JspServlet.ja va:81)
> at
> org.eclipse.equinox.http.registry.internal.ServletManager$Se rvletWrapper.initializeDelegate(ServletManager.java:195)
> at
> org.eclipse.equinox.http.registry.internal.ServletManager$Se rvletWrapper.service(ServletManager.java:179)
> at
> org.eclipse.equinox.http.servlet.internal.ServletRegistratio n.handleRequest(ServletRegistration.java:90)
> at
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.proce ssAlias(ProxyServlet.java:109)
> at
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.servi ce(ProxyServlet.java:75)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> at
> org.eclipse.equinox.http.jetty.internal.HttpServerManager$In ternalHttpServiceServlet.service(HttpServerManager.java:288)
> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder .java:428)
> at
> org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHan dler.java:677)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandl er.java:568)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
> at org.mortbay.http.HttpServer.service(HttpServer.java:909)
> at org.mortbay.http.HttpConnection.service(HttpConnection.java: 820)
> at org.mortbay.http.HttpConnection.handleNext(HttpConnection.ja va:986)
> at org.mortbay.http.HttpConnection.handle(HttpConnection.java:8 37)
> at
> org.mortbay.http.SocketListener.handleConnection(SocketListe ner.java:245)
> at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:3 57)
> at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:5 34)
> Caused by: org.apache.commons.logging.LogConfigurationException: No
> suitable Log constructor [Ljava.lang.Class;@131303f for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category)
> at
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstru ctor(LogFactoryImpl.java:413)
> at
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(L ogFactoryImpl.java:529)
> ... 25 more
> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
> at java.lang.Class.getDeclaredConstructors0(Native Method)
> at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
> at java.lang.Class.getConstructor0(Unknown Source)
> at java.lang.Class.getConstructor(Unknown Source)
> at
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstru ctor(LogFactoryImpl.java:410)
> ... 26 more
>
> ==================
>
>
>
> I tried every bundle/package import combination I could think of with no
> success. Does anybody have an idea what is going wrong? I know that
> commons logging is not a natural fit for eclipse class loading
> strategies...
> I really would like to use the embedded server, not the servletbridge..
>
>
> Thanks for any hints...
>
> -- Florian
Previous Topic:How to load class with its bundle's classloader ?
Next Topic:Running a permanent "service" in equinox
Goto Forum:
  


Current Time: Thu Apr 25 01:49:43 GMT 2024

Powered by FUDForum. Page generated in 0.03032 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top