GWT with JPA - no persistence provider

344 views
Skip to first unread message

maliniak

unread,
May 13, 2010, 8:25:08 AM5/13/10
to Google Web Toolkit
GWT with JPA

There are two projects in my eclipse workspace, let's name them:

-JPAProject
-GWTProject

JPAProject contains JPA configuration stuff (persistence.xml, entity
classes and so on). GWTProject is an examplary GWT project (taken from
official GWT tutorial).

Both projects work fine alone. That is, I can create EMF
(EntityManagerFactory) in JPAProject and get entities from the
database. GWTProject works fine too, I can run it, fill the field text
in the browser and get the response.

My goal is to call JPAProject from GWTProject to get entities. But the
problem is that when calling DAO, I get the following exception:

-----------------------------------------------------------------------------------------------------------------------------
[WARN] Server class
'com.emergit.service.dao.profile.ProfileDaoService' could not be found
in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/home/maliniak/workspace/
emergit/build/classes/' to the web app classpath for this session
For additional info see: file:/home/maliniak/.eclipse/
org.eclipse.platform_3.5.0_155965261/plugins/
com.google.gwt.eclipse.sdkbundle.2.0.3_2.0.3.v201002191036/gwt-2.0.3/
doc/helpInfo/webAppClassPath.html
[WARN] Server class 'javax.persistence.Persistence' could not be found
in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/home/maliniak/workspace/
libraries/EclipseLink%202.0.2/eclipselink/jlib/jpa/
javax.persistence_2.0.0.v201002051058.jar' to the web app classpath
for this session
For additional info see: file:/home/maliniak/.eclipse/
org.eclipse.platform_3.5.0_155965261/plugins/
com.google.gwt.eclipse.sdkbundle.2.0.3_2.0.3.v201002191036/gwt-2.0.3/
doc/helpInfo/webAppClassPath.html
[WARN] /gwttest/greet
javax.persistence.PersistenceException: No Persistence provider for
EntityManager named emergitPU
at javax.persistence.Persistence.createEntityManagerFactory(Unknown
Source)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown
Source)
at
com.emergit.service.dao.profile.JpaProfileDaoService.<init>(JpaProfileDaoService.java:
19)
at
pl.maliniak.server.GreetingServiceImpl.<init>(GreetingServiceImpl.java:
21)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at
org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:
339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
463)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
362)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at
org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:
49)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
505)
at org.mortbay.jetty.HttpConnection
$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
395)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:488)
[ERROR] 500 - POST /gwttest/greet (127.0.0.1) 3812 bytes
Request headers
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:
1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://127.0.0.1:8888/gwttest/hosted.html?gwttest
X-GWT-Permutation: HostedMode
X-GWT-Module-Base: http://127.0.0.1:8888/gwttest/
Content-Type: text/x-gwt-rpc; charset=utf-8
Content-Length: 168
Pragma: no-cache
Cache-Control: no-cache
Response headers
Content-Type: text/html; charset=iso-8859-1
Content-Length: 3812
-----------------------------------------------------------------------------------------------------------------------------

I guess that the warnings at the beginning can be omitted for now.

Do you have any ideas? I guess I am missing some basic point. All
hints are highly apprecieable.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Message has been deleted

Anton

unread,
May 26, 2010, 4:34:21 PM5/26/10
to Google-We...@googlegroups.com
Just copy your JPA-Jars to "war/WEB-INF/lib"-directory and add them to the build
path.

Stefan Bachert

unread,
May 27, 2010, 1:32:19 PM5/27/10
to Google Web Toolkit
Hi,

go to the warnings (e.g. panel Markers), use "Quick Fix", then you can
choose to include your jpa-project into WEB-INF/lib

Stefan Bachert
http://gwtworld.de

Reply all
Reply to author
Forward
0 new messages