• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javax.persistence.PersistenceException: No Persistence provider for EntityManager

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I made a site with jsp's and servlets. Using a model which was saved using arraylists.
Than I persisted this model, using a Main class I tested all the methods I created.
Now I need to use this persisted model in my site.
But,
I seemed to have forgotten some of the links or made some wrongs one.
Because whenever I go to the any second page of my site and the servlet gets a request, it crashes.
This is because it try's getInstance() of my db which creates an entitymaneger.
It crashes on this line:
emf = Persistence.createEntityManagerFactory("BackPackPersistencyModelPU");
This is the full error:


This is my persistence.xml:



Do I have to put my xml somewhere in the web project? I tried various places.
Right now I simple have the jar of the model in my library of the web project.
I have put my entire project in dropbox just in case I didn't include enough information,
this is the public link: http://dl.dropbox.com/u/16098795/BackPackManagerPersisted.war

Any help is GREATLY appreciated!
Thanks in advance!
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somewhere you need to make the EntityManagerFactory and subsequent EntityManager available within the web context.
eg http://javanotepad.blogspot.com/2007/05/jpa-entitymanagerfactory-in-web.html
(I haven't read all of that article, I hope it says everything I want it to ;) )
 
Tim Sangster
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David O'Meara wrote:Somewhere you need to make the EntityManagerFactory and subsequent EntityManager available within the web context.
eg http://javanotepad.blogspot.com/2007/05/jpa-entitymanagerfactory-in-web.html
(I haven't read all of that article, I hope it says everything I want it to ;) )


I'm trying to implement this but I create my entity manager in my model and the contextlistener needs to be in the web project.
I don't really get how to link those two.
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of Glassfish are you using? The latest version using EclipseLink not TopLink Essentials.

Try removing the <provider> tag, you may not have TopLink Essentials on the classpath.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



       


        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:84)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at persistencia.OdontologoJpaController.<init>(OdontologoJpaController.java:27)
at persistencia.ControladoraPersistencia.<init>(ControladoraPersistencia.java:22)
at logica.Controladora.<init>(Controladora.java:13)
at servlets.ServletUsuario.doPost(ServletUsuario.java:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)


tengo estos problemas cuando corro mi java web
 
reply
    Bookmark Topic Watch Topic
  • New Topic