Tuesday, August 30, 2011

Re: No persistence providers in GWT/OpenJPA service

I have in the war file a persistence.xml and don't have problems.

2011/8/30 randal cobb <rcobb1@gmail.com>
Yes, I've looked at that thread in several google searches.  I think my issue is that I'm using the jar possibly incorrectly in the GWT application.  There IS a persistence.xml file with "svntools-data" defined in it, but it's packaged in the jar file with the OpenJPA entities and DAO components; not as loose objects in the GWT War project.  Here's my persistence.xml file that, again, is packaged in the jar file; and again, it (the openjpa jar) does work as expected in other projects not using GWT... I have an old JSP based utility that is using it which I'm trying to modernize with GWT, so the OpenJPA jar has been working for a couple of months.  Here's the relevant portion of my persistence.xml with the <provider> section as indicated in your suggested thread. 

<persistence-unit name="svntools-data"

transaction-type="RESOURCE_LOCAL">

<provider>

org.apache.openjpa.persistence.PersistenceProviderImpl

</provider>

<class>com.adp.mas.svntools.server.data.Defaults</class>

<class>com.adp.mas.svntools.server.data.Repositories</class>

<class>com.adp.mas.svntools.server.data.Excludes</class>

<class>com.adp.mas.svntools.server.data.MergeFolders</class>

<class>com.adp.mas.svntools.server.data.SystemCrontab</class>

<properties>

<property name="openjpa.ConnectionDriverName"

value="org.hsqldb.jdbc.JDBCDriver" />

<property name="openjpa.ConnectionURL"

value="jdbc:hsqldb:hsql://localhost/svntoolsdb" />

<property name="openjpa.ConnectionUserName" value="SA" />

<property name="openjpa.jdbc.DBDictionary"

value="hsql(SimulateLocking=true,SchemaCase=upper)" />

<property name="openjpa.jdbc.SynchronizedMappings"

value="buildSchema(ForeignKeys=true)" />

<property name="openjpa.Log"

value="DefaultLevel=WARN, Tool=INFO, SQL=TRACE" />

<property name="openjpa.RuntimeUnenhancedClasses"

value="supported" />

</properties>

</persistence-unit>


I think my issue is more that the GWT war can't find the jar'ed persistence.xml file.


On Tue, Aug 30, 2011 at 10:52 AM, Juan Pablo Gardella <gardellajuanpablo@gmail.com> wrote:
This is not related to GWT, you don't define a persistence provider with the name svntools-data. Check this post to see similar problem, but with Hibernate.

2011/8/30 MadOtis <rcobb1@gmail.com>
Hello all,

I'm running into a little bit of a problem.  I'm trying to use some
jar packaged OpenJPA entities in a GWT servelet service but I keep
getting a persistence exception.  The OpenJPA entities are, again,
packaged in a separate jar file and are provided by a different
project (they all work great in other projects).  Within the service,
I'm converting the OpenJPA entities into DTO objects, so I'm not
trying to pass actual connected JPA entities from the service back to
the client side of the house.  I do have other services that do not
use OpenJPA that work as expected; it's just the handful of services
that are using the DAO/Entities from the jar.  The war will not be
hosted in App Engine (rather a stand-alone war on Tomcat or some more
robust JEE container ), so I believe having to do a one-off version of
this jar for datanucleus shouldn't be needed (I hope).

I've tried extracting the persistence.xml file from the jar and hand-
placing it in the respective locations in the war project, but it
seems to not make any difference.  Here's the relevant portion of the
stacktrace I get when the services try to fire (which tells me the
OpenJPA Entity Manager can't find the provider from persistence.xml):

       at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
395)
       at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:488)
Caused by: java.lang.ExceptionInInitializerError
       at
com.adp.mas.svntools.server.data.DefaultsDAO.findAll(DefaultsDAO.java:
193)
       at
com.adp.mas.svntools.server.SVNMergeServiceImpl.getDefaults(SVNMergeServiceImpl.java:
18)
       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:597)
       at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
569)
       ... 22 more
Caused by: javax.persistence.PersistenceException: No persistence
providers available for "svntools-data" after trying the following
discovered implementations: NONE
       at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:
182)
       at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:
72)
       at
com.adp.mas.svntools.server.data.EntityManagerHelper.<clinit>(EntityManagerHelper.java:
20)

Can anyone point me to any sort of documentation or example on how to
properly utilize an OpenJPA jar in a GWT War?

Thanks in advance!
Randy

--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment