无法从本地 EJB 进行远程 JNDI 调用

发布于 2024-12-08 10:41:45 字数 1135 浏览 2 评论 0原文

我使用的是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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多情癖 2024-12-15 10:41:45

可能,您必须在客户端文件夹的类路径中添加 EJB 项目,它可能会解决问题

Probably, You have to add EJB Project in your client folder's class path, It may resolve the problem

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文