Tuesday, August 30, 2011

Re: No persistence providers in GWT/OpenJPA service

In dev mode run in jetty, perhaps need some runtime lib.

2011/8/30 MadOtis <rcobb1@gmail.com>
ok, running it in SERVER mode allows it to run as expected, so it
seems that in DEV mode is when it can't find the persistence.xml.

On Aug 30, 12:02 pm, MadOtis <rco...@gmail.com> wrote:
> No, I haven't tried running it in server mode yet; I was testing
> locally in dev mode.  But, I'll try running the war directly in Tomcat
> and see what happens; thank you for the suggestion.
>
> On Aug 30, 11:54 am, Juan Pablo Gardella <gardellajuanpa...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > GWT war should be able to use them from their packaged JAR directly. Is a
> > war. GWT transform in plain javascript.  Do you check the war generated in a
> > tomcat for example? Running in server mode, no devmode.
>
> > 2011/8/30 MadOtis <rco...@gmail.com>
>
> > > I took a look at your project structure, you've got your DAO
> > > components packaged in your WAR.  Mine are in a dependent JAR, not the
> > > WAR itself.  My jar file is pulled in via a maven dependency as
> > > follows:
> > >    <dependency>
> > >        <groupId>svntools</groupId>
> > >        <artifactId>svntools-data</artifactId>
> > >        <version>1.2.1</version>
> > >    </dependency>
> > > And my persistence.xml IS in the dependent jar.  I've tried extracting
> > > the persistence.xml out of the jar and putting it in the normal
> > > location (/srv/main/resources/META-INF) and it DOES get packaged in
> > > the WAR, but it still doesn't seem to make a difference to the GWT
> > > War; I get the same exception when calling one of the services that
> > > use it.
> > > Should my next step be to copy all the source for the DAOs and
> > > repackage it directly in my WAR?  ...or should the GWT war be able to
> > > use them from their packaged JAR directly?
>
> > > On Aug 30, 11:22 am, Juan Pablo Gardella <gardellajuanpa...@gmail.com>
> > > wrote:
> > > > I have in the war
> > > > file<
> > >https://bitbucket.org/gardellajuanpablo/gwt-sample/src/8aba86d82778/s...>a
> > > > persistence.xml and don't have problems.
>
> > > > 2011/8/30 randal cobb <rco...@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 <
> > > > > gardellajuanpa...@gmail.com> wrote:
>
> > > > >> This is not related to GWT, you don't define a persistence provider
> > > with
> > > > >> the name *svntools-data. *Check this post
> > > > >> <
> > >http://stackoverflow.com/questions/1158159/no-persistence-provider-fo..
> > > .>to
> > > > >> see similar problem, but with Hibernate.
>
> > > > >> 2011/8/30 MadOtis <rco...@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(SVNMergeService
> > > Impl.java:
> > > > >>> 18)
> > > > >>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > >>>        at
>
> > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > > >>> 39)
> > > > >>>        at
>
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> > > l.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>(EntityManager
> > > Helper.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.

--
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