我运行此jUnit
测试:
public class HelloBeanITCase {
@Test
public void test1() throws NamingException {
System.setProperty("org.jboss.as.embedded.ejb3.BARREN", "true");
System.setProperty("org.jboss.as.ejb3.EMBEDDED", "true");
System.setProperty("jboss.home", "/usr/local/share/jboss-eap-6.1");
System.setProperty("jboss.home.dir", "/usr/local/share/jboss-eap-6.1");
Map<String,Object> properties = new HashMap<String,Object>();
properties.put(EJBContainer.PROVIDER,
"org.jboss.as.embedded.ejb3.JBossStandaloneEJBContainerProvider");
EJBContainer ec = EJBContainer.createEJBContainer(properties);
InitialContext ctx = new InitialContext();
Hello bean = (Hello) ctx.lookup("HelloBean/local");
String now = new Date().toString();
String actual = bean.sayHello(now);
assertEquals("Hello " + now, actual);
ec.close();
}
}
但它失败并出现以下异常:
17:52:55,092 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.module.service."deployment.classes".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.classes".main: JBAS018759: Failed to load module: deployment.classes:main
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91) [jboss-as-server-7.2.0.Final.jar:7.2.0.Final]
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_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_79]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]
Caused by: org.jboss.modules.ModuleNotFoundException: Classpath:main
at org.jboss.modules.Module.addPaths(Module.java:853) [jboss-modules-1.2.0.CR1.jar:1.2.0.CR1]
at org.jboss.modules.Module.link(Module.java:1194) [jboss-modules-1.2.0.CR1.jar:1.2.0.CR1]
at org.jboss.modules.Module.relinkIfNecessary(Module.java:1222) [jboss-modules-1.2.0.CR1.jar:1.2.0.CR1]
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:226) [jboss-modules-1.2.0.CR1.jar:1.2.0.CR1]
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:70) [jboss-as-server-7.2.0.Final.jar:7.2.0.Final]
... 5 more
17:52:55,298 ERROR [org.jboss.as.server] (pool-5-thread-1) JBAS015870: Deploy of deployment "classes" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.module.service.\"deployment.classes\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.classes\".main: JBAS018759: Failed to load module: deployment.classes:main
Caused by: org.jboss.modules.ModuleNotFoundException: Classpath:main"}}
17:52:55,305 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment classes (runtime-name: classes) in 6ms
我希望将target/classes
部署到Jboss。我做错了什么?