|
|
Re: Starting Tomcat 7 as Embedded Server in OSGI Framework [message #885675 is a reply to message #885261] |
Wed, 13 June 2012 12:26 |
Thorsten Schlathölter Messages: 312 Registered: February 2012 Location: Düsseldorf |
Senior Member |
|
|
Thank you Violeta,
I had the gemini blueprint and web bundles already downloaded but I did not dare to open yet another box of bundles. Now you encouraged me to do so. I have installed a target platform for gemini web and added the really simple example from the wiki. It works as expected.
But I need to get a DispatcherServlet running. So I added some more bundles to my configuration.
Namely:
com.springsource.net.sf.cglib-2.1.3.jar
com.springsource.org.aspectj.weaver-1.6.6.RELEASE.jar
org.eclipse.virgo.medic-3.0.3.RELEASE.jar
org.eclipse.virgo.web.dm-3.0.3.RELEASE.jar
org.springframework.asm-3.0.5.RELEASE.jar
org.springframework.context.support-3.0.5.RELEASE.jar
org.springframework.expression-3.0.5.RELEASE.jar
org.springframework.web-3.0.5.RELEASE.jar
org.springframework.web.servlet-3.0.5.RELEASE.jar
spring-osgi-extender-1.2.1.jar
After a couple of hours struggling with this and that I finaly have a spring webservice up and running.
I use the following configuration in the web.xml:
<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>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
The ContextLoaderListener needs the org.springframework.asm.ClassVisitor. So I had to add the org.springframework.asm-3.0.5.RELEASE.jar. I experienced some really strange behaviour. First the class could not be resolved allthough the asm-bundle was included in the launch configuration (I checked that it was in ACTIVE state). I was even able to load that class from a SimpleServlet. So for sure the ClassVisitor was accessible. But while the context was loaded the following exception kept to occure:
SCHWERWIEGEND: Servlet /osgi-web-app threw load() exception
java.lang.ClassNotFoundException: org.springframework.asm.ClassVisitor
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
After doing this and that (I can't really say what), all of a sudden the exception vanished. Just to come back a couple of restarts later. I have no idea what happened. Last time the exception occured, I was able to get rid of it by starting the launch configuration without my service-bundle, then stop it and restart it with the service-bundle. Do you know if this is some kind of caching problem?
Anyway, currently it works! So thanks again this saved my day!
Regards,
Thorsten
[Updated on: Wed, 13 June 2012 12:27] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04334 seconds