将EJB 2.1从WebSphere 6.1迁移到JBoss EAP 6.1

时间:2014-02-10 16:38:09

标签: java java-ee jboss ejb websphere

我正在尝试从WS 6.1迁移到JBoss EAP 6.1。我正在努力使EJB 2.1在JBoss 6.1中运行。

(注意:在编译时,@ GatewayEjbJndiName @被替换为。)

这是最初的ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
    <display-name>ServerGateway</display-name>
    <enterprise-beans>
        <session id="Session_gateway">
            <display-name>GatewayEJBSB</display-name>
            <ejb-name>@GatewayEjbJndiName@</ejb-name>
            <home>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome</home>
            <remote>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote</remote>
            <ejb-class>ca.company.qc.project.server.gateway.ejb.GatewayEJBBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
        </session>
    </enterprise-beans>
    <assembly-descriptor>
        <container-transaction>
            <method>
                <ejb-name>@GatewayEjbJndiName@</ejb-name>
                <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
        </container-transaction>
    </assembly-descriptor>
</ejb-jar>

这是(经过几个小时的研究)我为JBoss EAP 6.1(ejb-jar.xml)提出的:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
    <display-name>ServerGateway</display-name>
    <enterprise-beans>
        <session id="Session_gateway">
            <display-name>GatewayEJBSB</display-name>
            <ejb-name>@GatewayEjbJndiName@</ejb-name>
            <home>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome</home>
            <remote>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote</remote>
            <ejb-class>ca.company.qc.project.server.gateway.ejb.GatewayEJBBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
            <ejb-ref>
                <ejb-ref-name>ejb/projectGatewayEJB</ejb-ref-name>
                <ejb-ref-type>Session</ejb-ref-type>
                <home>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome</home>
                <remote>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote</remote>
            </ejb-ref>
        </session>
    </enterprise-beans>
    <assembly-descriptor>
        <container-transaction>
            <method>
                <ejb-name>@GatewayEjbJndiName@</ejb-name>
                <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
        </container-transaction>
    </assembly-descriptor>
</ejb-jar>

但每次尝试启动JBoss服务器时都会出现此错误:

[org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named ProjectGatewayEJB in deployment unit subdeployment "GatewayEJBClientProject.jar" of deployment "Project.ear" are as follows:

    java:global/Project/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote
    java:app/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote
    java:module/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote
    java:jboss/exported/Project/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote
    java:global/Project/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome
    java:app/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome
    java:module/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome
    java:jboss/exported/Project/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome

10:54:41,858 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.subunit."Project.ear"."ProjectWebApp.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Project.ear"."ProjectWebApp.war".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "ProjectWebApp.war" of deployment "Project.ear"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_40]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_40]
    at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_40]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014543: No EJB found with interface of type 'ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome' and name 'ServerGateway.jar#GatewayEJB' for binding java:module/env/ProjectGatewayEJBBean
    at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:97)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:229)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:120)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
    ... 5 more

EJBBean / EJBRemote / EJBRemoteBusiness / EJBRemoteHome类中的任何位置都没有注释。因为它在EJB 2.1中不受支持(据我所知)。

我使用“standalone-full.xml”配置文件运行服务器。我也试过standalone-ha.xml但没有成功。

我真的不知道接下来要做什么..

2 个答案:

答案 0 :(得分:0)

JBoss community forum上有主题,我希望它能帮助您解决问题。

答案 1 :(得分:0)

检查自动插件基于规则的迁移工具JBoss Windup。它在某种程度上涵盖了EJB 2.1到EJB 3的迁移。

如果您发现未涵盖的内容,Windup团队将很乐意接受http://issues.jboss.org/WINDUPRULE的增强功能请求。

问题:

EJB 3可用于standalone.xml,不需要代表高可用性的standalone-ha,即群集解决方案。 full表示完整配置文件,而不是{1}}配置文件,它在Java EE 6规范中指定。请参阅Java EE 6 Web profile vs Java EE 6 Full Platform

我建议迁移到EJB 3,因为Java EE 7已经存在一段时间了,大多数应用服务器都会删除对EJB 2.x的支持。