Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » FIRST GWT WAB(Classpath problem java.lang.ClassNotFoundException)
FIRST GWT WAB [message #783268] Wed, 25 January 2012 06:43 Go to next message
Moacir Cardoso is currently offline Moacir Cardoso
Messages: 12
Registered: January 2012
Junior Member
I'm trying to create a Web Bundle for a sample GWT application.
I am using the GWT plugin to generate the test application and added EclipseRT Virgo Server Facets to the project. The basic structure of the project was as follows:

br.teste.web.gwt
| __src
   | __ Br.teste.gwt
      | __ ...
| __war
   | __WEB-INF
      | __web.xml
      | __lib
         | __gwt-servlet.jar
   | __META-INF
      | __MANIFEST.MF


MANIFEST.MF

Manifest-Version: 1.0
Class-Path:
Bundle-Version: 1.0.0
Bundle-Name: TesteGWT
Bundle-ManifestVersion: 2
Web-contextPath: webtest
Bundle-SymbolicName: br.teste.gwt


If I compile the project and run directly by GWT it works, but if I deploy directly in VIRGO TOMCAT Server the application loads but clicking on the button an RPC call fails with ClassNotFoundException

java.lang.ClassNotFoundException: br.teste.gwt.server.GreetingServiceImpl
org.eclipse.gemini.web.tomcat.internal.loading.BundleWebappClassLoader.loadClass(BundleWebappClassLoader.java:306)
java.lang.ClassLoader.loadClass (Unknown Source)


I understand that my WAB is not with the classes in classpath.

Any help?
Re: FIRST GWT WAB [message #783271 is a reply to message #783268] Wed, 25 January 2012 06:50 Go to previous messageGo to next message
Moacir Cardoso is currently offline Moacir Cardoso
Messages: 12
Registered: January 2012
Junior Member
My web.xml

<web-app ...
         version="2.5"
         ...>

  <!-- Servlets -->
  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>br.teste.gwt.server.GreetingServiceImpl</servlet-class>
  </servlet>
  
  <servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/gwt_teste/greet</url-pattern>
  </servlet-mapping>
  
  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>Gwt_teste.html</welcome-file>
  </welcome-file-list>

</web-app>

Re: FIRST GWT WAB [message #783285 is a reply to message #783271] Wed, 25 January 2012 07:29 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Try importing the missing package(s) in your manifest.
Re: FIRST GWT WAB [message #783300 is a reply to message #783285] Wed, 25 January 2012 08:06 Go to previous messageGo to next message
Moacir Cardoso is currently offline Moacir Cardoso
Messages: 12
Registered: January 2012
Junior Member
[2012-01-25 11:05:36.263]  TCP Connection(4)-127.0.0.1 <DE0002E> Installation of bundle 'br.teste.gwt' version '1.0.0' failed. org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'br.teste.gwt' at version '1.0.0': Cannot resolve: br.teste.gwt
    Resolver report:
        An Import-Package could not be resolved. Caused by missing constraint in bundle <br.teste.gwt_1.0.0>
             constraint: <Import-Package: br.teste.gwt.server; version="0.0.0">

	at org.eclipse.virgo.kernel.install.pipeline.stage.resolve.internal.QuasiResolveStage.process(QuasiResolveStage.java:45)
	at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessTree(StandardPipeline.java:62)
	at org.eclipse.virgo.kernel.install.pipeline.internal.CompensatingPipeline.doProcessTree(CompensatingPipeline.java:72)
	at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)
	at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessTree(StandardPipeline.java:62)
	at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.driveInstallPipeline(PipelinedApplicationDeployer.java:285)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.doInstall(PipelinedApplicationDeployer.java:164)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.install(PipelinedApplicationDeployer.java:136)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.deploy(PipelinedApplicationDeployer.java:203)
	at org.eclipse.virgo.kernel.deployer.management.StandardDeployer.deploy(StandardDeployer.java:52)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(Unknown Source)
	at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
	at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
	at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(Unknown Source)
	at com.sun.jmx.mbeanserver.PerInterface.invoke(Unknown Source)
	at com.sun.jmx.mbeanserver.MBeanSupport.invoke(Unknown Source)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl.access$200(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
	at sun.rmi.transport.Transport$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Unknown Source)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

[2012-01-25 11:05:36.320]  TCP Connection(4)-127.0.0.1 <DE0003E> Install failed for bundle 'br.teste.gwt' version '1.0.0'. 
[2012-01-25 11:05:36.322]  TCP Connection(4)-127.0.0.1 <DE0500E> Unable to install application from URI 'file:/home/caed/java/virgo-tomcat-server-3.0.2.RELEASE/stage/br.teste.web.gwt.war'. Cannot satisfy constraints for bundle 'br.teste.gwt' version '1.0.0'. Cannot resolve: br.teste.gwt
    Resolver report:
        An Import-Package could not be resolved. Caused by missing constraint in bundle <br.teste.gwt_1.0.0>
             constraint: <Import-Package: br.teste.gwt.server; version="0.0.0">
. org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'br.teste.gwt' at version '1.0.0': Cannot resolve: br.teste.gwt
    Resolver report:
        An Import-Package could not be resolved. Caused by missing constraint in bundle <br.teste.gwt_1.0.0>
             constraint: <Import-Package: br.teste.gwt.server; version="0.0.0">

	at org.eclipse.virgo.kernel.install.pipeline.stage.resolve.internal.QuasiResolveStage.process(QuasiResolveStage.java:45)
	at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessTree(StandardPipeline.java:62)
	at org.eclipse.virgo.kernel.install.pipeline.internal.CompensatingPipeline.doProcessTree(CompensatingPipeline.java:72)
	at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)
	at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessTree(StandardPipeline.java:62)
	at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.driveInstallPipeline(PipelinedApplicationDeployer.java:285)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.doInstall(PipelinedApplicationDeployer.java:164)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.install(PipelinedApplicationDeployer.java:136)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.deploy(PipelinedApplicationDeployer.java:203)
	at org.eclipse.virgo.kernel.deployer.management.StandardDeployer.deploy(StandardDeployer.java:52)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(Unknown Source)
	at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
	at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(Unknown Source)
	at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(Unknown Source)
	at com.sun.jmx.mbeanserver.PerInterface.invoke(Unknown Source)
	at com.sun.jmx.mbeanserver.MBeanSupport.invoke(Unknown Source)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl.access$200(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown Source)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
	at sun.rmi.transport.Transport$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Unknown Source)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)


