You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by David Blevins <da...@visi.com> on 2009/08/14 21:43:06 UTC
Re: Eclipselink JPA RESOURCE_LOCAL PersistenceUnit with Tomcat embedded
Hi Jim,
Sorry it's taken be a bit to get back to this. I've taken a look
around and can't find anything that would cause this issue.
We load the persistence provider using the application's classloader,
in this case the webapp classloader. The NoClassDefFoundError might
be coming from a missing or misplaced jar.
Where is the jar that contains
org.eclipse.persistence.jpa.PersistenceProvider and where is the jar
that contains
org.eclipse.persistence.transaction.JTATransactionController? Seems
the issue occurs possibly because the EclipseLink PersistenceProvider
class cannot see (or sees a version from the wrong classloder) its
JTATransactionController class.
Hope this helps. I admit I'm still scratching my head :)
-David
On Jul 31, 2009, at 7:43 AM, JimOR wrote:
>
> David,
>
> I appreciate the quick response.
>
>
> David Blevins wrote:
>>
>>
>> At line Assembler.java:794 we preemptively create an
>> UndeployException
>> at the beginning of every undeploy and fill in with information and
>> only throw at the end of undeployment if issues are found. So in
>> this
>> case the snip'ed out part as the data we need. If you could post
>> that, that would be great.
>>
>>
>
> Here's the full trace:
>
>
> [2009-07-31 09:02:08.531] INFO-
> org.apache.openejb.util.Log4jLogStream.info(Line:70) - Undeploying
> app:
> C:\EclipseGalileoBase\.metadata\.plugins\org.eclipse.wst.server.core
> \tmp0\wtpwebapps\sample
> [2009-07-31 09:02:08.531]DEBUG-
> org.apache.openejb.util.Log4jLogStream.debug(Line:86) - App failing
> deployment may not have undeployed cleanly:
> C:\EclipseGalileoBase\.metadata\.plugins\org.eclipse.wst.server.core
> \tmp0\wtpwebapps\sample
> org.apache.openejb.UndeployException: Failed undeploying application:
> id=C:\EclipseGalileoBase\.metadata\.plugins
> \org.eclipse.wst.server.core\tmp0\wtpwebapps\sample
> at
> org
> .apache
> .openejb
> .assembler.classic.Assembler.destroyApplication(Assembler.java:794)
> at
> org
> .apache
> .openejb
> .assembler.classic.Assembler.createApplication(Assembler.java:654)
> at
> org
> .apache
> .openejb
> .assembler.classic.Assembler.createApplication(Assembler.java:442)
> at
> org
> .apache
> .openejb
> .tomcat.catalina.TomcatWebAppBuilder.start(TomcatWebAppBuilder.java:
> 249)
> at
> org
> .apache
> .openejb
> .tomcat
> .catalina.TomcatLoader.processRunningApplications(TomcatLoader.java:
> 224)
> at
> org
> .apache.openejb.tomcat.catalina.TomcatLoader.init(TomcatLoader.java:
> 141)
> 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 org.apache.openejb.loader.Embedder.init(Embedder.java:75)
> at org.apache.openejb.tomcat.loader.TomcatHook.hook(TomcatHook.java:
> 98)
> 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
> org
> .apache
> .openejb.tomcat.loader.TomcatEmbedder.embed(TomcatEmbedder.java:77)
> at
> org
> .apache.openejb.tomcat.loader.LoaderServlet.init(LoaderServlet.java:
> 44)
> at
> org
> .apache
> .catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
> at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:
> 993)
> at
> org
> .apache
> .catalina.core.StandardContext.loadOnStartup(StandardContext.java:
> 4149)
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:
> 4458)
> at
> org
> .apache
> .catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:
> 771)
> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:
> 526)
> at
> org
> .apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:
> 630)
> at
> org
> .apache
> .catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
> at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
> at
> org
> .apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:
> 314)
> at
> org
> .apache
> .catalina
> .util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:
> 1053)
> at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:
> 1045)
> at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> at
> org.apache.catalina.core.StandardService.start(StandardService.java:
> 516)
> at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
> 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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Nested caused by: java.lang.Exception: persistence-unit: sample
> 2136679317:
> Name "openejb/PersistenceUnit/sample 2136679317" not found.
> at
> org
> .apache
> .openejb
> .assembler.classic.Assembler.destroyApplication(Assembler.java:885)
> at
> org
> .apache
> .openejb
> .assembler.classic.Assembler.createApplication(Assembler.java:654)
> at
> org
> .apache
> .openejb
> .assembler.classic.Assembler.createApplication(Assembler.java:442)
> at
> org
> .apache
> .openejb
> .tomcat.catalina.TomcatWebAppBuilder.start(TomcatWebAppBuilder.java:
> 249)
> at
> org
> .apache
> .openejb
> .tomcat
> .catalina.TomcatLoader.processRunningApplications(TomcatLoader.java:
> 224)
> at
> org
> .apache.openejb.tomcat.catalina.TomcatLoader.init(TomcatLoader.java:
> 141)
> 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 org.apache.openejb.loader.Embedder.init(Embedder.java:75)
> at org.apache.openejb.tomcat.loader.TomcatHook.hook(TomcatHook.java:
> 98)
> 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
> org
> .apache
> .openejb.tomcat.loader.TomcatEmbedder.embed(TomcatEmbedder.java:77)
> at
> org
> .apache.openejb.tomcat.loader.LoaderServlet.init(LoaderServlet.java:
> 44)
> at
> org
> .apache
> .catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
> at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:
> 993)
> at
> org
> .apache
> .catalina.core.StandardContext.loadOnStartup(StandardContext.java:
> 4149)
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:
> 4458)
> at
> org
> .apache
> .catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:
> 771)
> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:
> 526)
> at
> org
> .apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:
> 630)
> at
> org
> .apache
> .catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
> at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
> at
> org
> .apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:
> 314)
> at
> org
> .apache
> .catalina
> .util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:
> 1053)
> at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:
> 1045)
> at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> at
> org.apache.catalina.core.StandardService.start(StandardService.java:
> 516)
> at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
> 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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Caused by: javax.naming.NameNotFoundException: Name
> "openejb/PersistenceUnit/sample 2136679317" not found.
> at
> org
> .apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:
> 198)
> at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:
> 155)
> at
> org
> .apache
> .openejb
> .assembler.classic.Assembler.destroyApplication(Assembler.java:878)
> ... 43 more
> [2009-07-31 09:02:08.546]ERROR-
> org.apache.openejb.util.Log4jLogStream.error(Line:50) - Unable to
> deploy
> collapsed ear in war /sample: Exception: Creating application failed:
> C:\EclipseGalileoBase\.metadata\.plugins\org.eclipse.wst.server.core
> \tmp0\wtpwebapps\sample:
> org/eclipse/persistence/transaction/JTATransactionController
> org.apache.openejb.OpenEJBException: Creating application failed:
> C:\EclipseGalileoBase\.metadata\.plugins\org.eclipse.wst.server.core
> \tmp0\wtpwebapps\sample:
> org/eclipse/persistence/transaction/JTATransactionController
> at
> org
> .apache
> .openejb
> .assembler.classic.Assembler.createApplication(Assembler.java:658)
> at
> org
> .apache
> .openejb
> .assembler.classic.Assembler.createApplication(Assembler.java:442)
> at
> org
> .apache
> .openejb
> .tomcat.catalina.TomcatWebAppBuilder.start(TomcatWebAppBuilder.java:
> 249)
> at
> org
> .apache
> .openejb
> .tomcat
> .catalina.TomcatLoader.processRunningApplications(TomcatLoader.java:
> 224)
> at
> org
> .apache.openejb.tomcat.catalina.TomcatLoader.init(TomcatLoader.java:
> 141)
> 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 org.apache.openejb.loader.Embedder.init(Embedder.java:75)
> at org.apache.openejb.tomcat.loader.TomcatHook.hook(TomcatHook.java:
> 98)
> 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
> org
> .apache
> .openejb.tomcat.loader.TomcatEmbedder.embed(TomcatEmbedder.java:77)
> at
> org
> .apache.openejb.tomcat.loader.LoaderServlet.init(LoaderServlet.java:
> 44)
> at
> org
> .apache
> .catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
> at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:
> 993)
> at
> org
> .apache
> .catalina.core.StandardContext.loadOnStartup(StandardContext.java:
> 4149)
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:
> 4458)
> at
> org
> .apache
> .catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:
> 771)
> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:
> 526)
> at
> org
> .apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:
> 630)
> at
> org
> .apache
> .catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
> at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
> at
> org
> .apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:
> 314)
> at
> org
> .apache
> .catalina
> .util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:
> 1053)
> at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:
> 1045)
> at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> at
> org.apache.catalina.core.StandardService.start(StandardService.java:
> 516)
> at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
> 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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Caused by: java.lang.NoClassDefFoundError:
> org/eclipse/persistence/transaction/JTATransactionController
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
> 124)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at
> org
> .apache
> .catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
> 1374)
> at
> org
> .apache
> .catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
> 1233)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:247)
> at
> org
> .eclipse
> .persistence
> .internal
> .security
> .PrivilegedAccessHelper.getClassForName(PrivilegedAccessHelper.java:
> 86)
> at
> org
> .eclipse
> .persistence
> .internal
> .jpa.EntityManagerSetupImpl.findClass(EntityManagerSetupImpl.java:540)
> at
> org
> .eclipse
> .persistence
> .internal
> .jpa
> .EntityManagerSetupImpl
> .findClassForProperty(EntityManagerSetupImpl.java:546)
> at
> org
> .eclipse
> .persistence
> .internal
> .jpa
> .EntityManagerSetupImpl
> .updateServerPlatform(EntityManagerSetupImpl.java:373)
> at
> org
> .eclipse
> .persistence
> .internal
> .jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:721)
> at
> org
> .eclipse
> .persistence
> .jpa
> .PersistenceProvider
> .createContainerEntityManagerFactory(PersistenceProvider.java:216)
> at
> org
> .apache
> .openejb
> .assembler
> .classic
> .PersistenceBuilder
> .createEntityManagerFactory(PersistenceBuilder.java:183)
> at
> org
> .apache
> .openejb
> .assembler.classic.Assembler.createApplication(Assembler.java:482)
> ... 42 more
> Caused by: java.lang.ClassNotFoundException:
> org.eclipse.persistence.transaction.JTATransactionController
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> ... 65 more
>
>
>
> David Blevins wrote:
>>
>>
>>> And the following appears after creating the EntityManagerFactory:
>>> WARNING: Found unrecognized persistence provider
>>> "org.eclipse.persistence.jpa.PersistenceProvider" in place of
>>> OpenJPA
>>> provider. This provider's properties will not be used.
>>
>> That's definitely very strange indeed. That's a very unfamiliar
>> error
>> message to me and is very out of character for us to complain that
>> you
>> are using a different JPA provider. I looked and cannot find that
>> error string anywhere in our code. I'd try adjusting your logging
>> settings so the category is printed with the message as that might
>> help us figure out where the message is coming from.
>>
>>
>
> I did some more digging, and it's coming out of OpenJPA. One of the
> 'public
> ConfigurationProvider load(...)' methods in
> persistence\PersistenceProductDerivation.java which spit the message
> before
> returning null, I guess saying "the provider you're looking for is
> not me".
> In any case createFactory() happily moves on to the next provider,
> and my
> app moves on...
>
>
> Jim
>
> --
> View this message in context: http://www.nabble.com/Eclipselink-JPA-RESOURCE_LOCAL-PersistenceUnit-with-Tomcat-embedded-tp24746512p24757624.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>
Re: Eclipselink JPA RESOURCE_LOCAL PersistenceUnit with Tomcat embedded
Posted by David Blevins <da...@visi.com>.
Thanks, Jim!
We asked another user the same time we asked you and they also
reported no luck in getting EclipseLink to work deployed under the WEB-
INF/lib.
This sounds like something a lot of people would waste a lot of time
on. At minimum we can add an EclipseLink page to our documentation
and mention this restriction.
Looking at the EclipseLink doc it seems they have a restriction about
splitting the eclipselink jar from the jar that contains the
javax.persistence libraries. Since we have that library in our javaee-
api jar which effectively gets added to Tomcat/lib that explains why
EclipseLink doesn't work in the WEB-INF/lib/ directory.
http://wiki.eclipse.org/EclipseLink/Examples/JPA/Tomcat_Web_Tutorial#EclipseLink_JAR_location
The doc doesn't explain *why* EclipseLink has such a strange
limitation. I've not heard of any other JPA provider with the same
limitation.
If you get around to asking them, definitely post a link to the
thread. My curiosity is definitely peaked.
-David
On Aug 30, 2009, at 1:30 PM, JimOR wrote:
>
> David,
>
> Apologies for the late follow-up, not sure how I missed your second
> reply
> from the 17th...
>
>
> David Blevins wrote:
>>
>> Hey Jim,
>>
>> Wonder if this might be your situation too:
>>
>>
>> http://www.nabble.com/rg.apache.openejb.OpenEJBException%3A-Unable-to-determine-the-module-type-of-tp24921373p25013439.html
>>
>> See my followup and mod the "EMFProvider" class you have and have it
>> do the getResources() check I mention there.
>>
>> That may help us narrow down your issue.
>>
>
> My getResources() call shows a single jar. But I played around with
> various
> combinations of deploying EclipseLink under WEB-INF/lib and under
> Tomcat/endorsed.
>
> The only 'clean' initialization was with the Eclipselink API and
> Impl jars
> at Tomcat's level.
>
> I put clean in quotes because there seems to be a Log4j classloading
> issue.
> (I have 1.2.15 deployed to Tomcat, openejb webapp lib has 1.2.12) I
> seem to
> recall a Tomcat classloader configuration adjustment that might
> address
> this, and everybody(webapp, Eclipselink, OpenEJB) happily logs, but
> here's
> what got spit out:
>
> [2009-08-30 12:54:00.812] INFO-
> org.apache.openejb.util.Log4jLogStream.info(Line:70) - Assembling app:
> C:\EclipseGalileoBase\.metadata\.plugins\org.eclipse.wst.server.core
> \tmp0\wtpwebapps\sample
> [2009-08-30 12:54:00.828] INFO-
> org.apache.openejb.util.Log4jLogStream.info(Line:70) -
> PersistenceUnit(name=sample,
> provider=org.eclipse.persistence.jpa.PersistenceProvider)
> log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not
> assignable to a "org.apache.log4j.spi.Configurator" variable.
> log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded
> by
> log4j:ERROR [org.apache.openejb.core.TempClassLoader@11498ba]
> whereas object
> of type
> log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by
> [null].
> log4j:ERROR Could not instantiate configurator
> [org.apache.log4j.xml.DOMConfigurator].
> [2009-08-30 12:54:01.484] INFO-
> org.apache.openejb.util.Log4jLogStream.info(Line:70) - Deployed
> Application(path=C:\EclipseGalileoBase\.metadata\.plugins
> \org.eclipse.wst.server.core\tmp0\wtpwebapps\sample)
>
> Also, it seems that I must supply a <non-jta-data-source>. Running
> stand-alone, I can provide persistence.xml <properties> or a map
> passed to
> createEntityManagerFactory() for JDBC connection information, but
> trying
> that with OpenEJB embedded, I get:
>
> SEVERE:
> java.lang.UnsupportedOperationException: Not supported by
> BasicDataSource
> at
> org
> .apache
> .commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:902)
> at
> org
> .eclipse
> .persistence.sessions.JNDIConnector.connect(JNDIConnector.java:135)
> at
> org
> .eclipse
> .persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
> at
> org
> .eclipse
> .persistence
> .sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:
> 162)
> at
> org
> .eclipse
> .persistence
> .internal
> .sessions
> .DatabaseSessionImpl
> .loginAndDetectDatasource(DatabaseSessionImpl.java:583)
> at
> org
> .eclipse
> .persistence
> .internal
> .jpa
> .EntityManagerFactoryProvider
> .login(EntityManagerFactoryProvider.java:227)
> at
> org
> .eclipse
> .persistence
> .internal
> .jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:255)
> at
> org
> .eclipse
> .persistence
> .internal
> .jpa
> .EntityManagerFactoryImpl
> .getServerSession(EntityManagerFactoryImpl.java:111)
> at
> org
> .eclipse
> .persistence
> .internal
> .jpa
> .EntityManagerFactoryImpl
> .createEntityManagerImpl(EntityManagerFactoryImpl.java:163)
> at
> org
> .eclipse
> .persistence
> .internal
> .jpa
> .EntityManagerFactoryImpl
> .createEntityManager(EntityManagerFactoryImpl.java:150)
> at pool.data.dao.impl.EMFProvider.getEM(EMFProvider.java:31)
> ...
>
> Adding a <non-jta-data-source> element and resources to my Tomcat's
> openejb.conf corrected that.
>
>
> David Blevins wrote:
>>
>>
>> On a side note, that EMFProvider would make one great Singleton bean:
>>
>> import javax.ejb.Lock;
>> import static javax.ejb.LockType.READ;
>> import javax.ejb.Singleton;
>> import javax.persistence.EntityManager;
>> import javax.persistence.EntityManagerFactory;
>> import javax.persistence.PersistenceUnit;
>>
>>
>> @Singleton
>> @Lock(READ)
>> public class EMFProvider {
>>
>> @PersistenceUnit(unitName = "daosample")
>> private EntityManagerFactory emf;
>>
>> public EntityManager getEM() {
>> return getEMFactory().createEntityManager();
>> }
>>
>> public EntityManagerFactory getEMFactory() {
>> return emf;
>> }
>> }
>>
>> The result is an bean which is scoped at the app level just as if it
>> was a static. It's more thread safe -- the previous getEMFactory()
>> code could result in many EntityManagerFactory instances being
>> created. You also no longer need to actively clean up the
>> EntityManagerFactory as the container will do that for you.
>>
>>
>
> You're right.
>
>
> --
> View this message in context: http://www.nabble.com/Eclipselink-JPA-RESOURCE_LOCAL-PersistenceUnit-with-Tomcat-embedded-tp24746512p25215458.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>
Re: Eclipselink JPA RESOURCE_LOCAL PersistenceUnit with Tomcat
embedded
Posted by JimOR <ji...@zoominternet.net>.
David,
Apologies for the late follow-up, not sure how I missed your second reply
from the 17th...
David Blevins wrote:
>
> Hey Jim,
>
> Wonder if this might be your situation too:
>
>
> http://www.nabble.com/rg.apache.openejb.OpenEJBException%3A-Unable-to-determine-the-module-type-of-tp24921373p25013439.html
>
> See my followup and mod the "EMFProvider" class you have and have it
> do the getResources() check I mention there.
>
> That may help us narrow down your issue.
>
My getResources() call shows a single jar. But I played around with various
combinations of deploying EclipseLink under WEB-INF/lib and under
Tomcat/endorsed.
The only 'clean' initialization was with the Eclipselink API and Impl jars
at Tomcat's level.
I put clean in quotes because there seems to be a Log4j classloading issue.
(I have 1.2.15 deployed to Tomcat, openejb webapp lib has 1.2.12) I seem to
recall a Tomcat classloader configuration adjustment that might address
this, and everybody(webapp, Eclipselink, OpenEJB) happily logs, but here's
what got spit out:
[2009-08-30 12:54:00.812] INFO-
org.apache.openejb.util.Log4jLogStream.info(Line:70) - Assembling app:
C:\EclipseGalileoBase\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\sample
[2009-08-30 12:54:00.828] INFO-
org.apache.openejb.util.Log4jLogStream.info(Line:70) -
PersistenceUnit(name=sample,
provider=org.eclipse.persistence.jpa.PersistenceProvider)
log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not
assignable to a "org.apache.log4j.spi.Configurator" variable.
log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by
log4j:ERROR [org.apache.openejb.core.TempClassLoader@11498ba] whereas object
of type
log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by [null].
log4j:ERROR Could not instantiate configurator
[org.apache.log4j.xml.DOMConfigurator].
[2009-08-30 12:54:01.484] INFO-
org.apache.openejb.util.Log4jLogStream.info(Line:70) - Deployed
Application(path=C:\EclipseGalileoBase\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\sample)
Also, it seems that I must supply a <non-jta-data-source>. Running
stand-alone, I can provide persistence.xml <properties> or a map passed to
createEntityManagerFactory() for JDBC connection information, but trying
that with OpenEJB embedded, I get:
SEVERE:
java.lang.UnsupportedOperationException: Not supported by BasicDataSource
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:902)
at
org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:135)
at
org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
at
org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:583)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:227)
at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:255)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:111)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:163)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:150)
at pool.data.dao.impl.EMFProvider.getEM(EMFProvider.java:31)
...
Adding a <non-jta-data-source> element and resources to my Tomcat's
openejb.conf corrected that.
David Blevins wrote:
>
>
> On a side note, that EMFProvider would make one great Singleton bean:
>
> import javax.ejb.Lock;
> import static javax.ejb.LockType.READ;
> import javax.ejb.Singleton;
> import javax.persistence.EntityManager;
> import javax.persistence.EntityManagerFactory;
> import javax.persistence.PersistenceUnit;
>
>
> @Singleton
> @Lock(READ)
> public class EMFProvider {
>
> @PersistenceUnit(unitName = "daosample")
> private EntityManagerFactory emf;
>
> public EntityManager getEM() {
> return getEMFactory().createEntityManager();
> }
>
> public EntityManagerFactory getEMFactory() {
> return emf;
> }
> }
>
> The result is an bean which is scoped at the app level just as if it
> was a static. It's more thread safe -- the previous getEMFactory()
> code could result in many EntityManagerFactory instances being
> created. You also no longer need to actively clean up the
> EntityManagerFactory as the container will do that for you.
>
>
You're right.
--
View this message in context: http://www.nabble.com/Eclipselink-JPA-RESOURCE_LOCAL-PersistenceUnit-with-Tomcat-embedded-tp24746512p25215458.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: Eclipselink JPA RESOURCE_LOCAL PersistenceUnit with Tomcat embedded
Posted by David Blevins <da...@visi.com>.
On Aug 17, 2009, at 10:43 AM, David Blevins wrote:
> I tried the latest EclipseLink version with our jpa-eclipselink
> example to see if maybe they updated their JTATransactionManager
> class in a way that is incompatible with prior versions. All ran
> fine there, so we can rule that out:
>
[..]
>
> INFO - Deployed Application(path=classpath.ear)
> [EL Info]: 2009-08-17 10:29:36.045--ServerSession(1631558)--
> EclipseLink, version: Eclipse Persistence Services - 1.1.2.v20090612-
> r4475
> [EL Info]: 2009-08-17 10:29:36.38--ServerSession(1631558)--file:/
> Users/dblevins/work/openejb3/examples/jpa-eclipselink/target/
> classes/-movie-unit login successful
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
> 2.833 sec
Hey Jim,
Wonder if this might be your situation too:
http://www.nabble.com/rg.apache.openejb.OpenEJBException%3A-Unable-to-determine-the-module-type-of-tp24921373p25013439.html
See my followup and mod the "EMFProvider" class you have and have it
do the getResources() check I mention there.
That may help us narrow down your issue.
On a side note, that EMFProvider would make one great Singleton bean:
import javax.ejb.Lock;
import static javax.ejb.LockType.READ;
import javax.ejb.Singleton;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
@Singleton
@Lock(READ)
public class EMFProvider {
@PersistenceUnit(unitName = "daosample")
private EntityManagerFactory emf;
public EntityManager getEM() {
return getEMFactory().createEntityManager();
}
public EntityManagerFactory getEMFactory() {
return emf;
}
}
The result is an bean which is scoped at the app level just as if it
was a static. It's more thread safe -- the previous getEMFactory()
code could result in many EntityManagerFactory instances being
created. You also no longer need to actively clean up the
EntityManagerFactory as the container will do that for you.
That said, I'd get the classloading issues sorted out before
proceeding -- if things don't work now with the java se
"Persistence.createEntityManagerFactory" approach, they won't work
when OpenEJB attempts to make the same call.
-David
Re: Eclipselink JPA RESOURCE_LOCAL PersistenceUnit with Tomcat embedded
Posted by David Blevins <da...@visi.com>.
On Aug 16, 2009, at 12:25 PM, JimOR wrote:
>
> David,
>
>
> David Blevins wrote:
>>
>> Sorry it's taken be a bit to get back to this.
>>
>
> Not a show stopper, still LOVE OpenEJB, and I appreciate your
> looking into
> it at all. I'm as much wondering whether I'm breaking any rules
> deploying
> an 'SE app' to an 'EE server', and can easily EJB-ify my DAOs if/
> when I need
> to.
>
>
> David Blevins wrote:
>>
>> Where is the jar that contains
>> org.eclipse.persistence.jpa.PersistenceProvider and where is the jar
>> that contains
>> org.eclipse.persistence.transaction.JTATransactionController?
>>
>
> I tried two packaging 'flavors'. The First stab was the Galileo
> 'standard
> wizard' which deploys 4 jars, one of which is the JPA API. So after
> deploying normally I deleted the deployed API jar and started the
> server. In
> this scenario both of those classes are in a jar named
> org.eclipse.persistence.core_1.1.2.v20090612-r4475.jar
>
> Second stab was to download and unzip the 'single jar packaging' from
> http://www.eclipse.org/eclipselink/downloads/ Same result, and
> again both
> classes do exist in the eclipselink.jar that lives under the
> eclipselink/jlib folder.
>
>
>
> David Blevins wrote:
>>
>> Seems the issue occurs possibly because the EclipseLink
>> PersistenceProvider class cannot see (or sees a version from the
>> wrong
>> classloder) its JTATransactionController class.
>>
>
> Can't say I completely understand how all the pieces fit together.
> My war
> has a resource_local persistence-unit with the DAOs using
> EntityTransactions. And aside from the initial exception in the
> openejb.log, run flawlessly. Is the JTATransactionController class
> load an
> OpenEJB boostrap requirement?
>
> Here's a sample war with the eclipselink.jar if you'd like to look
> into it
> further...
> http://www.nabble.com/file/p24996863/daosample.war daosample.war
The JTATransactionController is a class loaded by EclipseLink, so we
don't have any control on when/how it is loaded. We have a subclass
of JTATransactionController which allows EclipseLink to find the
OpenEJB TransactionManager impl, but that's the full extent of our
EclipseLink awareness.
I tried the latest EclipseLink version with our jpa-eclipselink
example to see if maybe they updated their JTATransactionManager class
in a way that is incompatible with prior versions. All ran fine
there, so we can rule that out:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.superbiz.eclipselink.MoviesTest
Apache OpenEJB 3.1.1 build: 20090530-06:18
http://openejb.apache.org/
INFO - openejb.home = /Users/dblevins/work/openejb3/examples/jpa-
eclipselink
INFO - openejb.base = /Users/dblevins/work/openejb3/examples/jpa-
eclipselink
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=movieDatabaseUnmanaged, type=Resource,
provider-id=Default JDBC Database)
INFO - Configuring Service(id=movieDatabase, type=Resource, provider-
id=Default JDBC Database)
INFO - Found EjbModule in classpath: /Users/dblevins/work/openejb3/
examples/jpa-eclipselink/target/classes
INFO - Beginning load: /Users/dblevins/work/openejb3/examples/jpa-
eclipselink/target/classes
INFO - Configuring enterprise application: classpath.ear
INFO - Configuring Service(id=Default Stateful Container,
type=Container, provider-id=Default Stateful Container)
INFO - Auto-creating a container for bean Movies:
Container(type=STATEFUL, id=Default Stateful Container)
INFO - Configuring PersistenceUnit(name=movie-unit,
provider=org.eclipse.persistence.jpa.PersistenceProvider)
INFO - Enterprise application "classpath.ear" loaded.
INFO - Assembling app: classpath.ear
INFO - PersistenceUnit(name=movie-unit,
provider=org.eclipse.persistence.jpa.PersistenceProvider)
ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider
requested installation of a ClassFileTransformer which requires a
JavaAgent. See http://openejb.apache.org/3.0/javaagent.html
INFO - Jndi(name=MoviesLocal) --> Ejb(deployment-id=Movies)
INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies,
container=Default Stateful Container)
INFO - Deployed Application(path=classpath.ear)
[EL Info]: 2009-08-17 10:29:36.045--ServerSession(1631558)--
EclipseLink, version: Eclipse Persistence Services - 1.1.2.v20090612-
r4475
[EL Info]: 2009-08-17 10:29:36.38--ServerSession(1631558)--file:/Users/
dblevins/work/openejb3/examples/jpa-eclipselink/target/classes/-movie-
unit login successful
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.833
sec
Will have a look at the war file.
-David
Re: Eclipselink JPA RESOURCE_LOCAL PersistenceUnit with Tomcat
embedded
Posted by JimOR <ji...@zoominternet.net>.
David,
David Blevins wrote:
>
> Sorry it's taken be a bit to get back to this.
>
Not a show stopper, still LOVE OpenEJB, and I appreciate your looking into
it at all. I'm as much wondering whether I'm breaking any rules deploying
an 'SE app' to an 'EE server', and can easily EJB-ify my DAOs if/when I need
to.
David Blevins wrote:
>
> Where is the jar that contains
> org.eclipse.persistence.jpa.PersistenceProvider and where is the jar
> that contains
> org.eclipse.persistence.transaction.JTATransactionController?
>
I tried two packaging 'flavors'. The First stab was the Galileo 'standard
wizard' which deploys 4 jars, one of which is the JPA API. So after
deploying normally I deleted the deployed API jar and started the server. In
this scenario both of those classes are in a jar named
org.eclipse.persistence.core_1.1.2.v20090612-r4475.jar
Second stab was to download and unzip the 'single jar packaging' from
http://www.eclipse.org/eclipselink/downloads/ Same result, and again both
classes do exist in the eclipselink.jar that lives under the
eclipselink/jlib folder.
David Blevins wrote:
>
> Seems the issue occurs possibly because the EclipseLink
> PersistenceProvider class cannot see (or sees a version from the wrong
> classloder) its JTATransactionController class.
>
Can't say I completely understand how all the pieces fit together. My war
has a resource_local persistence-unit with the DAOs using
EntityTransactions. And aside from the initial exception in the
openejb.log, run flawlessly. Is the JTATransactionController class load an
OpenEJB boostrap requirement?
Here's a sample war with the eclipselink.jar if you'd like to look into it
further...
http://www.nabble.com/file/p24996863/daosample.war daosample.war
Thanks,
Jim
--
View this message in context: http://www.nabble.com/Eclipselink-JPA-RESOURCE_LOCAL-PersistenceUnit-with-Tomcat-embedded-tp24746512p24996863.html
Sent from the OpenEJB User mailing list archive at Nabble.com.