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: Louis Alexander <panicked.kernel_at_gmail.com>
Date: Fri, 16 May 2008 09:06:38 -0400

I just tried a fresh install of sailfin milestone 4 on my windows machine
and tried deploying the sample we worked with yesterday using NB 6.1 and
then the "Test RESTful web services" utility.

Same error :(.

I wonder if it has something to do with how i have set up my server in
NB6.1? I added the new sailfin server as follows:

Tools->Servers->Add Server Instance

Choose Server: Sailfin V1 -> Next
(Accept Defaults) -> Next
admin/adminadmin -> Finish

Then i modified the project to now deploy to the new server, and did an
undeploy and redeploy... Same error.

What version JDK are you running?

This is getting interesting :)



On Thu, May 15, 2008 at 5:11 PM, Peter Liu <Peter.Liu_at_sun.com> wrote:

> Just tried it with sailfin milestone 4 on my windows machine and it worked
> fine for me.
> I didn't have to do anything special. It should work just like plain
> glassfish.
> BTW, did you install sailfin with clustering? I installed it without
> clustering.
>
> Peter
>
> Louis Alexander wrote:
>
>> (Please excuse the previous empty mail...)
>>
>> Peter,
>> I followed your instructions to the letter (on a newly installed NB 6.1)
>> and i got the same problem, but on a hunch i tried it again on the GlassFish
>> server that ships with 6.1 and it worked just fine :(. Im running Sailfin
>> Milestone 4, and was under the impression that its essentially GlassFish
>> with the SIP Framework... maybe its something as simple as my classpath? Im
>> going to poke around and see if i note any differences, can you suggest some
>> places to inspect/compare?
>>
>> Thanks!
>>
>> On Thu, May 15, 2008 at 3:59 PM, Louis Alexander <
>> panicked.kernel_at_gmail.com <mailto:panicked.kernel_at_gmail.com>> wrote:
>>
>> Peter,
>>
>> On Thu, May 15, 2008 at 3:43 PM, Peter Liu <Peter.Liu_at_sun.com
>> <mailto:Peter.Liu_at_sun.com>> wrote:
>>
>> That's very strange. One thing you can try is to create the
>> customerdb project from scratch and see if it works. Here is how:
>>
>> 1. Create a web project.
>> 2. Right click on the project node and select "Entity Classes
>> from Database"
>> 3. In the wizard, click on the Data Source combo box and
>> select jdbc/sample. (The wizard should then load
>> the available tables into the wizard.)
>> 4. Select CUSTOMER and DISCOUNT_CODE tables from the
>> Available Table list and click on Add.
>> 5. Click on Next and in the next panel, specify a package name
>> and then click on the
>> "Create Persistence Unit" button.
>> 6. In the "Create Persistence Unit" dialog, simply click on
>> Create.
>> 7. Click on Finish to generated the entity classes.
>> 8. Right click on the project node and select "RESTful Web
>> Services from Entity Classes".
>> 9. In the wizard, you should see Customer and DiscountCode
>> entity classes. Click on Add All.
>> 10. Click on Next and then Finish to generated the RESTful
>> resource classes.
>> 11. Right click on the project node and select "Test RESTful
>> Web Services".
>>
>> Let me know if you can get this to work.
>>
>> Peter
>>
>> Louis Alexander wrote:
>>
>> Yes it is registered, and i have gotten it to work with
>> one of the persistence examples from Carol McDonald's blog
>> (
>> http://weblogs.java.net/blog/caroljmcdonald/archive/2007/09/sample_applicat_2.html
>> )
>>
>> But when it comes to RESTful web serves + Persistence, i
>> just get that exception.
>>
>> Thanks
>>
>>
>> On Thu, May 15, 2008 at 3:05 PM, Peter Liu
>> <Peter.Liu_at_sun.com <mailto:Peter.Liu_at_sun.com>
>> <mailto:Peter.Liu_at_sun.com <mailto:Peter.Liu_at_sun.com>>> wrote:
>>
>> 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
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> users-unsubscribe_at_jersey.dev.java.net
>> <mailto:users-unsubscribe_at_jersey.dev.java.net>
>> <mailto:users-unsubscribe_at_jersey.dev.java.net
>> <mailto:users-unsubscribe_at_jersey.dev.java.net>>
>>
>> For additional commands, e-mail:
>> users-help_at_jersey.dev.java.net
>> <mailto:users-help_at_jersey.dev.java.net>
>> <mailto:users-help_at_jersey.dev.java.net
>> <mailto:users-help_at_jersey.dev.java.net>>
>>
>>
>>
>>
>> -- Thanks,
>>
>> Louis
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> <mailto:users-unsubscribe_at_jersey.dev.java.net>
>> For additional commands, e-mail:
>> users-help_at_jersey.dev.java.net
>> <mailto:users-help_at_jersey.dev.java.net>
>>
>>
>>
>>
>> -- Thanks,
>>
>> Louis
>>
>>
>>
>> --
>> Thanks,
>>
>> Louis
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>


-- 
Thanks,
Louis