[jboss-jira] [JBoss JIRA] (WFLY-829) Misplaced @PersistenceContext Causes Untraceable Deployment Failure

Marlig (JIRA) jira-events at lists.jboss.org
Fri Jul 5 06:16:22 EDT 2013


    [ https://issues.jboss.org/browse/WFLY-829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787841#comment-12787841 ] 

Marlig commented on WFLY-829:
-----------------------------

Had the same issue. Code was like:

{code}
@PersistenceContext(unitName = "abc")
public class OrderControllerBean implements Serializable {
	
        @PersistenceContext(unitName = "abc")
	private EntityManager em;
{code}

After removing the PersistenceContext annotation at the class level (as the exception correctly points to), everything is fine. 

How did we find the culprit? We did set logging to trace, and as the persistence units first seem to be read and later processed, you have the order and can deduce which persistence unit is wrong. Would be great if the exception could directly point to the persistence unit in error, though.

Hope this helps ...
                
> Misplaced @PersistenceContext Causes Untraceable Deployment Failure
> -------------------------------------------------------------------
>
>                 Key: WFLY-829
>                 URL: https://issues.jboss.org/browse/WFLY-829
>             Project: WildFly
>          Issue Type: Bug
>          Components: JPA / Hibernate
>         Environment: Macintosh 10.7.2
>            Reporter: Jim Brownfield
>            Assignee: Scott Marlow
>
> When deploying an ear file that contains an Entity bean with an inappropriate @PersistenceContext annotation, the following stacktrace is generated, and the deployment fails:
> 15:36:16,322 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-9) MSC00001: Failed to start service jboss.deployment.subunit."xxx.xxxxxx.xxxxx.deploy.ear"."xxx.xxxxxx.xxxxx.ejb-0.0.1-SNAPSHOT.jar".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."xxx.xxxxxx.xxxxx.deploy.ear"."xxx.xxxxxx.xxxxx.ejb-0.0.1-SNAPSHOT.jar".PARSE: Failed to process phase PARSE of subdeployment "xxx.xxxxxx.xxxxx.ejb-0.0.1-SNAPSHOT.jar" of deployment "xxx.xxxxxx.xxxxx.deploy.ear"
> 	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
> 	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
> 	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_29]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_29]
> 	at java.lang.Thread.run(Thread.java:680) [:1.6.0_29]
> Caused by: java.lang.IllegalArgumentException: Class level annotations must provide a name.
> 	at org.jboss.as.jpa.processor.JPAAnnotationParseProcessor.processClass(JPAAnnotationParseProcessor.java:233)
> 	at org.jboss.as.jpa.processor.JPAAnnotationParseProcessor.processPersistenceAnnotations(JPAAnnotationParseProcessor.java:127)
> 	at org.jboss.as.jpa.processor.JPAAnnotationParseProcessor.deploy(JPAAnnotationParseProcessor.java:90)
> 	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
> 	... 5 more
> The IllegalArgumentException gives no data for the annotation, the class, or any relevant data to the cause.  I built JBoss debug from source to discover that the culprit in my case was a misplaced PersistenceContext annotation in an entity bean.  The offending annotation had actually existed in a version of our code running in JBoss 4 without error.

--
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


More information about the jboss-jira mailing list