geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Baylis <maill...@baylishome.me.uk>
Subject Re: Servlet class not found for a REST application in OSGi bundle
Date Sun, 04 Nov 2012 10:16:18 GMT
Hi Ivan,
             I was indeed using a WAB.   I had to add the following 
packages to the Import-Package list in the manifest:-

  org.apache.wink.server.internal.servlet,
  org.apache.geronimo.wink

And REST is now working perfectly.

Thank you

Michael


On 04/11/2012 04:44, Ivan wrote:
> Think that you are using WAB ? If does, it is required to add all the 
> required import-packages, including the one used in web.xml 
> org.apache.wink.server.internal.servlet. Geronimo will only generate 
> import-packages for WAR, not for WAB, as WAB has already been a bundle.
>
> 2012/11/4 Michael Baylis <maillist@baylishome.me.uk 
> <mailto:maillist@baylishome.me.uk>>
>
>     Hi,
>         I'm getting the following error when trying to use REST (WINK)
>     within a OSGi bundle:-
>
>     org.apache.geronimo.common.DeploymentException: Fail to load
>     servlet class
>         at
>     org.apache.geronimo.web25.deployment.merge.annotation.ServletSecurityAnnotationMergeHandler.postProcessWebXmlElement(ServletSecurityAnnotationMergeHandler.java:79)
>         at
>     org.apache.geronimo.web25.deployment.merge.MergeHelper.processWebFragmentsAndAnnotations(MergeHelper.java:418)
>         at
>     org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.basicInitContext(AbstractWebModuleBuilder.java:493)
>         at
>     org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.initContext(AbstractWebModuleBuilder.java:436)
>         at
>     org.apache.geronimo.osgi.web.extender.WebApplication.doRun(WebApplication.java:213)
>         at
>     org.apache.geronimo.osgi.web.extender.WebApplication.run(WebApplication.java:125)
>         at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
>     Source)
>         at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
>         at java.util.concurrent.FutureTask.run(Unknown Source)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
>     Source)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
>     Source)
>         at java.lang.Thread.run(Unknown Source)
>     Caused by: java.lang.ClassNotFoundException:
>     org.apache.wink.server.internal.servlet.RestServlet
>         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.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at
>     org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
>         at
>     org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
>         at
>     org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
>         at
>     org.apache.geronimo.web25.deployment.merge.annotation.ServletSecurityAnnotationMergeHandler.postProcessWebXmlElement(ServletSecurityAnnotationMergeHandler.java:52)
>         ... 11 more
>
>     This is my MANIFEST.MF:-
>     Manifest-Version: 1.0
>     Bundle-ManifestVersion: 2
>     Bundle-Name: xxx.web
>     Bundle-SymbolicName: xxx.web
>     Bundle-Version: 0.1.0.qualifier
>     Bundle-ClassPath: WEB-INF/classes
>     Bundle-RequiredExecutionEnvironment: JavaSE-1.7
>     Web-ContextPath: /ha
>     Import-Package: javax.el;version="2.0";resolution:=optional,
>      javax.servlet;version="2.5",
>      javax.servlet.annotation;resolution:=optional,
>      javax.servlet.http;version="2.5",
>      javax.servlet.jsp;version="2.0",
>      javax.servlet.jsp.el;version="2.0",
>      javax.servlet.jsp.tagext;version="2.0",
>     javax.ws.rs <http://javax.ws.rs>;version="1.1.0"
>
>     My 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_3_0.xsd" version="3.0">
>       <display-name>xxx.web</display-name>
>       <servlet>
>         <description>JAX-RS Tools Generated - Do not modify</description>
>         <servlet-name>JAX-RS Servlet</servlet-name>
>     <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
>           <init-param>
>             <param-name>javax.ws.rs
>     <http://javax.ws.rs>.Application</param-name>
>             <param-value>xxx.RestApplication</param-value>
>           </init-param>
>         <load-on-startup>1</load-on-startup>
>       </servlet>
>       <servlet-mapping>
>         <servlet-name>JAX-RS Servlet</servlet-name>
>         <url-pattern>/rest/*</url-pattern>
>       </servlet-mapping>
>     </web-app>
>
>     I have no other setup files.  I am using the full profile Geronimo
>     3.0.0 release.
>
>     Does anyone know what I have missed?   I have not included the
>     wink jars in the project lib, as I want to use the one installed
>     in the server and I want the benefit on injection.
>
>     Google and forum searches have drawn a blank  :-(
>
>     Thank you,
>
>     Michael
>
>
>
>
> -- 
> Ivan


Mime
View raw message