[
https://issues.apache.org/jira/browse/OPENEJB-2035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13736338#comment-13736338
]
Apache Fan commented on OPENEJB-2035:
-------------------------------------
Hi,
unfortunately openejb.jar.enhancement.include property did not have any effect.
However reorganizing the project a bit did activate the enhancer (but still the
same error occurs):
1) I moved away the JPA part of the code to a separate EJB maven module
2) Now the Enhancer logs:
{code}
INFO: enhancing url(s):
[file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/lib/slf4j-api-1.6.4.jar,
file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/lib/blacklist-service-ejb-1.0.jar,
file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/classes/,
file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/lib/log4j-1.2.16.jar,
file:/D:/apps/apache-tomee-plus-1.5.2/lib/tomee-mojarra-1.5.2.jar,
file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/lib/slf4j-log4j12-1.6.4.jar,
file:/D:/apps/apache-tomee-plus-1.5.2/lib/openejb-jpa-integration-4.5.2.jar,
file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/lib/jcl-over-slf4j-1.6.4.jar]
Aug 11, 2013 6:48:29 PM null
INFO: Enhancer running on type
"com.bankapp.service.blacklist.entity.BlackListedCard".
Aug 11, 2013 6:48:29 PM org.apache.openejb.assembler.classic.DeployTimeEnhancer
enhance
INFO: enhancing url(s):
[file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/lib/slf4j-api-1.6.4.jar,
file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/lib/blacklist-service-ejb-1.0.jar,
file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/classes/,
file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/lib/log4j-1.2.16.jar,
file:/D:/apps/apache-tomee-plus-1.5.2/lib/tomee-mojarra-1.5.2.jar,
file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/lib/slf4j-log4j12-1.6.4.jar,
file:/D:/apps/apache-tomee-plus-1.5.2/lib/openejb-jpa-integration-4.5.2.jar,
file:/D:/sts/workspace-chat/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/bankwebapp/WEB-INF/lib/jcl-over-slf4j-1.6.4.jar]
Aug 11, 2013 6:48:29 PM null
INFO: Enhancer running on type
"com.bankapp.service.blacklist.entity.BlackListedCard".
Aug 11, 2013 6:48:30 PM org.apache.openejb.config.ConfigurationFactory
configureApplication
INFO: Configuring enterprise application:
D:\sts\workspace-chat\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\bankwebapp
{code}
3) Unfortunately JPA still does not like the class:
{code}
Caused by: javax.ejb.EJBException: The bean encountered a non-application
exception; nested exception is:
<openjpa-2.2.0-r422266:1244990 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance
"1234 [java.lang.String]" to PersistenceCapable failed. Ensure that it has
been enhanced.
FailedObject: 1234 [java.lang.String]
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:363)
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:283)
at
com.bankapp.service.blacklist.BlackListEJB$LocalBeanProxy.addToBlackList(com/bankapp/service/blacklist/BlackListEJB.java)
at
com.bankapp.servlet.AddToBlackListServlet.doGet(AddToBlackListServlet.java:40)
{code}
4) see the modified code attached.
> Tomee+OpenEJB+OpenJPA: deployment-time JPA enhancement trouble
> --------------------------------------------------------------
>
> Key: OPENEJB-2035
> URL: https://issues.apache.org/jira/browse/OPENEJB-2035
> Project: OpenEJB
> Issue Type: Bug
> Components: deployment
> Affects Versions: 4.5.2
> Reporter: Apache Fan
> Attachments: ejb-jpa2.zip, ejb-jpa.zip
>
>
> Hello,
> I am struggling to get JPA working with deployment-time enhancement.
> When I attempt to persist an entity I receive the exception below.
> I have added 'openejb.jpa.deploy-time-enhancement=true' to Tomee's
> catalina.property, which is picked up properly according to the logs.
> {code}
> Caused by: javax.ejb.EJBException: The bean encountered a non-application
> exception; nested exception is:
> <openjpa-2.2.0-r422266:1244990 nonfatal user error>
> org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance
> "1234 [java.lang.String]" to PersistenceCapable failed. Ensure that it has
> been enhanced.
> FailedObject: 1234 [java.lang.String]
> at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:363)
> at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:283)
> at
> com.bankapp.service.blacklist.BlackListEJB$LocalBeanProxy.addToBlackList(com/bankapp/service/blacklist/BlackListEJB.java)
> at
> com.bankapp.servlet.AddToBlackListServlet.doGet(AddToBlackListServlet.java:40)
> ... 19 more
> {code}
> See the attachment for the webapp to reproduce the problem.
> The relevant Tomee config files can be found at src/test/resources/tomee.
> Environment:
> Tomee:1.5.2 Plus
> OpenEJB: 4.5.2
> OpenJPA: 2.2.0
> JDK: 1.7.0_21, Windows 7, 64 bit
> H2DB: 1.3.170
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira