Home » Eclipse Projects » Virgo » Problems registering two servlets in a WAB
Problems registering two servlets in a WAB [message #754675] |
Thu, 03 November 2011 20:14 |
Carlos Salinas Messages: 32 Registered: March 2011 Location: Avd. de la Argentina 132,... |
Member |
|
|
Hi all,
I am trying to integrate in Virgo the Atmosphere Framework, a Comet Application framework by Sun. To have support a web app by Atmosphere, you need to define in the web.xml one servlet apart yours, besides another config settings. As in the following example.
<!-- Comet Application features configuration through Atmosphere framework -->
<servlet>
<description>Atmosphere Servlet</description>
<servlet-name>AtmosphereServlet</servlet-name>
<servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
<!-- prevent deadlocks -->
<!-- <init-param> <param-name>org.atmosphere.disableOnStateEvent</param-name>
<param-value>true</param-value> </init-param> -->
<!-- <init-param> <param-name>org.atmosphere.useWebSocket</param-name>
<param-value>true</param-value> </init-param> -->
<!--<init-param> <param-name>org.atmosphere.useNative</param-name> <param-value>true</param-value>
</init-param> <init-param> <param-name>org.atmosphere.useBlocking</param-name>
<param-value>true</param-value> </init-param> -->
<load-on-startup>1</load-on-startup>
<!--Uncomment if you want to use Servlet 3.0 Async Support -->
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>AtmosphereServlet</servlet-name>
<url-pattern>/server-push</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Vaadin Application Servlet</servlet-name>
<servlet-class>com.vaadin.osgi.spring.SpringCometApplicationOSGiServlet</servlet-class>
<init-param>
<description>Vaadin application class to start</description>
<param-name>application</param-name>
<param-value>com.vaadin.osgi.spring.MyVaadinApplication</param-value>
</init-param>
<init-param>
<param-name>widgetset</param-name>
<param-value>com.vaadin.osgi.spring.gwt.CustomWidgetSet</param-value>
</init-param>
<init-param>
<description>Vaadin application class to start</description>
<param-name>version</param-name>
<param-value>0.0.1.SNAPSHOT</param-value>
</init-param>
<init-param>
<description>Vaadin application class to start</description>
<param-name>bean</param-name>
<param-value>myVaadinApplication</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Vaadin Application Servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
The AtmosphereServlet class is in another bundle and the other servlet, the SpringCometApplicationOSGiServlet is a subclass from another servlet that is also in another bundle. So i define in the MANIFEST.MF the necessary dependencies using the Import-Package header. But afterwards the WAB is started in the container, Virgo Generates a dump. So in log file appears the following error:
.......
03-nov-2011 20:34:21 org.apache.catalina.core.StandardContext loadOnStartup
GRAVE: Servlet /vaadin.spring threw load() exception
java.lang.ClassNotFoundException: org.atmosphere.cpr.AtmosphereServlet
" at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)"
" at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)"
" at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)"
" at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)"
" at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)"
" at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)"
" at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043)"
" at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)"
" at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)"
" at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)"
" at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)"
" at java.util.concurrent.FutureTask.run(FutureTask.java:138)"
" at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)"
" at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)"
" at java.lang.Thread.run(Thread.java:680)"
03-nov-2011 20:34:21 org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet Vaadin Application Servlet as unavailable
03-nov-2011 20:34:21 org.apache.catalina.core.StandardContext loadOnStartup
GRAVE: Servlet /vaadin.spring threw load() exception
java.lang.ClassNotFoundException: com.vaadin.terminal.gwt.server.SpringApplicationOSGiServlet
" at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)"
" at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)"
" at java.lang.ClassLoader.defineClass1(Native Method)"
" at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)"
" at java.lang.ClassLoader.defineClass(ClassLoader.java:615)"
" at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)"
" at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2820)"
" at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1150)"
" at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)"
" at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)"
" at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)"
" at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)"
" at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)"
" at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)"
" at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043)"
" at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)"
" at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)"
" at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)"
" at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)"
" at java.util.concurrent.FutureTask.run(FutureTask.java:138)"
" at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)"
" at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)"
" at java.lang.Thread.run(Thread.java:680)"
Bundle com.vaadin.osgi.spring_0.0.1.SNAPSHOT, Service 257, ServiceEvent REGISTERED
E0001I Started web bundle 'com.vaadin.osgi.spring' version '0.0.1.SNAPSHOT' with context path '/vaadin.spring'.
E0003I Dump 'serviceability/dump/2011-11-03-20-34-857' generated
Thread context class loader 'KernelBundleClassLoader: [bundle=com.vaadin.osgi.spring_0.0.1.SNAPSHOT]' popped and set to 'BundleDelegatingClassLoader for [spring-osgi-extender (org.springframework.osgi.extender)]'
.......
Why cannot Apache Catalina load the defined servlets?
Than you.
|
|
| |
Re: Problems registering two servlets in a WAB [message #754788 is a reply to message #754784] |
Fri, 04 November 2011 11:10 |
Carlos Salinas Messages: 32 Registered: March 2011 Location: Avd. de la Argentina 132,... |
Member |
|
|
Hi Glyn,
thank u for ur reply. I was aware of the Virgo in version 3.0.0 is suited to the WAB manifest especification. But i will check if configuring Virgo to behave like Version 2.x i can workaround the problem at the moment.
Here is the MANIFEST.MF of the client wab owns the above web.xml:
Manifest-Version: 1.0
Export-Package: VAADIN.widgetsets.com.vaadin.osgi.spring.gwt.CustomWid
getSet;version="0.0.1.SNAPSHOT",VAADIN.widgetsets.com.vaadin.osgi.spr
ing.gwt.CustomWidgetSet.ie6pngfix;version="0.0.1.SNAPSHOT",VAADIN.wid
getsets.com.vaadin.osgi.spring.gwt.CustomWidgetSet.resources;version=
"0.0.1.SNAPSHOT",com.vaadin.osgi.spring;version="0.0.1.SNAPSHOT";uses
:="com.vaadin,com.vaadin.terminal.gwt.server,javax.servlet,javax.serv
let.http,org.osgi.service.event,org.springframework.beans.factory.ann
otation"
Unversioned-Imports: *
Bundle-Classpath: WEB-INF/classes
Built-By: carlos
Bundle-Name: Vaadin OSGi Spring Application
Import-Library: org.springframework.spring;version="[3.0.5.RELEASE,3.0
.5.RELEASE]"
Created-By: Apache Maven
Web-ContextPath: vaadin.spring
Build-Jdk: 1.6.0_26
Bundle-Version: 0.0.1.SNAPSHOT
Bundle-ManifestVersion: 2
Import-Package: com.vaadin,com.vaadin.event,com.vaadin.osgi.spring.ser
vice,com.vaadin.terminal.gwt.server,com.vaadin.ui,javax.servlet,javax
.servlet.http,org.atmosphere.cpr,org.osgi.service.event,org.springfra
mework.beans.factory.annotation,org.vaadin.addons.serverpush
Bundle-SymbolicName: com.vaadin.osgi.spring
Archiver-Version: Plexus Archiver
|
|
| | | | |
Re: Problems registering two servlets in a WAB [message #756475 is a reply to message #755780] |
Sun, 13 November 2011 20:42 |
Carlos Salinas Messages: 32 Registered: March 2011 Location: Avd. de la Argentina 132,... |
Member |
|
|
Hi Violeta,
I have done a sample project with Atmosphere framework inside the wab, allowing u check the failure with more detail and quicker. I also uploaded the project in github.
com.thingtrack.com.vaadin.addons.osgi (Vaadin's Fragment Bundle)
com.thingtrack.com.vaadin.sample.comet (The sample with atmosphere framework)
To deploy and run the sample, u might before deploy the first project together with the vaadin library in the VIRGO_SERVER/repository/usr and edit VIRGO_SERVER/config/org.eclipse.virgo.kernel.userregion.properties with the following line at then end of the file.
initialArtifacts=......., repository:bundle/com.vaadin/6.6.6
My gihub user.name is carlos-salinas.
Please let me know if u have any problem.
Thanks
[Updated on: Sun, 13 November 2011 20:44] Report message to a moderator
|
|
| | | |
Re: Problems registering two servlets in a WAB [message #758226 is a reply to message #757632] |
Tue, 22 November 2011 11:43 |
Carlos Salinas Messages: 32 Registered: March 2011 Location: Avd. de la Argentina 132,... |
Member |
|
|
Hi Violeta,
my apologies i have seen i forgot to add a button to check the server pushing works. I have just updated the code in github for that, besides i updated another resources in the project to fit some problems u mentioned in ur last post, as the serverpush jar import-package and so on.
I also check the sample removing the context.xml and now it deploys without errors. but when i push the added button i dont receive the serverpush update in the interface, as it should. In the log there is the following:
Exception in thread "Thread-80" java.lang.NoClassDefFoundError: org/atmosphere/cpr/BroadcasterFactory
at org.vaadin.addons.serverpush.ServerPushBroadcasterFactory.getBroadcaster(ServerPushBroadcasterFactory.java:60)
at org.vaadin.addons.serverpush.ServerPushBroadcasterFactory.broadcastForApplication(ServerPushBroadcasterFactory.java:78)
at org.vaadin.addons.serverpush.ServerPushBroadcasterFactory.broadcastForApplication(ServerPushBroadcasterFactory.java:68)
at org.vaadin.addons.serverpush.ServerPushCommunicationManager$1.run(ServerPushCommunicationManager.java:76)
Caused by: org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: org.atmosphere.cpr.BroadcasterFactory in KernelBundleClassLoader: [bundle=com.vaadin.osgi.spring_0.0.1.SNAPSHOT]
at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:138)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 4 more
Caused by: java.lang.ClassNotFoundException: org.atmosphere.cpr.BroadcasterFactory
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)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:134)
... 5 more
But this class, org.atmosphere.cpr.BroadcasterFactory, it is the atmosphere-runtime jar that it also inside the classpath.
I think the problem could come from the context.xml file, because it defines a loader component with the delegate attribute to true, so setting to true, as u know, the class loader will follow the standard Java2 delegation model. But i dont know what implies to the OSGi-fy Tomcat.
Could i embed the context.xml in the tomcat-server.xml as in a tradicional server.xml? If it is possible how would we do it?
Thanks again Violeta
|
|
| | |
Re: Problems registering two servlets in a WAB [message #758792 is a reply to message #758727] |
Thu, 24 November 2011 15:04 |
Violeta Georgieva Messages: 278 Registered: October 2010 |
Senior Member |
|
|
Here are my steps:
1. Unzip Virgo 3.0.1
2. Change WABHeaders=defaulted (Virgo-Home/repository/ext/org.eclipse.virgo.web.properties)
3. Build the both projects provided by you
4. Put in Virgo-Home/repository/usr:
4.1. vaadin-6.6.6.jar
4.2. com.thingtrack.com.vaadin.addons.osgi-0.0.1.SNAPSHOT.jar
5. Add in Virgo-Home/config/org.eclipse.virgo.kernel.userregion.properties
repository:bundle/com.vaadin to the initialArtifacts
6. Start Virgo
7. Modify the web application
7.1. Removed context.xml
7.2. Added atmosphere-compat-jbossweb-0.8.0-RC2.jar to WEB-INF/lib
7.3. Added atmosphere-compat-weblogic-0.8.0-RC2.jar to WEB-INF/lib
7.4. Added atmosphere-compat-jetty-0.8.0-RC2.jar to WEB-INF/lib
8. Put the application in pickup
9. Request it
Please check in the console that the deployed bundle has in the Bundle-Classpath you have listed all jar files from WEB-INF/lib
Here is what I can see on my system
osgi> h 118
Bundle headers:
Archiver-Version = Plexus Archiver
Build-Jdk = 1.6.0_25
Bundle-Classpath = WEB-INF/classes,WEB-INF/lib/serverpush-1.0.6.jar,WEB-INF/lib/atmosphere-gwt-client-0.8.0.RC2.jar,WEB-INF/lib/atmosphere-gwt-server
-0.8.0.RC2.jar,WEB-INF/lib/atmosphere-gwt-common-0.8.0.RC2.jar,WEB-INF/lib/gwt-servlet-2.3.0.jar,WEB-INF/lib/atmosphere-runtime-0.8.0.RC2.jar,WEB-INF/
lib/atmosphere-compat-tomcat-0.8.0.RC2.jar,WEB-INF/lib/slf4j-api-1.6.1.jar,WEB-INF/lib/atmosphere-compat-jbossweb-0.8.0-RC2.jar,WEB-INF/lib/atmosphere
-compat-jetty-0.8.0-RC2.jar,WEB-INF/lib/atmosphere-compat-tomcat-0.8.0-RC2.jar,WEB-INF/lib/atmosphere-compat-weblogic-0.8.0-RC2.jar,WEB-INF/lib/atmosp
here-gwt-client-0.8.0-RC2.jar,WEB-INF/lib/atmosphere-gwt-common-0.8.0-RC2.jar,WEB-INF/lib/atmosphere-gwt-server-0.8.0-RC2.jar,WEB-INF/lib/atmosphere-r
untime-0.8.0-RC2.jar
Bundle-ManifestVersion = 2
Bundle-Name = Vaadin OSGi Spring Application
[Updated on: Thu, 24 November 2011 15:10] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu Sep 26 00:33:01 GMT 2024
Powered by FUDForum. Page generated in 0.07980 seconds
|