Harald Wellmann commented on Bug WELD-1498

I ran into the same problem with 2.1.0.Beta1 in a different context (DeltaSpike JPA + OpenJPA) with no easy workaround:

java.lang.ClassCastException: org.jboss.weld.proxies.EntityManager$1821646481$Proxy$_$$_WeldClientProxy cannot be cast to javax.persistence.EntityTransaction
	at org.jboss.weld.proxies.EntityManager$1821646481$Proxy$_$$_WeldClientProxy.getTransaction(Unknown Source)
	at org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.getTransaction(ResourceLocalTransactionStrategy.java:265)
	at org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.execute(ResourceLocalTransactionStrategy.java:130)
	at org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor.executeInTransaction(TransactionalInterceptor.java:57)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.jboss.weld.interceptor.proxy.SimpleMethodInvocation.invoke(SimpleMethodInvocation.java:30)
	at org.jboss.weld.interceptor.chain.AbstractInterceptionChain.invokeNext(AbstractInterceptionChain.java:93)
	at org.jboss.weld.interceptor.chain.AbstractInterceptionChain.invokeNextInterceptor(AbstractInterceptionChain.java:78)
	at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:48)
	at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:41)
	at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:53)
	at org.ops4j.pax.cdi.sample2.service.impl.LibraryServiceImpl$Proxy$_$$_WeldSubclass.createAuthor(Unknown Source)
        ...

The scenario is similar: org.apache.openjpa.persistence.EntityManagerImpl implements both javax.persistence.EntityManager and javax.persistence.EntityTransaction.

EntityManagerImpl.getTransaction() returns this, so the proxy returns itself, but the proxy class does not implement javax.persistence.EntityTransaction.

There's a pull request that solves the problem (at least in my case) - it's basically just what Marko suggested.

This also affects 1.1.14.Final.

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
_______________________________________________
weld-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/weld-issues

Reply via email to