0
votes

I am using wildfly 10.0.x. And I am migrating ejb2.1 to ejb3.2 so this is my ejb-jar.xml file

<?xml version="1.0"?>
<ejb-jar version="3.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2.xsd">
<description>www.cedar.com - Collaborative Planning</description>
<display-name>CP - J2EE</display-name>
<enterprise-beans>

    <!-- BudgetCycleEditorSession -->
    <session>
        <description>no description</description>
        <display-name>BudgetCycleEditorSessionSEJB</display-name>
        <ejb-name>BudgetCycleEditorSessionSEJB</ejb-name>
    <!--//<startUserCode BudgetCycleEditorSession-ws-endpoint-->
    <!--//<endUserCode BudgetCycleEditorSession-ws-endpoint-->      
          <home>com.cedar.cp.ejb.api.model.BudgetCycleEditorSessionHome</home>
        <remote>com.cedar.cp.ejb.api.model.BudgetCycleEditorSessionRemote</remote>
        <local-home>com.cedar.cp.ejb.api.model.BudgetCycleEditorSessionLocalHome</local-home>
        <local>com.cedar.cp.ejb.api.model.BudgetCycleEditorSessionLocal</local>
        <ejb-class>com.cedar.cp.ejb.impl.model.BudgetCycleEditorSessionSEJB</ejb-class>
        <session-type>Stateless</session-type>
        <transaction-type>Container</transaction-type>

        <ejb-local-ref>
            <ejb-ref-name>ejb/ModelLocalHome</ejb-ref-name>
            <ejb-ref-type>Entity</ejb-ref-type>
            <local-home>com.cedar.cp.ejb.impl.model.ModelLocalHome</local-home>
            <local>com.cedar.cp.ejb.impl.model.ModelLocal</local>
            <ejb-link>ModelEEJB</ejb-link>
        </ejb-local-ref>

        <ejb-local-ref>
            <ejb-ref-name>ejb/DimensionLocalHome</ejb-ref-name>
            <ejb-ref-type>Entity</ejb-ref-type>
            <local-home>com.cedar.cp.ejb.impl.dimension.DimensionLocalHome</local-home>
            <local>com.cedar.cp.ejb.impl.dimension.DimensionLocal</local>
            <ejb-link>DimensionEEJB</ejb-link>
        </ejb-local-ref>

        <resource-ref>
            <res-ref-name>jdbc/fc</res-ref-name><res-type>javax.sql.DataSource</res-type><res-auth>Container</res-auth>
        </resource-ref>
        <resource-ref>
            <res-ref-name>jdbc/oa</res-ref-name><res-type>javax.sql.DataSource</res-type><res-auth>Container</res-auth>
        </resource-ref>
        <resource-ref>
            <res-ref-name>jdbc/ad</res-ref-name><res-type>javax.sql.DataSource</res-type><res-auth>Container</res-auth>
        </resource-ref>
        <resource-ref>
          <res-ref-name>jdbc/db2</res-ref-name><res-type>javax.sql.DataSource</res-type><res-auth>Container</res-auth>
      </resource-ref>
        <resource-ref>
            <res-ref-name>jms/cp/TopicConnectionFactory</res-ref-name>
            <res-type>javax.jms.TopicConnectionFactory</res-type>
            <res-auth>Container</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
        </resource-ref>
        <resource-ref>
            <res-ref-name>jms/cp/entityEventTopic</res-ref-name>
            <res-type>javax.jms.Topic</res-type>
            <res-auth>Container</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
        </resource-ref>
    </session>

    <entity>
        <description>MODEL table entity bean</description>
        <display-name>ModelEEJB</display-name>
        <ejb-name>ModelEEJB</ejb-name>
        <local-home>com.cedar.cp.ejb.impl.model.ModelLocalHome</local-home>
        <local>com.cedar.cp.ejb.impl.model.ModelLocal</local>
        <ejb-class>com.cedar.cp.ejb.impl.model.ModelEEJB</ejb-class>
        <persistence-type>Bean</persistence-type>
        <prim-key-class>com.cedar.cp.dto.model.ModelPK</prim-key-class>
        <reentrant>false</reentrant>
        <resource-ref>
            <res-ref-name>jdbc/fc</res-ref-name><res-type>javax.sql.DataSource</res-type><res-auth>Container</res-auth>
        </resource-ref>
    </entity>

    </enterprise-beans>

    <assembly-descriptor>
        <method-permission>
                <unchecked/>
            <method>
                <ejb-name>ModelEEJB</ejb-name>
                <method-name>*</method-name>
            </method>
        </method-permission>
    <container-transaction>
        <method><ejb-name>ModelEEJB</ejb-name><method-name>*</method-name></method><trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
 </ejb-jar>

But I cannot deploy this ejb to server.

23:05:46,635 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."cppro.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."cppro.war".PARSE: WFLYSRV0153: Failed to process phase PARSE of deployment "cppro.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEJB0450: Entity Beans are no longer supported, beans ModelEEJB cannot be deployed at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.deploy(EjbJarParsingDeploymentUnitProcessor.java:179) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147) ... 5 more

How can I fix it?

1
Thank you very much美丽美丽花
Please give me another answer美丽美丽花

1 Answers

2
votes

There is no way to just change some properties/xml configuration and redeploy your current CMPs into a new JavaEE application servers. You must make some changes in your code and recompile them.

Regarding its complexity, it's mainly depends on the way you used CMPs and the level of abstraction you have on top of your persistence layer. You may need to do some refactoring/restructuring on your beans.

I highly suggest taking a look into the following guide so that you would have a better idea about required/optional changes you should made to migrate your application to JPA.

http://what-when-how.com/enterprise-javabeans-3/migrating-cmp-2-entity-beans-to-the-ejb-3-jpa-part-1/