0.5.2 has a dependency on eclipselink #2

Closed
balapal opened this Issue Feb 13, 2015 · 6 comments

Projects

None yet

3 participants

@balapal
balapal commented Feb 13, 2015

I get the below error message when using tapestry-model 0.5.2 (don't get it with 0.5.1)

20150213 21:33:24.331 [localhost-startStop-1] ERROR org.apache.tapestry5.ioc.Registry - org/eclipse/persistence/descriptors/DescriptorEventListener
20150213 21:33:24.331 [localhost-startStop-1] ERROR org.apache.tapestry5.ioc.Registry - Operations trace:
20150213 21:33:24.331 [localhost-startStop-1] ERROR org.apache.tapestry5.ioc.Registry - [ 1] Invoking startup method org.tynamo.model.jpa.services.TynamoJpaModule.addJpaEventListener(ElasticSearchIndexMaintainer).
20150213 21:33:24.331 [localhost-startStop-1] ERROR org.apache.tapestry5.ioc.Registry - [ 2] Resolving object of type org.tynamo.model.jpa.internal.ElasticSearchIndexMaintainer using MasterObjectProvider
20150213 21:33:24.331 [localhost-startStop-1] ERROR org.apache.tapestry5.ioc.Registry - [ 3] Autobuilding instance of org.tynamo.model.jpa.internal.ElasticSearchIndexMaintainer
20150213 21:33:24.331 [localhost-startStop-1] ERROR o.a.c.c.C.[.[localhost].[/Foodie] - Exception starting filter Foodie
java.lang.NoClassDefFoundError: org/eclipse/persistence/descriptors/DescriptorEventListener
at java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:1.7.0_45]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493) ~[na:1.7.0_45]
at java.lang.Class.getConstructors(Class.java:1517) ~[na:1.7.0_45]
at org.apache.tapestry5.ioc.internal.util.InternalUtils.findAutobuildConstructor(InternalUtils.java:562) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl.autobuild(RegistryImpl.java:1166) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl$13.invoke(RegistryImpl.java:1157) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:82) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:72) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1258) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl.autobuild(RegistryImpl.java:1152) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.services.AutobuildObjectProvider.provide(AutobuildObjectProvider.java:35) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl$1.invoke(MasterObjectProviderImpl.java:54) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:82) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:72) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1258) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl.provide(MasterObjectProviderImpl.java:46) ~[tapestry-ioc-5.4-beta-28.jar:na]
at $MasterObjectProvider_4d07f50c9ed5.provide(Unknown Source) ~[na:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:990) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:1098) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.util.InternalUtils$3.createObject(InternalUtils.java:217) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.util.InternalUtils$26.map(InternalUtils.java:1590) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.util.InternalUtils$26.map(InternalUtils.java:1586) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.func.LazyMappedValue.get(LazyMappedValue.java:32) ~[tapestry-func-5.4-beta-28.jar:na]
at org.apache.tapestry5.func.LazyFlow.first(LazyFlow.java:53) ~[tapestry-func-5.4-beta-28.jar:na]
at org.apache.tapestry5.func.AbstractFlow$1.next(AbstractFlow.java:65) ~[tapestry-func-5.4-beta-28.jar:na]
at org.apache.tapestry5.func.AbstractFlow.toMutableList(AbstractFlow.java:41) ~[tapestry-func-5.4-beta-28.jar:na]
at org.apache.tapestry5.func.AbstractFlow.toMutableList(AbstractFlow.java:34) ~[tapestry-func-5.4-beta-28.jar:na]
at org.apache.tapestry5.func.AbstractFlow.toArray(AbstractFlow.java:227) ~[tapestry-func-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.util.InternalUtils.realizeObjects(InternalUtils.java:1599) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.StartupDefImpl$1.run(StartupDefImpl.java:70) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:56) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:60) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl.run(RegistryImpl.java:1252) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.StartupDefImpl.invoke(StartupDefImpl.java:48) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl$2.run(RegistryImpl.java:229) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl.performRegistryStartup(RegistryImpl.java:360) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryWrapper.performRegistryStartup(RegistryWrapper.java:89) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:112) ~[tapestry-core-5.4-beta-28.jar:na]
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281) ~[catalina.jar:7.0.47]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262) ~[catalina.jar:7.0.47]
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:107) ~[catalina.jar:7.0.47]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775) [catalina.jar:7.0.47]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452) [catalina.jar:7.0.47]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.47]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [catalina.jar:7.0.47]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [catalina.jar:7.0.47]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
Caused by: java.lang.ClassNotFoundException: org.eclipse.persistence.descriptors.DescriptorEventListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702) ~[catalina.jar:7.0.47]
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) ~[catalina.jar:7.0.47]
... 50 common frames omitted

