OSGi: Vaadin + Virgo not working

I am having problems to get Vaadin 6.6.0 to work with Eclipse Virgo 3.0.0.M05.

I created an OSGi Shared Services WAR using Maven3 and installed it in Virgo (either by dropping WAR in the ‘pickup’ dir, or by running Virgo from Eclipse). The bundle installs correctly and all dependencies can be found (after modifying MANIFEST.MF in vaadin-6.6.0.jar to get it compatible with strict OSGi compliance enforced by Virgo. See
ticket 6945
for details).

However, when I open the URL in the browser I am receiving a ServletException. Only minimal information is provided:

javax.servlet.ServletException: Failed to load application class: test.vaadin.MyApplication
	com.vaadin.terminal.gwt.server.ApplicationServlet.init(ApplicationServlet.java:71)
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	org.eclipse.virgo.web.tomcat.support.ApplicationNameTrackingValve.invoke(ApplicationNameTrackingValve.java:33)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
	java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	java.lang.Thread.run(Thread.java:619)


note: The full stack trace of the root cause is available in the Apache Tomcat/7.0.12 logs.

Although it says that the full information is in the Tomcat logs, this is really all information there is available. I am really stuck here. Tried a lot of different things. In the end I created two minimal projects based on maven-archetype-webapp: one standard WAR and an OSGi web bundle to demonstrate the problem. The standard WAR is of course working, the other is not. The attached zipfile contains both projects and the modified Vaadin jar.

Is there anyone who can help me out here? Any help would be greatly appreciated!
11719.zip (3.88 MB)

I cross-posted this message to the Eclipse Virgo forum. Got some valuable feedback regarding class loading issues. See
http://www.eclipse.org/forums/index.php/mv/msg/210617/676451/#msg_676451
.

After experimenting for a while I cannot get it to work in Virgo. I tried the solution proposed in
Use of context class loader in AbstractApplicationServlet
to no avail.

Can anyone suggest a solution?

I’ve seen Equinox and I think Glassfish being able to run Vaadin in an OSGi environment.

Any news on this topic perhaps?

As I guess for me personally Virgo seems to be the best fit. (I’m a quite intensive Spring-projects user)

Got the same problem:


[2011-09-20 10:47:07.992]
 ERROR http-bio-8080-exec-4         System.err                                                        20 sept. 2011 10:47:07 com.vaadin.terminal.gwt.server.AbstractApplicationServlet checkProductionMode 
[2011-09-20 10:47:08.005]
 ERROR http-bio-8080-exec-4         System.err                                                        ATTENTION:  
[2011-09-20 10:47:08.005]
 ERROR http-bio-8080-exec-4         System.err                                                        ================================================================= 
[2011-09-20 10:47:08.005]
 ERROR http-bio-8080-exec-4         System.err                                                        Vaadin is running in DEBUG MODE. 
[2011-09-20 10:47:08.005]
 ERROR http-bio-8080-exec-4         System.err                                                        Add productionMode=true to web.xml to disable debug features. 
[2011-09-20 10:47:08.005]
 ERROR http-bio-8080-exec-4         System.err                                                        To show debug window, add ?debug to your application URL. 
[2011-09-20 10:47:08.005]
 ERROR http-bio-8080-exec-4         System.err                                                        ================================================================= 
[2011-09-20 10:47:08.006]
 ERROR http-bio-8080-exec-4         System.err                                                        20 sept. 2011 10:47:08 org.apache.catalina.core.StandardWrapperValve invoke 
[2011-09-20 10:47:08.006]
 ERROR http-bio-8080-exec-4         System.err                                                        GRAVE: Allocate exception for servlet HelloWorld 
[2011-09-20 10:47:08.006]
 ERROR http-bio-8080-exec-4         System.err                                                        javax.servlet.ServletException: Failed to load application class: com.bio.core.myprofile.provider.HelloWorld 
[2011-09-20 10:47:08.006]
 ERROR http-bio-8080-exec-4         System.err                                                        	at com.vaadin.terminal.gwt.server.ApplicationServlet.init(ApplicationServlet.java:71) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1228) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1147) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:836) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.eclipse.virgo.web.tomcat.support.ApplicationNameTrackingValve.invoke(ApplicationNameTrackingValve.java:33) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
[2011-09-20 10:47:08.007]
 ERROR http-bio-8080-exec-4         System.err                                                        	at java.lang.Thread.run(Unknown Source) 

Is there a way to solve that problem ?

Thanks.

Up please !

I subclassed AbstractApplicationServlet with the below method and managed to get my Hello World app working fine

    @Override
    protected ClassLoader getClassLoader() throws ServletException {
        return Thread.currentThread ().getContextClassLoader ();
    }

Sorry to dig up an old thread.

But SOO MUCH THANK YOU !

This was exactly what I needed. Everything works fine now =)

Thanks again Steve.