我正在使用 JBoss AS 6.1.0 和 Java 1.7。我正在使用 Maven 构建我的 EAR v6,它会将版本号附加到每个 EJB 3.1 模块文件名和 EAR 文件名,我喜欢它,但我不希望每次更改版本时更改我的 bean 的可移植 JNDI 名称,所以我在 ejb-jar.xml 中定义了静态 EJB 模块名称(EJB 模块名称与 EAR 中的 EJB JAR 文件名称不同)。我在 server.log 中遇到部署错误。当 EJB jar 具有与模块名称相同的名称时,一切都很好。请帮忙。
ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" version="3.1">
<module-name>TestEjb</module-name>
<display-name>TestEjb</display-name>
</ejb-jar>
应用程序.xml:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
<application-name>TestEar</application-name>
<display-name>TestEar</display-name>
<module>
<ejb>TestEjb-0.0.1-SNAPSHOT.jar</ejb>
</module>
<library-directory>APP-INF/lib</library-directory>
</application>
测试豆:
@Remote
public interface TestEjbRemote {
public void testMethod();
}
@Stateless
public class TestEjb implements TestEjbRemote {
@Override
public void testMethod() {
}
}
引导日志:
16:07:19,855 INFO [JBossASKernel] Created KernelDeployment for: TestEjb-0.0.1-SNAPSHOT.jar
16:07:19,855 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=TestEar-0.0.1-SNAPSHOT.ear,jar=TestEjb-0.0.1-SNAPSHOT.jar,name=TestEjb,service=EJB3
16:07:19,855 INFO [JBossASKernel] with dependencies:
16:07:19,855 INFO [JBossASKernel] and demands:
16:07:19,855 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
16:07:19,855 INFO [JBossASKernel] jboss-switchboard:appName=TestEar,module=TestEjb,name=TestEjb; Required: Create
16:07:19,855 INFO [JBossASKernel] and supplies:
16:07:19,855 INFO [JBossASKernel] jndi:TestEar-0.0.1-SNAPSHOT/TestEjb/remote
16:07:19,870 INFO [JBossASKernel] jndi:TestEjb
16:07:19,870 INFO [JBossASKernel] Class:com.test.client.TestEjbRemote
16:07:19,870 INFO [JBossASKernel] jndi:TestEar-0.0.1-SNAPSHOT/TestEjb/remote-com.test.client.TestEjbRemote
16:07:19,870 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=TestEar-0.0.1-SNAPSHOT.ear,jar=TestEjb-0.0.1-SNAPSHOT.jar,name=TestEjb,service=EJB3) to KernelDeployment of: TestEjb-0.0.1-SNAPSHOT.jar
服务器日志:
2012-10-15 16:07:20,198 ERROR [ProfileServiceBootstrap] (Thread-2) Failed to load profile:: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.ejb3:application=TestEar-0.0.1-SNAPSHOT,module=TestEjb-0.0.1-SNAPSHOT,component=TestEjb,service=EjbEncFactory" is missing the following dependencies:
Dependency "jboss.naming:application=TestEar-0.0.1-SNAPSHOT,component=TestEjb,module=TestEjb-0.0.1-SNAPSHOT" (should be in state "Installed", but is actually in state "** NOT FOUND Depends on 'jboss.naming:application=TestEar-0.0.1-SNAPSHOT,component=TestEjb,module=TestEjb-0.0.1-SNAPSHOT' **")
Deployment "jboss.j2ee:ear=TestEar-0.0.1-SNAPSHOT.ear,jar=TestEjb-0.0.1-SNAPSHOT.jar,name=TestEjb,service=EJB3" is missing the following dependencies:
Dependency "jboss.ejb3:application=TestEar-0.0.1-SNAPSHOT,component=TestEjb,module=TestEjb-0.0.1-SNAPSHOT,service=EjbEncFactory" (should be in state "Installed", but is actually in state "Described")
Dependency "org.jboss.ejb.bean.instantiator/TestEar-0.0.1-SNAPSHOT/TestEjb-0.0.1-SNAPSHOT/TestEjb" (should be in state "Installed", but is actually in state "** NOT FOUND Depends on 'org.jboss.ejb.bean.instantiator/TestEar-0.0.1-SNAPSHOT/TestEjb-0.0.1-SNAPSHOT/TestEjb' **")
Deployment "jboss.j2ee:ear=TestEar-0.0.1-SNAPSHOT.ear,jar=TestEjb-0.0.1-SNAPSHOT.jar,name=TestEjb,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:ear=TestEar-0.0.1-SNAPSHOT.ear,jar=TestEjb-0.0.1-SNAPSHOT.jar,name=TestEjb,service=EJB3" (should be in state "Installed", but is actually in state "Instantiated")
DEPLOYMENTS IN ERROR:
Deployment "org.jboss.ejb.bean.instantiator/TestEar-0.0.1-SNAPSHOT/TestEjb-0.0.1-SNAPSHOT/TestEjb" is in error due to the following reason(s): ** NOT FOUND Depends on 'org.jboss.ejb.bean.instantiator/TestEar-0.0.1-SNAPSHOT/TestEjb-0.0.1-SNAPSHOT/TestEjb' **
Deployment "jboss.ejb3:application=TestEar-0.0.1-SNAPSHOT,component=TestEjb,module=TestEjb-0.0.1-SNAPSHOT,service=EjbEncFactory" is in error due to the following reason(s): Described
Deployment "jboss.naming:application=TestEar-0.0.1-SNAPSHOT,component=TestEjb,module=TestEjb-0.0.1-SNAPSHOT" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.naming:application=TestEar-0.0.1-SNAPSHOT,component=TestEjb,module=TestEjb-0.0.1-SNAPSHOT' **
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.2.GA]
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.2.GA]
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.1.0.Final]
at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:107) [:0.2.2]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:135) [:6.1.0.Final]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.1.0.Final]
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-6]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-6]
at java.lang.Thread.run(Thread.java:722) [:1.7.0_04]