Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Problem deploying Spring web bundle - ContextLoaderListener not found(Trying to get my first web bundle working on Virgo)
Problem deploying Spring web bundle - ContextLoaderListener not found [message #723494] Thu, 08 September 2011 16:50 Go to next message
Simon Watson is currently offline Simon WatsonFriend
Messages: 30
Registered: September 2011
Member
Hi all,

I'm new to Virgo and trying to get my first web bundle working with Virgo 3, Spring 3.0.5, and Eclipse 3.7.

I've created a simple web project bundle but Virgo fails to deploy it, throwing an exception: java.lang.ClassNotFoundException: ?org.springframework.web.context.ContextLoaderListener

To try and ensure I'm not missing any dependencies, I've now added the Spring library to my manifest but I still get the same problem. In my Eclipse project's bundle dependencies, I can see all the Spring JARs, including .../virgo-tomcat-server-3.0.0.RELEASE/repository/ext/org.springframework.web-3.0.5.RELEASE.jar. In Virgo's admin tool I can also see that this bundle has been loaded.

If I remove the following lines from web.xml, the bundle deploys and I can access static pages e.g. index.html.
<listener>
	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


Given I'm new to this, I'm sure I'm missing something obvious but would be very grateful for any pointers.

Thanks,

Simon.


web.xml

	
	<display-name>Test Spring Web App</display-name>

	<context-param>
		<param-name>contextClass</param-name>
		<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
	</context-param>

	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<servlet>
		<servlet-name>springmvc</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
            <param-name>contextClass</param-name>
            <param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
		
	</servlet>
	<servlet-mapping>
		<servlet-name>springmvc</servlet-name>
		<url-pattern>/app/*</url-pattern>
	</servlet-mapping>

	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
	</welcome-file-list>
	
</web-app>


MANIFEST.MF
Manifest-Version: 1.0
Class-Path: 
Bundle-Version: 1.0.0
Bundle-Name: Test Spring Web App Bundle
Bundle-ManifestVersion: 2
Web-ContextPath: /test
Bundle-SymbolicName: com.my.test
Import-Package: org.eclipse.virgo.web.dm
Import-Library: org.springframework.spring;version="[3.0.5.RELEASE,3.0.5.RELEASE]"


Exception from log:
Sep 8, 2011 5:24:53 PM org.apache.catalina.core.StandardContext listenerStart 
[2011-09-08 17:24:53.496] ERROR Thread-101                   System.err                                                        SEVERE: Error configuring application listener of class ?org.springframework.web.context.ContextLoaderListener 
[2011-09-08 17:24:53.496] ERROR Thread-101                   System.err                                                        java.lang.ClassNotFoundException: ?org.springframework.web.context.ContextLoaderListener 
[2011-09-08 17:24:53.496] ERROR Thread-101                   System.err                                                        	at org.eclipse.gemini.web.tomcat.internal.loading.BundleWebappClassLoader.loadClass(BundleWebappClassLoader.java:306) 
[2011-09-08 17:24:53.496] ERROR Thread-101                   System.err                                                        	at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 
[2011-09-08 17:24:53.496] ERROR Thread-101                   System.err                                                        	at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415) 
[2011-09-08 17:24:53.496] ERROR Thread-101                   System.err                                                        	at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397) 
[2011-09-08 17:24:53.496] ERROR Thread-101                   System.err                                                        	at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118) 
[2011-09-08 17:24:53.497] ERROR Thread-101                   System.err                                                        	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4638) 
[2011-09-08 17:24:53.497] ERROR Thread-101                   System.err                                                        	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204) 
[2011-09-08 17:24:53.497] ERROR Thread-101                   System.err                                                        	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199) 
[2011-09-08 17:24:53.497] ERROR Thread-101                   System.err                                                        	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
[2011-09-08 17:24:53.497] ERROR Thread-101                   System.err                                                        	at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
[2011-09-08 17:24:53.497] ERROR Thread-101                   System.err                                                        	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
[2011-09-08 17:24:53.497] ERROR Thread-101                   System.err                                                        	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
[2011-09-08 17:24:53.497] ERROR Thread-101                   System.err                                                        	at java.lang.Thread.run(Thread.java:680) 
Re: Problem deploying Spring web bundle - ContextLoaderListener not found [message #723495 is a reply to message #723494] Thu, 08 September 2011 16:58 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
Just remove the symbol before the class name (question mark), i.e. you may try this instead:

<listener>
	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

[Updated on: Thu, 08 September 2011 16:59]

Report message to a moderator

Re: Problem deploying Spring web bundle - ContextLoaderListener not found [message #723508 is a reply to message #723495] Thu, 08 September 2011 17:32 Go to previous messageGo to next message
Simon Watson is currently offline Simon WatsonFriend
Messages: 30
Registered: September 2011
Member
There isn't a question mark in front of it within the web.XML file. I think that's just how it's logged isn't it?
Re: Problem deploying Spring web bundle - ContextLoaderListener not found [message #723512 is a reply to message #723508] Thu, 08 September 2011 17:42 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
Normally:

java.lang.ClassNotFoundException: that.doesnot.Exist

And in your case:

java.lang.ClassNotFoundException: ?org.springframework.web.context.ContextLoaderListener

So, there is a hidden symbol in your class path in the <listener-class>...</listener-class> tag...
Re: Problem deploying Spring web bundle - ContextLoaderListener not found [message #723514 is a reply to message #723508] Thu, 08 September 2011 17:43 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
Hi Simon,

Can you please check the value of "WABHeaders" property in $VIRGO_HOME/repository/ext/org.eclipse.virgo.web.properties

Is it set to "strict" or "defaulted"? Try setting it to "defaulted" and restart virgo with -clean (just to make sure there is nothing in left hanging around).
If you do not want to have virgo transforming the manifest, try adding


Bundle-ClassPath: .,WEB-INF/classes


Regards,
Dmitry
Re: Problem deploying Spring web bundle - ContextLoaderListener not found [message #723736 is a reply to message #723514] Fri, 09 September 2011 10:01 Go to previous messageGo to next message
Simon Watson is currently offline Simon WatsonFriend
Messages: 30
Registered: September 2011
Member
Many thanks for the helpful replies - I've now fixed the problem Razz

I tired changing the WABHeaders and manifest class path but that didn't fix it. I then opened up web.xml in an external editor and noticed a spurious character before the class name which the Eclipse IDE wasn't showing. With this removed, the bundle deploys and works as expected.

Thanks again,

Simon.
Re: Problem deploying Spring web bundle - ContextLoaderListener not found [message #723852 is a reply to message #723514] Fri, 09 September 2011 16:56 Go to previous messageGo to next message
pinkfloyd_360 is currently offline pinkfloyd_360Friend
Messages: 15
Registered: August 2011
Junior Member
Dmitry Sklyut wrote on Thu, 08 September 2011 10:43
Hi Simon,

Can you please check the value of "WABHeaders" property in $VIRGO_HOME/repository/ext/org.eclipse.virgo.web.properties

Is it set to "strict" or "defaulted"? Try setting it to "defaulted" and restart virgo with -clean (just to make sure there is nothing in left hanging around).
If you do not want to have virgo transforming the manifest, try adding


Bundle-ClassPath: .,WEB-INF/classes


Regards,
Dmitry


I'm have been having the exact problem, however, even after changing "strict" to "defaulted" in the property file and restarting the server in clean mode, I'm still getting the exact same errors.

Can someone help please?

I've included all the details in this topic: http://www.eclipse.org/forums/index.php/t/238057/

Thanks.
Re: Problem deploying Spring web bundle - ContextLoaderListener not found [message #724252 is a reply to message #723736] Sun, 11 September 2011 19:00 Go to previous message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
Simon Watson wrote on Fri, 09 September 2011 06:01
I then opened up web.xml in an external editor and noticed a spurious character before the class name which the Eclipse IDE wasn't showing.


You can let eclipse show whitespace characters. Just open a file in the Text Editor and press the option "Show Whitespace Characters" available in the tool bar...
Previous Topic:Virgo w/Spring 3.1.0.M2
Next Topic:Virgo 3.0.1 Released
Goto Forum:
  


Current Time: Thu Mar 28 22:33:25 GMT 2024

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

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

Back to the top