无法从本地 EJB 进行远程 JNDI 调用
我使用的是jboss-5.0.1 GA。 我正在尝试使用 JNDI 从本地 EJB 调用部署在远程 JBoss 服务器上的 EJB。
我已将远程接口 jar 文件包含在本地 EJB 项目的类路径中。我还在类路径中添加了 jnp-client.jar、jboss-ejb3-client.jar 。
我已使用 -b 0.0.0.0 标志在远程计算机上启动 JBoss,以确保它接受远程连接。
这是代码。
SatheBeanRemote sbr = null; //Is the remote interface for the remote bean
Properties p = new Properties();
p.put(Context.PROVIDER_URL, "jnp://10.73.17.76:1099"); //remote Jboss IP
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
Context context;
try {
context = new InitialContext(p);
sbr = (SatheBeanRemote) context.lookup("RemoteEAR/SatheBean/remote");
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
我收到以下异常。
javax.ejb.EJBException: Unexpected Error
java.lang.NoClassDefFoundError: com/netapp/beans/SatheBeanRemote
at com.netapp.balaji.greeting.GreetingBean.sayGreeting(GreetingBean.java:78)
谁能帮我指出这个问题吗?
I am using jboss-5.0.1 GA.
I am trying to invoke EJB deployed on remote JBoss server from my local EJB using JNDI.
I have included the remote interfaces jar file in my local EJB project's class path. I have as well added jnp-client.jar, jboss-ejb3-client.jar in my class path.
I have started JBoss on remote machine with -b 0.0.0.0 flags to ensure it accepts remote connections.
Here is the code.
SatheBeanRemote sbr = null; //Is the remote interface for the remote bean
Properties p = new Properties();
p.put(Context.PROVIDER_URL, "jnp://10.73.17.76:1099"); //remote Jboss IP
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
Context context;
try {
context = new InitialContext(p);
sbr = (SatheBeanRemote) context.lookup("RemoteEAR/SatheBean/remote");
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I am getting the below exception.
javax.ejb.EJBException: Unexpected Error
java.lang.NoClassDefFoundError: com/netapp/beans/SatheBeanRemote
at com.netapp.balaji.greeting.GreetingBean.sayGreeting(GreetingBean.java:78)
Can anyone help me point out the issue ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能,您必须在客户端文件夹的类路径中添加 EJB 项目,它可能会解决问题
Probably, You have to add EJB Project in your client folder's class path, It may resolve the problem