users@jersey.java.net

Jersey trouble under glassfish 3

From: Morten <mortench2004_at_yahoo.dk>
Date: Thu, 22 Apr 2010 00:08:08 +0000 (GMT)

I have trouble getting jersey to work reliable under glassfish 3. It works for very simple cases but in other cases the CDI-weld integration is not working (javax.inject.Inject sometimes ignored on javax.inject.Singleton annotated controllers). Looking in the log, jersey's undocumented JCDIComponentProviderFactory seems to produce quite some strange exceptions f.x. this one about an ambiguous dependency between my jersey controllers (very strange since I am not aware of any links to a controller unless jersey does some magic and fails). P.S. I tried to look in the source for JCDIComponentProviderFactory in the glassfish's jersey osgi bundle but could not find the source unlike for other jersey modules?? Exception below: #|2010-04-22T01:51:17.141+0200|SEVERE|glassfish3.0|com.sun.jersey.server.impl.jcdi.JCDIComponentProviderFactory|_ThreadID=24;_ThreadName=Thread-1;|The log myappmessage is null. org.jboss.weld.exceptions.AmbiguousResolutionException: WELD-001318 Cannot resolve an ambiguous dependency between [org.jboss.weld.bean-/Users/Shared/Java/glassfishv3/glassfish/domains/domain1/eclipseApps/product-ws/-ManagedBean-class com.myapp.ws.controller.ServiceController, org.jboss.weld.bean-/Users/Shared/Java/glassfishv3/glassfish/domains/domain1/eclipseApps/product-ws/-ManagedBean-class com.myapp.ws.controller.MyController, org.jboss.weld.bean-/Users/Shared/Java/glassfishv3/glassfish/domains/domain1/eclipseApps/product-ws/-ManagedBean-class com.myapp.ws.controller.ControllerBase, org.jboss.weld.bean-/Users/Shared/Java/glassfishv3/glassfish/domains/domain1/eclipseApps/product-ws/-ManagedBean-class com.myapp.ws.controller.GuiController, org.jboss.weld.bean-/Users/Shared/Java/glassfishv3/glassfish/domains/domain1/eclipseApps/product-ws/-ManagedBean-class com.myapp.ws.controller.AdminController] at org.jboss.weld.manager.BeanManagerImpl.resolve(BeanManagerImpl.java:1160) at com.sun.jersey.server.impl.jcdi.JCDIComponentProviderFactory.getBean(JCDIComponentProviderFactory.java:244) at com.sun.jersey.server.impl.jcdi.JCDIComponentProviderFactory.init(JCDIComponentProviderFactory.java:103) at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:654) Any ideas ?