Re: FIRST GWT WAB [message #783335 is a reply to message #783300] Wed, 25 January 2012 09:35 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Have you installed a bundle which exports the package br.teste.gwt.server?
Re: FIRST GWT WAB [message #783350 is a reply to message #783335] Wed, 25 January 2012 10:10 Go to previous messageGo to next message
Moacir Cardoso is currently offline Moacir Cardoso
Messages: 12
Registered: January 2012
Junior Member
Hi Glyn,
No because my teste app has only this bundle.
This test application is self contained and all that is needed is inside the bundle.
This is possible right?
Re: FIRST GWT WAB [message #783358 is a reply to message #783350] Wed, 25 January 2012 10:22 Go to previous messageGo to next message
Moacir Cardoso is currently offline Moacir Cardoso
Messages: 12
Registered: January 2012
Junior Member
The class br.teste.gwt.server.GreetingServiceImpl is in WEB-INF/classes
Re: FIRST GWT WAB [message #783377 is a reply to message #783268] Wed, 25 January 2012 10:59 Go to previous messageGo to next message
Frieder Heugel is currently offline Frieder Heugel
Messages: 61
Registered: October 2010
Location: Basel, CH
Member
Add the location of your classes to Bundle-ClassPath in the manifest. In your case this should be . and WEB-INF/classes I guess.
Re: FIRST GWT WAB [message #783407 is a reply to message #783377] Wed, 25 January 2012 12:00 Go to previous message
Moacir Cardoso is currently offline Moacir Cardoso
Messages: 12
Registered: January 2012
Junior Member
Add the Bundle-ClassPath in the manifest did the trick Smile
But I had to add each classpath entry one by one, which in a large application can be a pretty boring.
I thought that for a WAB Bundle the OSGI container import the contents of the WEB-INF/classes and WEB-INF/libs into the classpath.

Manifest-Version: 1.0
Class-Path: 
Bundle-Version: 1.0.0
Bundle-Name: TesteGWT
Bundle-ManifestVersion: 2
Web-ContextPath: webtest
Bundle-SymbolicName: br.teste.gwt
Bundle-ClassPath: /WEB-INF/classes, /WEB-INF/lib, /WEB-INF, ., WEB-INF/lib/gwt-servlet.jar
Import-Package: javax.servlet;version="[3.0.0,3.0.0]",
 javax.servlet.http;version="[3.0.0,3.0.0]"


Thanks Frieder and Glyn for the help!

[Updated on: Wed, 25 January 2012 12:00]

Report message to a moderator

Previous Topic:Refresh OSGi bundles programmatically
Next Topic:Maven plugin to deploy bundles to Virgo
Goto Forum:
  


Current Time: Wed Aug 20 08:52:41 EDT 2014

Powered by FUDForum. Page generated in 0.02340 seconds