[jboss-jira] [JBoss JIRA] (JBMDR-75) Merging entity bean metadata yields ClassCastException

Rune Flobakk (JIRA) jira-events at lists.jboss.org
Tue Jan 17 08:55:18 EST 2012


     [ https://issues.jboss.org/browse/JBMDR-75?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rune Flobakk updated JBMDR-75:
------------------------------

      Git Pull Request: https://github.com/jboss/metadata/pull/29  (was: https://github.com/jboss/metadata/pull/29)
    Steps to Reproduce: Either run unit test EntityBeanMetaDataMergingTestCase, or deploy an application to JBoss AS containing _both_ jbosscmp-jdbc.xml and jboss-ejb3.xml files.

    
> Merging entity bean metadata yields ClassCastException
> ------------------------------------------------------
>
>                 Key: JBMDR-75
>                 URL: https://issues.jboss.org/browse/JBMDR-75
>             Project: JBoss MetaData Repository
>          Issue Type: Bug
>          Components: MetaData
>         Environment: JBoss AS 7.1.0.CR1b
>            Reporter: Rune Flobakk
>            Priority: Critical
>              Labels: ejb2, entitybean, jboss-as, metadata
>
> I have encountered this issue on JBoss AS 7.1.0.CR1b with an application containing EJB2 entity beans. When deploying the beans I get the following ClassCastException:
> {quote}
> 13:04:55,292 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.subunit."myapp.ear"."myapplication-ejb-1.3-SNAPSHOT.jar".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."myapp.ear"."myapplication-ejb-1.3-SNAPSHOT.jar".PARSE: Failed to process phase PARSE of subdeployment "myapplication-ejb-1.3-SNAPSHOT.jar" of deployment "myapp.ear"
>         at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.1.0.CR1b.jar:7.1.0.CR1b]
>         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_24]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]
>         at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]
> Caused by: java.lang.ClassCastException: org.jboss.metadata.ejb.spec.EntityBeanMetaData cannot be cast to org.jboss.metadata.ejb.jboss.ejb3.JBossGenericBeanMetaData
>         at org.jboss.metadata.ejb.spec.EntityBeanMetaData.merge(EntityBeanMetaData.java:121)
>         at org.jboss.metadata.ejb.spec.EntityBeanMetaData.createMerged(EntityBeanMetaData.java:112)
>         at org.jboss.metadata.ejb.spec.EntityBeanMetaData.createMerged(EntityBeanMetaData.java:32)
>         at org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData.merge(EnterpriseBeansMetaData.java:81)
>         at org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData.createMerged(EnterpriseBeansMetaData.java:52)
>         at org.jboss.metadata.ejb.spec.EjbJarMetaData.merge(EjbJarMetaData.java:175)
>         at org.jboss.metadata.ejb.spec.EjbJarMetaData.createMerged(EjbJarMetaData.java:668)
>         at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.deploy(EjbJarParsingDeploymentUnitProcessor.java:124)
>         at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.1.0.CR1b.jar:7.1.0.CR1b]
>         ... 5 more
> {quote}
> I have recreated the exception in isolation in a unit test, which can be pulled from my fork of jboss-metadata at github https://github.com/runeflobakk/metadata.
> I have identified the bug to be a faulty cast at {{[EntityBeanMetaData.java:121|https://github.com/jboss/metadata/blob/master/ejb/src/main/java/org/jboss/metadata/ejb/spec/EntityBeanMetaData.java#L121]}} (well, obviously). The immediate cause of this is the call to {{EntityBeanMetaData#merge}} at {{[EntityBeanMetaData.java:112|https://github.com/jboss/metadata/blob/master/ejb/src/main/java/org/jboss/metadata/ejb/spec/EntityBeanMetaData.java#L112]}}, passing {{this}} as argument for the {{AbstractEnterpriseBeanMetaData or}} parameter. {{or}} is then being cast to {{JBossGenericBeanMetaData}}, which is an entirely different type than {{EntityBeanMetaData}}. The code simply cannot possibly run.
> I _can_ change the cast to EntityBeanMetaData and the code still compiles, but I do not know if this has any other implications, e.g. if the public {{merge}} method is being called by any others which actually _do_ pass an JBossGenericBeanMetaData.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list