调用 JBOSS EJB3的相关问题

1.如果本地调用不成功有可能是包不对

2.如果远程调用不成功解决方法如下:

I donot know why my stand-alone client can not lookup
ejb deployed on another machine. The app server is JBOSS.

Test code is :

Hashtable environment = new Hashtable();
            environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
            environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
            environment.put(Context.PROVIDER_URL, "jnp://10.200.1.21:1099"); // remote machine IP
            InitialContext context = new InitialContext(environment);
            Object obj = context.lookup("MyBean"); //ejb-name
            System.out.println("-->> lookup object successfully");

//-------------------------------------------------------------

Exception is :

     [java] javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connec
tion refused to host: 127.0.0.1; nested exception is:
     [java] java.net.ConnectException: Connection refused: connect]
     [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:648)
     [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:508)
     [java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
     [java] at vic.test.jboss.TestDS.main(Unknown Source)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java
:25)

    ......


Can you give me some advises? Thanks!

 

 

How to call remote ejb deployed on jboss?

Posted by: Raghu Kodali on ??? 24, 2004 in response to Message #147156
Double check if the RMI port is 1099 or not. Typically ConnectionException happens if the port is not right or the server is not started on that port.

raghu

  Message #147399 Post reply Post reply Post reply Go to top Go to top Go to top

How to call remote ejb deployed on jboss?

Posted by: vic liu on ??? 25, 2004 in response to Message #147327
thanks, i resolved this problem.
There is something wrong with my linux server configuration

  Message #153983 Post reply Post reply Post reply Go to top Go to top Go to top

How to call remote ejb deployed on jboss?

Posted by: tim poh on ?? 24, 2005 in response to Message #147399
Do you mind sharing with us how did you resolve this problem ? I seem to have the same problem with JBoss installation on Linux. Thank you very much.

  Message #158409 Post reply Post reply Post reply Go to top Go to top Go to top

Same error

Posted by: Gustavo Melim on ?? 24, 2005 in response to Message #147156
It seems that you solved you problem, can you share what you did ?
I am getting the same error and already checked that the jnp port is 1099.

  Message #164586 Post reply Post reply Post reply Go to top Go to top Go to top

host entries

Posted by: Ben Dinnerville on ?? 04, 2005 in response to Message #158409
This problem will mainly happen on redhar based linux distros (not suse etc thou, only those directly based on RH like centos etc)
You need to update your hosts file. By default you will have an entry for 127.0.0.1 with your hostnames next to it like follows:

127.0.0.1 myserver.server.com myserver localhost localhost.localdomain

you need to add a line for your local ip address also and then move your hostnames to it, leaving the localhost entries on 127.0.0.1 like such:

127.0.0.1 localhost localhost.localdomain
192.168.100.1 myserver.server.com myserver

Then restart jboss. It will now bind to both 127.0.0.1 and the 192 (or other) address allowing you to access it from remote machines.

  Message #165362 Post reply Post reply Post reply Go to top Go to top Go to top

any other way?

Posted by: Mali Panchu on ?? 08, 2005 in response to Message #164586
I am using the same solution currently. This holds good for Static IP configuration.

Any solution to work with DHCP?

  Message #167077 Post reply Post reply Post reply Go to top Go to top Go to top

DHCP

Posted by: Mali Panchu on ?? 20, 2005 in response to Message #165362
The information in the thread http://forum.java.sun.com/thread.jspa?forumID=58&tstart=0&threadID=288759&trange=15

could be useful in the case of DHCP.

  Message #240778 Post reply Post reply Post reply Go to top Go to top Go to top

Solution - How to call remote ejb deployed on jboss?

Posted by: martti catano on ?? 05, 2007 in response to Message #147156
Hi, I had the same problem.
Surfing in the web I found this information:

By default JBossAS binds its services to localhost (127.0.0.1). To enable remote access by binding JBoss services to a particular interface, simply run jboss with the -b option.

Example: if your ip is 192.168.22.14, you must to start JBoss like:

./run.sh -b192.168.22.14 or ./run.sh --host=192.168.22.14

for windows:

run.bat -b192.168.22.14 or run.bat --host=192.168.22.14

Good luck.

Martti.

  Message #251880 Post reply Post reply Post reply Go to top Go to top Go to top

This helped a lot

Posted by: Ramdas Sawant on ?? 05, 2008 in response to Message #240778
This helped a lot.
Thanks a lot


Ramdas

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值