[Jersey] Re: About jersey osgi-http-service sample in glassfish

  • From: Tang Yong <tangyong@...>
  • To: users@..., users@..., Sahoo <sanjeeb.sahoo@...>
  • Subject: [Jersey] Re: About jersey osgi-http-service sample in glassfish
  • Date: Tue, 05 Feb 2013 14:49:18 +0900

Hi sahoo,

Please ignore the mail and I have resolved the issue.

By setting correct thread current context classloader, I can register
jersey servlet while putting the bundle into autostart directory.

Thanks
--Tang

Tang Yong wrote:
> Hi Sahoo, Jersey Team
> 
> I have a question about  jersey osgi-http-service sample[1].
> 
> [1]: https://github.com/jersey/jersey/tree/master/examples/osgi-http-service
> 
> After starting glassfish domain, if using "asadmin deploy --type=osgi
> ..." to deploy the jersey osgi sample bundle, anything is OK.
> 
> However, if I put the jersey osgi sample bundle into
> glassfish/modules/autostart/ , then after starting glassfish domain, the
> following exception happened in the server.log and rest endpoint is
> created failed,
> 
> [#|2013-02-04T16:45:37.062+0900|INFO|glassfish
> 4.0|javax.enterprise.logging.stdout|_ThreadID=74;_ThreadName=pool-17-thread-1;_TimeMillis=1359963937062;_LevelValue=800;|ERROR:
> Bundle org.glassfish.jersey.examples.osgi-http-service.bundle [272]
> EventDispatcher: Error during dispatch. (java.lang.RuntimeException:
> javax.servlet.ServletException: javax.servlet.ServletException: [failed
> to localize]
> resource.config.unable.to.load(org.glassfish.jersey.examples.osgihttpservice.JerseyApplication))|#]
> 
> [#|2013-02-04T16:45:37.078+0900|SEVERE|glassfish
> 4.0|javax.enterprise.logging.stderr|_ThreadID=74;_ThreadName=pool-17-thread-1;_TimeMillis=1359963937078;_LevelValue=1000;|java.lang.RuntimeException:
> javax.servlet.ServletException: javax.servlet.ServletException: [failed
> to localize]
> resource.config.unable.to.load(org.glassfish.jersey.examples.osgihttpservice.JerseyApplication)
>       at
> org.glassfish.jersey.examples.osgihttpservice.Activator.registerServlets(Activator.java:109)
>       at
> org.glassfish.jersey.examples.osgihttpservice.Activator.access$100(Activator.java:60)
>       at
> org.glassfish.jersey.examples.osgihttpservice.Activator$1.addingService(Activator.java:78)
>       at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:980)
>       at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:906)
>       at
> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:262)
>       at 
> org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:234)
>       at
> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:941)
>       at
> org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
>       at
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
>       at
> org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
>       at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
>       at org.apache.felix.framework.Felix.registerService(Felix.java:3275)
>       at
> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
>       at
> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:320)
>       at org.glassfish.osgihttp.Activator.doActualWork(Activator.java:137)
>       at org.glassfish.osgihttp.Activator.access$300(Activator.java:84)
>       at
> org.glassfish.osgihttp.Activator$OSGiHtttpExtender.start(Activator.java:332)
>       at
> org.glassfish.osgijavaeebase.ExtenderManager$ExtenderTracker.addingService(ExtenderManager.java:144)
>       at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:980)
>       at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:906)
>       at
> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:262)
>       at
> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:185)
>       at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:348)
>       at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:283)
>       at
> org.glassfish.osgijavaeebase.ExtenderManager.startExtenders(ExtenderManager.java:109)
>       at
> org.glassfish.osgijavaeebase.ExtenderManager.access$100(ExtenderManager.java:67)
>       at
> org.glassfish.osgijavaeebase.ExtenderManager$GlassFishServerTracker$1.run(ExtenderManager.java:192)
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>       at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>       at java.lang.Thread.run(Thread.java:722)
> Caused by: javax.servlet.ServletException:
> javax.servlet.ServletException: [failed to localize]
> resource.config.unable.to.load(org.glassfish.jersey.examples.osgihttpservice.JerseyApplication)
>       at
> org.glassfish.osgihttp.GlassFishHttpService.registerServlet(GlassFishHttpService.java:105)
>       at
> org.glassfish.osgihttp.HttpServiceWrapper.registerServlet(HttpServiceWrapper.java:93)
>       at
> org.glassfish.jersey.examples.osgihttpservice.Activator.rawRegisterServlets(Activator.java:119)
>       at
> org.glassfish.jersey.examples.osgihttpservice.Activator.registerServlets(Activator.java:105)
>       ... 33 more
> Caused by: javax.servlet.ServletException: [failed to localize]
> resource.config.unable.to.load(org.glassfish.jersey.examples.osgihttpservice.JerseyApplication)
>       at
> org.glassfish.jersey.servlet.WebComponent.createResourceConfig(WebComponent.java:378)
>       at 
> org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:251)
>       at
> org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:144)
>       at
> org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:326)
>       at javax.servlet.GenericServlet.init(GenericServlet.java:244)
>       at
> org.glassfish.osgihttp.OSGiServletWrapper.initializeServlet(OSGiServletWrapper.java:92)
>       at
> org.glassfish.osgihttp.GlassFishHttpService.registerServlet(GlassFishHttpService.java:103)
>       ... 36 more
> Caused by: java.lang.ClassNotFoundException:
> org.glassfish.jersey.examples.osgihttpservice.JerseyApplication not
> found by org.glassfish.jersey.core.jersey-common [165]
>       at
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
>       at
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
>       at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>       at java.lang.Class.forName0(Native Method)
>       at java.lang.Class.forName(Class.java:186)
>       at
> org.glassfish.jersey.internal.util.ReflectionHelper.classForNameWithException(ReflectionHelper.java:284)
>       at
> org.glassfish.jersey.internal.util.ReflectionHelper.classForNameWithException(ReflectionHelper.java:262)
>       at
> org.glassfish.jersey.servlet.WebComponent.createResourceConfig(WebComponent.java:368)
>       ... 42 more
> |#]
> 
>>From the above exception, this should belong to class loader issue.
> 
> Thanks
> --Tang
> 
> 
> 



[Jersey] About jersey osgi-http-service sample in glassfish

Tang Yong 02/04/2013

[Jersey] Re: About jersey osgi-http-service sample in glassfish

Tang Yong 02/05/2013
Terms of Use; Privacy Policy; Copyright ©2013-2014 (revision 20140418.2d69abc)
 
 
Close
loading
Please Confirm
Close