[ 
https://issues.apache.org/jira/browse/DELTASPIKE-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13954401#comment-13954401
 ] 

Gerhard Petracek commented on DELTASPIKE-552:
---------------------------------------------

you might get an issue with ear-files. in a war-file the approach with 
@Alternative works.
maybe global alternatives help in your case:

annotate CustomUserTransactionStrategy with @Alternative but remove any config 
in beans.xml
instead add the config to META-INF/apache-deltaspike.properties
content:
globalAlternatives.org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy=[your
 package].CustomUserTransactionStrategy

> "Failed to Create Component Instance" when using EntityRepository
> -----------------------------------------------------------------
>
>                 Key: DELTASPIKE-552
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-552
>             Project: DeltaSpike
>          Issue Type: Bug
>          Components: Data-Module, JPA-Module
>    Affects Versions: 0.6
>         Environment: Wildfly 8.0.0
>            Reporter: Akhbar Falafel
>            Assignee: Thomas Hug
>
> I have code being deployed to Wildfly 8.0.0 that makes use of an 
> EntityRepository from the Deltaspike Data Module, injected into a stateless 
> EJB.  When I attempt to call a method within the code, I get the following 
> Exception:
> Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct 
> component instance
>       at 
> org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:162)
>       at 
> org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:133)
>       at 
> org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:89)
>       at 
> org.jboss.as.ejb3.component.interceptors.NonPooledEJBComponentInstanceAssociatingInterceptor.processInvocation(NonPooledEJBComponentInstanceAssociatingInterceptor.java:53)
>  [wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
>       at 
> org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
>       at 
> org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:273)
>  [wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
>       ... 100 more
> ...
> Caused by: java.lang.IllegalStateException: JBAS014237: Only session and 
> message-driven beans with bean-managed transaction demarcation are allowed to 
> access UserTransaction
>       at 
> org.jboss.as.ejb3.component.allowedmethods.AllowedMethodsInformation.realCheckPermission(AllowedMethodsInformation.java:138)
>  [wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
>       at 
> org.jboss.as.ejb3.component.allowedmethods.AllowedMethodsInformation.checkAllowed(AllowedMethodsInformation.java:112)
>  [wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
>       at 
> org.jboss.as.ejb3.subsystem.EJB3UserTransactionAccessControlService$1.authorizeAccess(EJB3UserTransactionAccessControlService.java:53)
>  [wildfly-ejb3-8.0.0.Final.jar:8.0.0.Final]
>       at 
> org.jboss.as.txn.service.UserTransactionAccessControlService.authorizeAccess(UserTransactionAccessControlService.java:83)
>       at 
> org.jboss.as.txn.service.UserTransactionBindingService$1.getReference(UserTransactionBindingService.java:71)
>       at 
> org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:140)
>       ... 198 more
> This code worked flawlessly on JBoss EAP 6.2, so it appears to be something 
> specific to Wildfly.  It has not been modified at all.  However, if I remove 
> references to my EntityRepository and re-run my code it works without issue.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to