无法使用@PersistenceContext注入RESOURCE_LOCAL容器管理的EntityManagers

时间:2014-09-12 07:22:48

标签: java rest jboss6.x

我正在尝试在jboss 6上部署一个安静的Web服务,并面临以下问题..

12:13:54,437 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."copl.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."copl.war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "copl.war"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011047: Component class au.com.copl.bean.ServiceBean for component ServiceBean has errors:
JBAS011428: Cannot inject RESOURCE_LOCAL container managed EntityManagers using @PersistenceContext
        at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:171)
        at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
        at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:164)
        at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:157)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
    ... 5 more

1 个答案:

答案 0 :(得分:4)

在persistence.xml中使用transaction-type = JTA。希望问题能得到解决。