Looking at the code level it looks like 0.5.2 introduced a dependency on eclipselink, but it is not reflected on the pom.xml level.
Or maybe it was not intentional to introduce a dependency on eclipselink.

@kaosko
Member
kaosko commented Feb 13, 2015

ElasticSearchIndexMaintainer was there already in 0.5.1 but I have to check the diffs to see what's changed. So you are using JPA but Hibernate as your persistence provider? The complication is that the spec doesn't provide a generic way to listen to persistence events (outside of CDI but that in turn doesn't allow dependency injection of non-CDI entities which we would require). Not sure at the moment what the best remedy is.

@balapal
balapal commented Feb 13, 2015

Actually I do get the same problem with 0.5.1 as well.
I am using tapestry 5.4-beta-28 with tapestry-jpa with hibernate as JPA implementation.
I am trying to use tapestry-model-jpa, but I am a bit confused why it is dependent on eclipselink. Shouldn't it be JPA implementation agnostic?

I also tried tapestry-model-hibernate, but getting this error:

20150213 22:55:01.087 [localhost-startStop-1] ERROR org.apache.tapestry5.ioc.Registry - java.lang.NoClassDefFoundError: org/hibernate/service/jndi/JndiNameException
20150213 22:55:01.087 [localhost-startStop-1] ERROR org.apache.tapestry5.ioc.Registry - Operations trace:
20150213 22:55:01.087 [localhost-startStop-1] ERROR org.apache.tapestry5.ioc.Registry - [ 1] Invoking startup method org.apache.tapestry5.jpa.modules.JpaModule.startupEarly(EntityManagerManager, boolean).
20150213 22:55:01.101 [localhost-startStop-1] ERROR o.a.c.c.C.[.[localhost].[/Foodie] - Exception starting filter Foodie
org.apache.tapestry5.ioc.internal.OperationException: java.lang.NoClassDefFoundError: org/hibernate/service/jndi/JndiNameException
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:184) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:62) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:60) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl.run(RegistryImpl.java:1252) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.StartupDefImpl.invoke(StartupDefImpl.java:48) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl$2.run(RegistryImpl.java:229) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryImpl.performRegistryStartup(RegistryImpl.java:360) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.RegistryWrapper.performRegistryStartup(RegistryWrapper.java:89) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:112) ~[tapestry-core-5.4-beta-28.jar:na]
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281) ~[catalina.jar:7.0.47]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262) ~[catalina.jar:7.0.47]
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:107) ~[catalina.jar:7.0.47]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775) [catalina.jar:7.0.47]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452) [catalina.jar:7.0.47]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.47]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [catalina.jar:7.0.47]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [catalina.jar:7.0.47]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/hibernate/service/jndi/JndiNameException
at org.apache.tapestry5.ioc.internal.StartupDefImpl$1.run(StartupDefImpl.java:84) ~[tapestry-ioc-5.4-beta-28.jar:na]
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:56) ~[tapestry-ioc-5.4-beta-28.jar:na]
... 19 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/hibernate/service/jndi/JndiNameException
at java.lang.Class.forName0(Native Method) ~[na:1.7.0_45]
at java.lang.Class.forName(Class.java:270) ~[na:1.7.0_45]
at org.jboss.logging.Logger$1.run(Logger.java:2252) ~[jboss-logging-3.1.3.GA.jar:3.1.3.GA]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_45]
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2227) ~[jboss-logging-3.1.3.GA.jar:3.1.3.GA]
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214) ~[jboss-logging-3.1.3.GA.jar:3.1.3.GA]
at org.hibernate.ejb.Ejb3Configuration.(Ejb3Configuration.java:145) ~[hibernate-entitymanager-4.2.16.Final.jar:4.2.16.Final]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) ~[hibernate-entitymanager-4.2.16.Final.jar:4.2.16.Final]
at org.apache.tapestry5.internal.jpa.EntityManagerSourceImpl.createEntityManagerFactory(EntityManagerSourceImpl.java:212) ~[tapestry-jpa-5.4-beta-28.jar:na]
at org.apache.tapestry5.internal.jpa.EntityManagerSourceImpl.getEntityManagerFactory(EntityManagerSourceImpl.java:189) ~[tapestry-jpa-5.4-beta-28.jar:na]
at org.apache.tapestry5.internal.jpa.EntityManagerSourceImpl.create(EntityManagerSourceImpl.java:281) ~[tapestry-jpa-5.4-beta-28.jar:na]
at $EntityManagerSource_517be530db71.create(Unknown Source) ~[na:na]
at org.apache.tapestry5.internal.jpa.EntityManagerManagerImpl.getOrCreateEntityManager(EntityManagerManagerImpl.java:80) ~[tapestry-jpa-5.4-beta-28.jar:na]
at org.apache.tapestry5.internal.jpa.EntityManagerManagerImpl.createAllEntityManagers(EntityManagerManagerImpl.java:70) ~[tapestry-jpa-5.4-beta-28.jar:na]
at org.apache.tapestry5.internal.jpa.EntityManagerManagerImpl.getEntityManagers(EntityManagerManagerImpl.java:61) ~[tapestry-jpa-5.4-beta-28.jar:na]
at $EntityManagerManager_517be530db70.getEntityManagers(Unknown Source) ~[na:na]
at $EntityManagerManager_517be530db6f.getEntityManagers(Unknown Source) ~[na:na]
at org.apache.tapestry5.jpa.modules.JpaModule.startupEarly(JpaModule.java:187) ~[tapestry-jpa-5.4-beta-28.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
at org.apache.tapestry5.ioc.internal.StartupDefImpl$1.run(StartupDefImpl.java:70) ~[tapestry-ioc-5.4-beta-28.jar:na]
... 20 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.hibernate.service.jndi.JndiNameException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702) ~[catalina.jar:7.0.47]
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) ~[catalina.jar:7.0.47]
... 43 common frames omitted

Outside tapestry-model I don't have any issues with jpa/hibernate.

@balapal
balapal commented Feb 13, 2015

I am trying to use tapestry-model for the first time (so I am not upgrading from earlier version).

@balapal
balapal commented Feb 13, 2015

What would be the recommended way of using tapestry-model with tapestry-jpa and hibernate provider?

@kaosko
Member
kaosko commented Feb 13, 2015

I just explained in my previous comment why there's provider specific code. The thinking was that you'd use ElasticSearch with EclipseLink/JPA and HibernateSearch with Hibernate. Personally, if I wanted to use Hibernate, I'd just use plain tapestry-model-hibernate. Use the Hibernate version provided as a dependency in that case. The best way to use tapestry-jpa with Hibernate is perhaps to use 0.5.0 that doesn't include search at all. I'll have to look if JPA 2.2 has added any listening APIs for the events.

@ascandroli ascandroli pushed a commit that referenced this issue Feb 22, 2015
Alejandro Scandroli refs #2 - all the services related to ElasticSearch have been moved t…
…o a dedicated module.
b82c03b
@ascandroli
Member

I'm using EclipseLink but I wanted to be able to exclude ElasticSearch for a different reason: I'm running on Heroku with a huge DB and not only it takes forever to start but later you can't use the index due Heroku's ephemeral filesystem.

I've separated all the services related to ElasticSearch to a new module called ElasticSearchModule.
To preserve backward compatibility the module is activated by default via the "Tapestry-Module-Classes" but it could be skipped with -Dtapestry.disable-default-modules=true

This allows you to exclude elasticsearch and eclipselink transitive dependencies from the final war.

@ascandroli ascandroli closed this Feb 22, 2015
@ascandroli ascandroli self-assigned this Feb 22, 2015
@ascandroli ascandroli added this to the 0.6.0 milestone Feb 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment