我試圖從WS 6.1遷移到JBoss EAP 6.1。我很難嘗試讓EJB 2.1在JBoss 6.1中工作。將EJB 2.1從WebSphere 6.1遷移到JBoss EAP 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>@[email protected]</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>@[email protected]</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>@[email protected]</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>@[email protected]</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沒有成功。
我真的不知道下一步該怎麼做..