| Dependency Problem? [message #667667] |
Sat, 30 April 2011 17:58  |
Tidus Messages: 16 Registered: March 2011 |
Junior Member |
|
|
Hello,
I have a problem with dependencies on my Web Application.
So, I made an Dynamic Web Application which uses bundles on virgo.
This application provides rest services thanks to Jersey. This services uses bundles on virgo.
This application works perfectly on Linux.
I tried to use it on Windows 7 with the same virgo server and the same .WAR (copy/past/clean/run)
I always get an error saying that it doesn't find a class from a bundle which is in virgo (repository/usr). There is no compile error.
If a comment the line which uses this bundle, no error.
Have you an idea about this problem? Did i forget a step?
[Updated on: Sat, 30 April 2011 18:05] Report message to a moderator
|
|
|
| Re: Dependency Problem? [message #667679 is a reply to message #667667] |
Sun, 01 May 2011 05:11   |
Tidus Messages: 16 Registered: March 2011 |
Junior Member |
|
|
I will give you an example:
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
import javax.ws.rs.core.Application;
public class TestApplication extends Application {
private Set<Class<?>> classes;
private Set<Object> singletons;
public TestApplication ()
{
classes = new HashSet<Class<?>>();
singletons = new HashSet<Object>();
classes.add(Manager.class);
singletons.add(new Manager());
APlugin plug = new APlugin();
}
@Override
public Set<Class<?>> getClasses() {
return classes;
}
@Override
public Set<Object> getSingletons() {
return singletons;
}
}
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("test")
public class Manager {
@GET
@Path("/hello")
@Produces(MediaType.TEXT_HTML)
public String Test()
{
return "Hello World!";
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>TestService</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>JerseyTest</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>TestApplication </param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JerseyTest</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
Work perfectly on Linux. On Windows, I get exception (tested on 3 computers):
| Quote: | javax.servlet.ServletException: Servlet.init() for servlet JerseyTest threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo rtValve.java:102)
org.eclipse.virgo.web.tomcat.ApplicationNameTrackingValve.in voke(ApplicationNameTrackingValve.java:29)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogVa lve.java:555)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd apter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoin t.java:489)
java.lang.Thread.run(Thread.java:662)
root cause
com.sun.jersey.api.container.ContainerException: The Application class TestApplication could not be instantiated
com.sun.jersey.server.impl.application.DeferredResourceConfi g$ApplicationHolder. <init>(DeferredResourceConfig.java:86)
com.sun.jersey.server.impl.application.DeferredResourceConfi g$ApplicationHolder. <init>(DeferredResourceConfig.java:78)
com.sun.jersey.server.impl.application.DeferredResourceConfi g.getApplication(DeferredResourceConfig.java:75)
com.sun.jersey.server.impl.application.WebApplicationImpl._i nitiate(WebApplicationImpl.java:1028)
com.sun.jersey.server.impl.application.WebApplicationImpl.ac cess$600(WebApplicationImpl.java:159)
com.sun.jersey.server.impl.application.WebApplicationImpl$12 .f(WebApplicationImpl.java:693)
com.sun.jersey.server.impl.application.WebApplicationImpl$12 .f(WebApplicationImpl.java:690)
com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.ja va:193)
com.sun.jersey.server.impl.application.WebApplicationImpl.in itiate(WebApplicationImpl.java:690)
com.sun.jersey.server.impl.application.WebApplicationImpl.in itiate(WebApplicationImpl.java:685)
com.sun.jersey.spi.container.servlet.ServletContainer.initia te(ServletContainer.java:488)
com.sun.jersey.spi.container.servlet.ServletContainer$Intern alWebComponent.initiate(ServletContainer.java:318)
com.sun.jersey.spi.container.servlet.WebComponent.load(WebCo mponent.java:601)
com.sun.jersey.spi.container.servlet.WebComponent.init(WebCo mponent.java:208)
com.sun.jersey.spi.container.servlet.ServletContainer.init(S ervletContainer.java:373)
com.sun.jersey.spi.container.servlet.ServletContainer.init(S ervletContainer.java:556)
javax.servlet.GenericServlet.init(GenericServlet.java:212)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo rtValve.java:102)
org.eclipse.virgo.web.tomcat.ApplicationNameTrackingValve.in voke(ApplicationNameTrackingValve.java:29)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogVa lve.java:555)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd apter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoin t.java:489)
java.lang.Thread.run(Thread.java:662)
|
APlugin is an import-bundle from virgo.
If I comment this line, all is working on Windows. But I need this plugin.
What did i forget?
[Updated on: Sun, 01 May 2011 05:15] Report message to a moderator
|
|
|
|
| Re: Dependency Problem? [message #667731 is a reply to message #667718] |
Sun, 01 May 2011 15:44   |
Tidus Messages: 16 Registered: March 2011 |
Junior Member |
|
|
I checked all my files.
I don"t see any problem.
| Quote: | the param-value has additional whitespace before the closing tag: "TestApplication "
|
My fault when copy/past ^^
I tried something: I move my bundle call from TestApplication to my service Test.
Now I have no initialisation error.
I have a class not found error (I think initialisation was caused by not found error):
exception
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/eclipse/gmt/modisco/infra/browser/custom/core/CustomizationsCatalog
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:418)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.NoClassDefFoundError: org/eclipse/gmt/modisco/infra/browser/custom/core/CustomizationsCatalog
HelloService.hello(HelloService.java:19)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:168)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:71)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:280)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1341)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1273)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1223)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1213)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
APlugin plug = new APlugin() was just an example.
The real line is: CustomizationsCatalog catalog = new CustomizationsCatalog(); from Modisco Plugin.
But that works on Linux. Why?
[Updated on: Sun, 01 May 2011 15:45] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01732 seconds