users@jersey.java.net

Re: [Jersey] Failure [Returned null to createEntityManagerFactory.] in CustomerDB Sample (From NB 6.0.1) on Sailfin Milestone 4 Build

From: Peter Liu <Peter.Liu_at_Sun.COM>
Date: Thu, 15 May 2008 12:05:29 -0700

Hi Louis,

The sample project uses the sample derby database that comes with NB and
uses the jdbc/sample datasource registered with the appserver.
Could you check to see if this datasource is registered with your
Sailfin instance?

Peter

Louis Alexander wrote:
> All,
>
> Im running NB 6.0.1 with Sailfin (essentially glassfish) milestone 4
> build. I am having trouble getting a RESTful service built on top of
> Entity classes to work. I have no problem getting persistent entity
> beans to work in general, and have had success using the TopLink as
> the Persistence Provider with derby. To make sure i wasn't going
> insane, i opened the new project wizard and created an instance of the
> Samples->RESTful Web Services->Customer Database project which is
> described as "a web project containing RESTful web services based on
> entity classes generated from a customer database". When i built and
> deployed the project (after launching my update manager in
> sailfin/glassfish to ensure that there were no new updates to the
> Jersey framework) i popped open the RESTful Web Service Tester only to
> find the same exception that i had with my own code. Can anyone point
> me in the right direction? I have tried tweaking my persistence.xml
> by hand, as well as changing Persistence providers (but i know TopLink
> should work, it has earlier this week).
>
> Here is this exception i get, i hope it looks familiar to someone:
>
> StandardWrapperValve[ServletAdaptor]: PWC1406: Servlet.service() for
> servlet ServletAdaptor threw exception
> javax.persistence.PersistenceException: No Persistence provider for
> EntityManager named CustomerDBPU: The following providers:
> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
> oracle.toplink.essentials.PersistenceProvider
> Returned null to createEntityManagerFactory.
> at
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154)
> at
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
> at
> customerdb.service.PersistenceService.<init>(PersistenceService.java:69)
> at
> customerdb.service.PersistenceService.<init>(PersistenceService.java:55)
> at
> customerdb.service.PersistenceService$1.initialValue(PersistenceService.java:60)
> at
> customerdb.service.PersistenceService$1.initialValue(PersistenceService.java:59)
> at
> java.lang.ThreadLocal$ThreadLocalMap.getAfterMiss(ThreadLocal.java:374)
> at java.lang.ThreadLocal$ThreadLocalMap.get(ThreadLocal.java:347)
> at
> java.lang.ThreadLocal$ThreadLocalMap.access$000(ThreadLocal.java:225)
> at java.lang.ThreadLocal.get(ThreadLocal.java:127)
> at
> customerdb.service.PersistenceService.getInstance(PersistenceService.java:86)
> at
> customerdb.service.DiscountCodesResource.get(DiscountCodesResource.java:101)
> 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:585)
> at
> com.sun.ws.rest.impl.model.method.dispatch.EntityParamDispatchProvider$TypeOutInvoker._dispatch(EntityParamDispatchProvider.java:107)
> at
> com.sun.ws.rest.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:66)
> at
> com.sun.ws.rest.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:108)
> at
> com.sun.ws.rest.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:55)
> at
> com.sun.ws.rest.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:88)
> at
> com.sun.ws.rest.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:49)
> at
> com.sun.ws.rest.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:369)
> at
> com.sun.ws.rest.spi.container.servlet.ServletContainer.service(ServletContainer.java:130)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
> at
> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
> at
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
> at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
> at
> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> at
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
> at
> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
> at
> com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:116)
>
> --
> Thanks,
>
> Louis