Hi All,
I am trying to deploy Jetty server in my Equinox OSGi runtime. I was able to deploy the org.mortbay.jetty jar and the additional equinox jars and was able to register my servlet using OSGi http service and was able to view the same in browser. But my requirement is that I want to design so that in future i might be able to provide a container where web applications can be deployed as well. Therefore i want to directly use org.mortbay.jetty.Server class to add my servlets rather than HttpService. Server server = new Server(); SocketListener listener = new SocketListener(); listener.setPort(8080); server.addListener(listener); ServletHttpContext httpcontext = (ServletHttpContext)server.getContext("/servlet"); httpcontext.addServlet("Hello", "/hello", "axisserver.HelloWorldServlet"); server.start(); Since I do not want the equinox http service to register and do the starting up of the server, I load my OSGi runtime with org.mortbay.jetty jar alone and start my bundle in which I have the above code snippet in the start method of my activator. My first question is whether it is ok for me to do this within OSGi, or should I always use only the HttpService interface provided my OSGi. ? The second question is The problem is that everytime I start my bundle, it gives me a ClassNotFound exception and does not start. Have attached the stack trace. The class is within my bundle, so am not able to understand why it is not found. From the stack trace understood that the mortbay bundle is probably trying to load the class, therefore tried exporting my package as well, but to no avail. Read in some of the jetty forums that these class loading issues can be resolved by Eclipse Buddy policy. Am not sure how to use them. Also read about how PDE can be helpful in deducting and fixing these class loading issues. Any idea on how this issue can be fixed/ details on what HttpService is doing extra while using Jetty Server, in order to put the classes in mortbay jetty server`s space would be helpful Any help in this regard, would be greatly appreciated. P.S : Have herewith attached stack trace. Thanks, Srijith.
osgi> start 24 May 29, 2008 3:14:50 PM org.mortbay.http.HttpServer doStart INFO: Version Jetty/5.1.x May 29, 2008 3:14:50 PM org.mortbay.http.SocketListener start INFO: Started SocketListener on 0.0.0.0:8080 org.mortbay.util.MultiException[java.lang.ClassNotFoundException: axisserver.HelloWorldServlet] at org.mortbay.http.HttpServer.doStart(HttpServer.java:686) at org.mortbay.util.Container.start(Container.java:72) at axisserver.Activator.start(Activator.java:44) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:252) at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:260) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:145) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:291) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:276) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:218) at java.lang.Thread.run(Thread.java:619) java.lang.ClassNotFoundException: axisserver.HelloWorldServlet at java.lang.ClassLoader.findClass(ClassLoader.java:358) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at org.eclipse.core.runtime.internal.adaptor.ContextFinder.loadClass(ContextFinder.java:124) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.mortbay.http.HttpContext.loadClass(HttpContext.java:1227) at org.mortbay.jetty.servlet.Holder.start(Holder.java:188) at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:219) at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:446) at org.mortbay.jetty.servlet.ServletHandler.doStart(ServletHandler.java:415) at org.mortbay.util.Container.start(Container.java:72) at org.mortbay.http.HttpContext.startHandlers(HttpContext.java:1704) at org.mortbay.http.HttpContext.doStart(HttpContext.java:1675) at org.mortbay.util.Container.start(Container.java:72) at org.mortbay.http.HttpServer.doStart(HttpServer.java:708) at org.mortbay.util.Container.start(Container.java:72) at axisserver.Activator.start(Activator.java:44) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:252) at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:260) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:145) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:291) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:276) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:218) at java.lang.Thread.run(Thread.java:619) java.lang.ClassNotFoundException: axisserver.HelloWorldServlet at java.lang.ClassLoader.findClass(ClassLoader.java:358) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at org.eclipse.core.runtime.internal.adaptor.ContextFinder.loadClass(ContextFinder.java:124) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.mortbay.http.HttpContext.loadClass(HttpContext.java:1227) at org.mortbay.jetty.servlet.Holder.start(Holder.java:188) at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:219) at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:446) at org.mortbay.jetty.servlet.ServletHandler.doStart(ServletHandler.java:415) at org.mortbay.util.Container.start(Container.java:72) at org.mortbay.http.HttpContext.startHandlers(HttpContext.java:1704) at org.mortbay.http.HttpContext.doStart(HttpContext.java:1675) at org.mortbay.util.Container.start(Container.java:72) at org.mortbay.http.HttpServer.doStart(HttpServer.java:708) at org.mortbay.util.Container.start(Container.java:72) at axisserver.Activator.start(Activator.java:44) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:252) at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:260) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:145) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:291) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:276) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:218) at java.lang.Thread.run(Thread.java:619)
_______________________________________________ equinox-dev mailing list equinox-dev@eclipse.org https://dev.eclipse.org/mailman/listinfo/equinox-dev