• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Remotely accessing EJBs

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am going through a book example, and it tells me to type

in order to run my client that will access an EJB running on JBoss on my the local machine.
It works fine, but I was wondering what would I need to change if I was to run this client on a remote machine? How do I tell it where the remote host is? The address in the above command points to JBosses naming provider, I doubt it would be enough to change just that...
[ December 01, 2008: Message edited by: Bojan Tomic ]
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Change "localhost" to either the name or IP address of the host running JBossAS.

If JBossAS is version 4.2.0 or later, make sure you start it with the -b option.
 
Bojan Tomic
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, thanks for that.
I'm grateful.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a very frustrating problem that extends onto this.

Like Bojan, I want to call EJBs in JBoss remotely from a client swing app. Firstly, I want to clarify that everything works perfecly locally.

I have changed the java.naming.provider.url property from localhost:1099 to [MY-SERVER-IP]:1099. Furthermore, JBoss is started on the server with the -b option.

However, when it tries to connect i get the following exception:

javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: DSVR006703; nested exception is:
java.net.UnknownHostException: DSVR006703]

Interestingly, DSVR006703 is the (server) computer's name, although I am using the IP address, which makes me thing it is connecting on some level and then failing.

I have read elsewhere about amending the C:\WINDOWS\system32\drivers\etc\hosts file, adding in the IP and name. I have done this but it doesn't make any difference.

If anyone could offer any suggestions I would be extremely grateful as this is driving me up the wall!!

Many Thanks,

Marcus.
 
M Hathaway
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After pulling my hair out I have finally solved my problem!

In case this is useful to anybody else, I was starting JBoss on the server with:

run.bat -b 0.0.0.0

Changing this to:

run.bat -b [SERVER_IP] has fixed my problem.

I'm not sure why this worked and need to investigate the implications, but at least I have a solution to be working with.
 
Author
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

run.bat -b 0.0.0.0

Changing this to:

run.bat -b [SERVER_IP] has fixed my problem.

I'm not sure why this worked and need to investigate the implications, but at least I have a solution to be working with.



When JBoss AS starts up, it binds to localhost by default. Older versions of JBoss would bind to the address 0.0.0.0. Because of this change, you can’t access JBoss AS locally by using your machine name or 0.0.0.0. For example, to verify the server is running, you can’t go to http://myhostname:8080; you have to go to http://localhost:8080 or http://127.0.0.1:8080.

Side note: If you are reading JBoss in Action (which is being featured in the forums this week), see chapter 15 for further discussion on binding.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In case anyone else happens apon this question while searching for the answer (like me), refer to http://community.jboss.org/wiki/StartStopJBoss. Here's a snippet of the useful information with a preface for context (see bold):

Interfaces JBoss binds to

Up to JBoss 4.2 the server (HTTP and all services) bound to 0.0.0.0, meaning to all interfaces on the system. Since too many people have not secured internet facing systems this behaviour has been changed since JBoss 4.2.0. JBoss now only binds to 127.0.0.1 by default. You can use the -b parameter with run.sh/run.bat to either bind to the desired IP or 0.0.0.0 if you want the pre 4.2 behaviour back. Make sure you went through the security guideline point by point since there are at least 5+ ways an unsecured JBoss server can be taken over.


If bound to 0.0.0.0 clients will receive the hostname to connect to RMI. In this case you can set 'java.rmi.server.hostname=' to send an IP or different hostname to the client.



My problem is that machine name of the server I am running JBoss is not in the DNS. So when my Java client connects to JBoss to do the JNI lookup, JBoss is returning a system name that my client cannot get resolved. I tried adding -Djava.rmi.server.hostname=xxx.xx.xxx.xx as suggested, but now I get a different error:

10:30:24,977,FATAL,[UnifiedInvokerProxy] Could not initialize UnifiedInvokerProxy.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.remoting.InvokerRegistry.loadClientInvoker(InvokerRegistry.java:460)

So on to more digging.....
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this of any help http://community.jboss.org/thread/160657?
 
Elizabeth Roush
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, thanks, the clientConnectAddress entry in remoting-jboss-beans.xml worked for JE22 clients that use the MicroSocketClientInvoker. The
-Dremoting.bind_by_host=false worked for EJB3 clients which use the ProxyObjectFactory. Haven't tried the fix for JMS yet. Somewhat annoying that you have to make multiple changes to get remoting to behave consistently.
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic