JBoss socket connection problem

Hello there
I made a servlet that load on server startup and accept socket connections through an applet.
Problem is that this works fine in Tomcat but in Jboss this is not working. Applet shows Connection refused exception.
To my mind, This can happen for two reasons. First Jboss does not allow socket connection as i have done nothing in jBoss configuration for socket connections. Second servlet does not load on Jboss start up. For this I am using same web.xml which i use in tomcat.
Please guide.
LVL 1
tripatAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

visorxCommented:
Since you have moved from tomcat to Jboss I'll suggest to check the codebase url including port. Applet is allowed to communicate to the server from which it originated. If this doesn't help then a full stacktrace of the exception will help to solve this.
Cheers,
0
tripatAuthor Commented:
Hello visorx
I managed to make it work on jboss. now i am facing another problem and that is related to socket connection. Applet does connect with servlet on localhost but do not connect on servlet at server. it gives Connecion time out exception. Please see the stacktrace below. Even on locahost if use url https://localhost:port/webapp it works. but if i use url https://ipaddress:port/webapp it gives following exception.
Thanks for your reply and please guide me.
java.net.ConnectException: Connection timed out: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.<init>(Unknown Source)
	at java.net.Socket.<init>(Unknown Source)
	at MonitorApplet.getDateUsingSocketText(MonitorApplet.java:225)
	at MonitorApplet.refresh(MonitorApplet.java:217)
	at MonitorApplet.run(MonitorApplet.java:183)
	at java.lang.Thread.run(Unknown Source)

Open in new window

0
visorxCommented:
Uh ho.. if you are using raw socket connection to connect to server in applet code then you are bound to run into problems. I'd recommend to use HTTP to connect to server rather than raw socket. So instead of using plain java.net.Socket, you can use, java.net.URL and java.net.URLConnection. This will help you in long run, as most (I can say 99%) Firewalls will allow HTTP but will block plain socket.
Now as to why localhost works but IP address fails, there can be one of the two reasons, first is that for localhost, you'll not need proxy, but if you used IP address then  your java code is not able to resolve the IP without proxy, second is Firewalls simply don't care for connection coming from and to localhost, as they make sure that host entry for localhost does loop back to same machine. (hosts file on windows box).
Anyways I'd strongly recommend to not use plain socket code in applet.
Hope this helps,
Cheers
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ramazanyichCommented:
jboss starting from version4.2 is binding by default only to localhost.
If you want that jboss binds to all ip addresses n your machine start jboss like that:
on windows:
>run.bat -b 0.0.0.0
on unix:
>run.sh -b 0.0.0.0
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java App Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.