有人可以告诉我程序中的错误: 远程EJB 3是在BonjourEJB3项目中开发的。 BonjourEJB3ClientWeb是一个调用远程EJB3项目的Web客户端。我不使用Maven。 以下是我拨打远程电话的方式:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String nom = request.getParameter("nom");
String bonjour = "";
Properties jndiProperties = new Properties();
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");
try {
proxy = new InitialContext(jndiProperties);
bonjourBean = (BonjourService) proxy.lookup("java:global/BonjourEJB3/BonjourBean!com.quesnay.service.distant.BonjourService");
if (nom != null) {
bonjour = bonjourBean.ditBonjour(nom);
}
else {}
}catch (NamingException e) {
e.printStackTrace();
}
这就是Eclipse控制台的原因:
Caused by: java.lang.RuntimeException: Error getting reflective information for class com.quesnay.servlet.BonjourCamarade with ClassLoader ModuleClassLoader for Module "deployment.BonjourEJB3ClientWeb.war:main" from Service Module Loader
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: java.lang.NoClassDefFoundError: Lcom/quesnay/service/distant/BonjourService;
at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_03]
at java.lang.Class.privateGetDeclaredFields(Unknown Source) [rt.jar:1.7.0_03]
at java.lang.Class.getDeclaredFields(Unknown Source) [rt.jar:1.7.0_03]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 10 more
Caused by: java.lang.ClassNotFoundException: com.quesnay.service.distant.BonjourService from [Module "deployment.BonjourEJB3ClientWeb.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 15 more
答案 0 :(得分:0)
显然,您在EJB客户端中遗漏了一些类。
确保您拥有最新版本的ejb客户端jar,并且客户端包含以下类com.quesnay.service.distant.BonjourService