[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


UnknownhostException in client

Posted on 2004-03-22
Medium Priority
Last Modified: 2007-12-19
Hello guys,

I'm working on this ne for a while now,
I'm making a game with an application client and a Jboss server.
I want my client to connect to my jboss application server over the internet.
Localhost everything works fine.
I finally got my client on http with the help of vzilka (to pass firewalls over the internet),
then I got a log4j error for some reason but managed to solve it partially by outing
the log4j.jar in the same directory as my jar.
Now I got another exception in the client so I still can not connect:
The client gets the ip from my server and manages to resolve the name of my server but further than that it does not get.

log4j:WARN No appenders could be found for logger (org.jboss.invocation.http.interfaces.Util).
log4j:WARN Please initialize the log4j system properly.
javax.naming.CommunicationException: Operation failed.  Root exception is java.net.UnknownHostException: PCXZ
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:143)
      at java.net.Socket.connect(Socket.java:425)
      at java.net.Socket.connect(Socket.java:375)
      at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:366)

The log4j thing would be nice to have it solved but the worst problem is the unknowhostexception.
Can anybody help me ?
Question by:themuppeteer
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
  • 2
  • +1

Author Comment

ID: 10661609
Ok, I found something new...

apperantly, the client can get to my pc, it gets the local windows name (PCXZ) and returns with that. then an unknwohostexception occurs because PCXZ means nothing to the client.

I read on the internet that I should adapt run.bat to:


but jboss seems to ignore this line completely!
It still sends PCXZ to the client.

I even put PCXZ in the clients host file so that it would know what to do when it gets that name but no luck.

Then I've put PCXZ in the hosts file of the server hoping that it would somehow translate the name to an ip when I start jboss...foolish me.

Can anyone help me ? (I'll buy you a beer if you do :))

Author Comment

ID: 10789562
I tried to change my windows name to my ip adres, but I can't put dots in the name from windows..
Just for clarification, PCXZ is the name of my pc at home.

Does really nobody knows this ? (and why is there a limit on 500 points...)
Comon guys..
LVL 13

Expert Comment

ID: 10897989
Hi themuppeteer,

Sorry for the late answer, but i was busy with some other questions.

I found a web site about properties used by JBoss :

For the "hosts" file, it should be in  C:\WINNT\system32\drivers\etc  for Windows 2000, and look like this: localhost PCXZ

You can also try to give another name than "PCXZ" to your computer.

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.


Author Comment

ID: 10898430
Thanks for the reply Webstorm,

I think I already tried that,

<quote>Then I've put PCXZ in the hosts file of the server hoping that it would somehow translate the name to an ip when I start jboss...foolish me</quote>

 but I'll cross check that again to make sure.
Guess its time take the dust of my application server and see if it still starts ;).

Author Comment

ID: 10921423
I have put that in the hosts file:    localhost    mypc

and changed the name of my pc from pcxz to mypc
,the client now says:
javax.naming.CommunicationException: Operation failed.  Root exception is java.n
et.UnknownHostException: mypc
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:143)
        at java.net.Socket.connect(Socket.java:425)

Any clues ?
LVL 13

Expert Comment

ID: 10921838
Try to run the ping command:

    ping mypc
LVL 13

Expert Comment

ID: 10921883
If you're using a proxy, you can try to run your application with this command:
    java -Dhttp.proxyHost=<proxyhost> -Dhttp.proxyPort=<proxyport> ...
where <proxyhost> and <proxyport> are your proxy configuration.


Author Comment

ID: 10925711
I'm not using a proxy,( unless windows xp is doing something behind my back ?)
Just my pc at home with windows xp, I also have zonealarm running but I put that of for the tests (before I start the application server that is).
I already tried to ping, it works on localhost but not  at client side (which is my whole problem).
If only my client would get the ip adres (which is pingable,I've tried), instead of the hostname of my pc, my probem would be solved I think.

I will try the proxy parameters with my ip and port filled in for proxyhost and port anyway, you never know...
LVL 13

Expert Comment

ID: 10931679
>> If only my client would get the ip adres (which is pingable,I've tried), instead of the hostname of my pc
Your client can't see your pc with its computer name unless it's on the same network domain.

You may need an internet server domain name like 'server.mypc.net', or, as you said, your client must use the IP address.

I found some related forums about this kind of problem :


According to:

you need to have a host file like this:        localhost.localdomain        localhost       mymachinename

just replace by the server ip and mymachinename by mypc

I hope this will work.

Author Comment

ID: 11057712
Hello WebStorm,

First of all sorry it took me so long to reply..
I've been on holiday for a week and very busy at work, so I havn't been able to continue my work on the application much.
I did make a helloWorld Client that loops and tries to connect over and over again and prints all the steps on screen, since I can't keep bothering people to test my client over the internet. The client is almost ready now.
I'll soon come back with more information...
Thnx for hanging on.

Best regards,

Author Comment

ID: 11084501
my client is finished so now I can do some serious tests.

It still doesnt work , not with the host file, and also not with the usehostname
to false.

Still the windows name is send to the client.

I have also been looking on the jboss site, but they all say the same (useHostName and change hosts file )..

Expert Comment

ID: 11200780
I am trying to understand here. The client is getting an IP address from JBoss? Can you post the code that raises the exception?

Author Comment

ID: 11200849
Hello vzilka,

The situation was as following: the client knew the ip address of the server, connected, found the home interface but when I did a create, I got an unknownhostexception in the client that mentioned the windows name of my server pc. I use did because since last week, the problem is solved. Apperantly the client must use a so called 'detached http invoker'. I don't know excactely how it works, I just know it works. It is solved on the jboss forum by mr Catalin Kormos
who had exactely the same problem but thought it was because he used jms.


and just to avoid people clicking this link in the future and getting a page not found, I'll post the answer here to, it is the jboss.xml file in your beans meta-inf directory:

(all credit to catalean who gave the solution)

Catalean: "I think You have to enable a HTTP detached invoker on your EJBs. You better search for more information about detached invokers in JBoss. I just found this example, i did't test it yet, but it seems to be the solution for your, and also, for my problem to. You have to modify your jboss.xml descriptor, and for each EJB you want to access over HTTP, specify the http detached invoker. Then you obtain the home interface of an EJB, looking up after the jndi name specified by the invoker binding, "helloworld/HelloHTTP". Hope it helps. "
<?xml version="1.0" encoding="UTF-8"?>
   "-//JBoss//DTD JBOSS 3.2//EN"


      <!-- A custom invoker for RMI/HTTP -->

(There was a small error in his code which catalean fixed in his thread, I posted the correct xml file)

Thanks a lot  all of you guys for hangin in.
I can continue my game now after 4 months of being stuck on this..

Very best regards,

Expert Comment

ID: 11200875
Congratulations ;-)
Sorry for not taking a part in this, I saw a discussion and didn't want to get in the middle of things...

Author Comment

ID: 11200910
No problem, you've been a great help to me already with the http stuff.
But I think you can always post in the middle of a discussion, the person in trouble (me in this case) will gladly answer both persons in order to get his problem solved. But then again, it might be polite to leave a fare chance for the points to the first one. Wich explains why you joined in after all.

Best regards,

Accepted Solution

Computer101 earned 0 total points
ID: 11518702
PAQed, with points refunded (500)

E-E Admin

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question