Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328896 - ClassNotFoundException "RequestContextListener" with jetty-maven-plugin and Spring 3
Summary: ClassNotFoundException "RequestContextListener" with jetty-maven-plugin and S...
Status: CLOSED WONTFIX
Alias: None
Product: Jetty
Classification: RT
Component: other (show other bugs)
Version: 7.2.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 7.1.x   Edit
Assignee: Jan Bartel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-27 18:19 EDT by oliver.burkhalter CLA
Modified: 2010-11-02 16:43 EDT (History)
1 user (show)

See Also:


Attachments
example test webapp with jetty7 and spring 3 (8.82 KB, application/zip)
2010-10-28 05:26 EDT, oliver.burkhalter CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description oliver.burkhalter CLA 2010-10-27 18:19:01 EDT
I have implemented a simple webapp with Maven(war packaging) and Spring 3. For testing purposes I use the new "jetty-maven-plugin" in version 7.2.0.v20101020 and execute the command "mvn jetty:run". After that Jetty starts but I always receive following warning message:

"
[INFO] Configuring Jetty for project: Student Module Registration Webapp
[INFO] webAppSourceDirectory D:\Projects\stumr\src\trunk\stumr-webapp\src\main\webapp does not exist. Defaulting to D:\Projects\stumr\src\trunk\stumr-web
p\src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = D:\Projects\stumr\src\trunk\stumr-webapp\target\classes
[INFO] Context path = /
[INFO] Tmp directory = D:\Projects\stumr\src\trunk\stumr-webapp\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = file:/D:/Projects/stumr/src/trunk/stumr-webapp/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = D:\Projects\stumr\src\trunk\stumr-webapp\src\main\webapp
[INFO] Starting jetty 7.2.0.v20101020 ...
2010-10-28 00:06:54.861:INFO::jetty-7.2.0.v20101020
2010-10-28 00:06:55.152:INFO::No Transaction manager found - if your webapp requires one, please configure one.
2010-10-28 00:06:55.216:WARN::Could not instantiate listener org.springframework.web.context.request.RequestContextListener|??á
java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener|??á
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:381)
        at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1270)
        at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1192)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:80)
        at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:67)
        at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:284)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1130)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:577)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:491)
        at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:160)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerCollection$1.run(HandlerCollection.java:200)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
        at java.lang.Thread.run(Thread.java:619)
2010-10-28 00:06:55.258:INFO:/:Initializing Spring root WebApplicationContext
28.10.2010 00:06:55 org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
28.10.2010 00:06:55 org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Thu Oct 28 00:06:55 CEST 2010]; root of context hierarchy
28.10.2010 00:06:55 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContextWeb.xml]
28.10.2010 00:06:55 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@c0fc8e: defining beans []; root of factory hiera
rchy
28.10.2010 00:06:55 org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 228 ms
2010-10-28 00:06:55.538:INFO::Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server
"

Somehow the Maven Plexus component cannot find the Spring class "org.springframework.web.context.request.RequestContextListener" although the corresponding spring-web.jar is in the WEB-INF/lib directory.

May there be a classloader problem or have I configured something wrong?

Tested with:
- Maven 3.0
- Spring 3.0.4
- jetty-maven-plugin 7.2.0.20101020
Comment 1 Jan Bartel CLA 2010-10-27 21:13:08 EDT
Oliver,

When you say the spring jar is in "WEB-INF/lib" what do you mean exactly? The spring jar should be one of the <dependency> in the pom, not copied directly into a directory called WEB-INF/lib.

If you have the spring jar properly defined as a dependency, you can check the classpath by running with a -X argument:

  mvn -X jetty:run


Jan
Comment 2 oliver.burkhalter CLA 2010-10-28 05:26:23 EDT
Created attachment 181915 [details]
example test webapp with jetty7 and spring 3

Hi Jan,

Thanks for your help!

Yes the spring-web.jar and the others are defined in the Maven Pom as dependencies. I meant only that the generated war-file from Maven seems to be built correctly.

I have attached the example webapp Maven project, so you can reproduce maybe the issue. You can find in the zip also a "mavenJettyClasspathLog.txt" file with the output of your suggested command "mvn -X jetty:run".

My setup: JDK 1.6, Maven 3.0, Spring 3.0, Jetty 7.2.0
Comment 3 oliver.burkhalter CLA 2010-11-02 16:43:24 EDT
Hello,

suddenly I have found out the problem!

If you have a exact look at the end of the line:
"...org.springframework.web.context.request.RequestContextListener|??á..."

you see the following chars at the end "??á" and this was the problem because this was somehow in my "web.xml" file and this was a problem for parsing the web.xml.

That's why we can close this ticket.

Thanks!