Hi -- Did you ever get a reply to this post? This sounds rather like the problem we are having. (RH 7.1 static IP JBoss server, Win 98 DHCP client fails to connect with a Connection Refused error)...
you have to put the hostname in your hosts file something like this:
192.168.0.1 myServerName, anotherName
hope it helps (solved my problem :) )
> I am developing a Java application runs on Win2K and
> this application uses JNDI to look up and work with
> an EJB component on a Linux server (with JBoss 2.1
> installed). When called, the EJB component will open
> a connection with PostgreSQL database (installed on
> same Linux server) to do some SQL operations.
> If the Linux server (Linux 7.0, JBoss 2.1) is
> installed with DHCP/DNS configuration, then the Java
> client application running on Win2K successfully
> lookups and calls to the EJB on the server. (In this
> case, I set the context url in jndi.properties as
> "jnp://<linux server name>:1099)
> If the Linux server (Linux 7.0, JBoss 2.1) is
> installed WITHOUT DHCP/DNS configuration (i.e. I
> specify fixed IP address), then the Java client
> application running on Win2K fails at the
> context.lookup("xxx") command. (In this case, I set
> the context url in jndi.properties as "jnp:// server address>:1099). The error shows something
> wrong with rmi (socket connect refused). Of course, I
> can ping the Linux server address successfully.
> Do you know why the client app fails to lookup EJB
> when Linux server is not configured with DHCP/DNS
> support? And how can I resolve this problem? (I am in
> very urgent to fix it, so please reply...)
> Thank you very much,
> Huy Dao
I ran into a very similar problem. Did anyone figured it out?
Look at the previous post.
If you are not using a DNS you either need to
specify the IP address or put the host name in the
I do have an IP address and port specified for java.naming.provider.url in the jndi.properties, so it must be something else.
By the way, when I telnet to 1099 on the JBoss machine, i get back this:
UnicastRef2 127.0.0.1ëUF‘â€xConnection closed by foreign host.
Perhaps I am dreaming and guessing, but does the stub contain localhost reference (notice 127.0.0.1)
I do have it setup like that, it is clearly something else.
This is the output of building and running InterestClient, with added code to print environment, and actual address changed to xxx.xxx.xxx.xxx :
[echo] Using JBoss directory=c:\jboss-3.0.0alpha
[echo] Using base classpath=C:\jboss-3.0.0alpha\client\jboss-j2ee.jar;C:\jb
[echo] Using Source directory=C:\jboss-examples
[echo] Using Build directory=C:\jboss-examples/build-examples
[java] Got context
, java.naming.provider.url=xxx.xxx.xxx.xxx:1099, java.naming.factory.url.pkgs=org.
[java] javax.naming.CommunicationException [Root exception is java.rmi.Conn
ectException: Connection refused to host: 127.0.0.1; nested exception is:
[java] java.net.ConnectException: Connection refused: no further inform
Total time: 5 seconds
There's something strange going on with your
Even when I "telnet 127.0.0.1 1099" I see the remote
ip address. First time I ever tried that ;-)
I've searched the rmi faq, the rmi spec, google,
and a quick scan on the java developer connection.
I can't find anything similar, but that assumes
search engines work :-)
You could try adding -Djava.rmi.server.hostname to
in run.bat, this will force rmi to use host names
rather than ip addresses. But you will need a DNS
or configure the hosts names on each machine.
This is very strange, I've never seen it before.
I can tell you are running windows, but perhaps you
can give some other relevant configuration, e.g.
JBoss version, JDK version, what is the server
> There's something strange going on with your
> rmi/hosts/ip configuration.
Yep, problem solved, but first my configuration:
Client is on windows98, connecting to JBoss on Linux (RH 6.2), with hostname iliag, both machines with JBoss 3.0 alpha.
The problem was related to the /etc/hosts on linux machine, which looked like this:
127.0.0.1 localhost.localdomain localhost iliag
The first line resulted in 127.0.0.1 included in the reference to the Naming Service, which client had hard time using :-).
Looks like there are (at least) two ways to deal with the problem(tested both):
1) remove iliag from the first line of /etc/hosts
127.0.0.1 localhost.localdomain localhost
In this case a correct address will be returned in the reference, as you can see in telnet to 1099, with real address changed to xxx for secrecy :-)
2) As per Adrian's suggestion add in run.sh
In this case hostname is returned
and everything works just fine. I think this is the right way, and wonder why returning full domain name is not a default behaviour in RMI.
Looks like it is a default for codebase(http://iliag:8083) which is always returned as a name.
Adrian, thanks a lot for your help!
I have the same setup. when i am doing the following i am getting NullPointerException, the lookup is getting failed. This is happening on linux machine only.
Properties prop = new Properties();
ctx = new InitialContext(prop);
System.out.println("OBJECT---" + ctx);
//ctx = new InitialContext();
can u please help me. i am really facing this problem from past 1 week.