[
https://issues.apache.org/jira/browse/CAMEL-5044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13274604#comment-13274604
]
Babak Vahdat commented on CAMEL-5044:
-------------------------------------
This fix has broken the functionality of camel-example-tracer as now while
executing "mvn camel:run" by this example the VM *exits* and beyond others we
get the following stacktrace on the console:
{code}
Caused by: java.lang.NoClassDefFoundError:
org/apache/openjpa/enhance/PersistenceCapable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:112)
at
org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1005)
at
org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1077)
at
org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:886)
at
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:772)
at
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:183)
at
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at
org.springframework.orm.jpa.LocalEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalEntityManagerFactoryBean.java:92)
at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)
{code}
Reverting back the POM of camel-jpa to revision 1234937, and doing a "mvn clean
install" on it would resolve the problem by the example mentioned. The
behaviour is obvious: The byte code has been contaminated with the class name
"org.apache.openjpa.enhance.PersistenceCapable" (not being on the classpath)
while we do make use of the JPA provider hibernate-entity-manager!
Probably I miss something here but I don't see *any* good reason to do JPA
bytecode enhancement at *build* time, so why I think we should completely
remove/avoid this, reason: the same that today happens for the Camel's own
example could happen by a Camel powered Application using camel-jpa who as an
example uses Eclipselink as it's JPA-Provider. BTW apparently in the meanwhile
*even* OpenJPA can enhance the byte code at runtime:
http://openjpa.apache.org/entity-enhancement.html
All in one, to my understanding this code enhancement at the build time does
make camel-jpa component as OpenJPA *specific*. We could also put a question on
the Dev-Forum to ask others for any good reasons to do enhance bytecode by
camel-jpa *specific for OpenJPA*.
> Use the openjpa-maven-plugin instead of maven-antrun-plugin to enhance the
> JPA entities for OpenJPA
> ---------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5044
> URL: https://issues.apache.org/jira/browse/CAMEL-5044
> Project: Camel
> Issue Type: Improvement
> Components: camel-jpa
> Affects Versions: 2.9.0
> Reporter: Christian Müller
> Assignee: Christian Müller
> Priority: Minor
> Fix For: 2.10.0
>
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira