JBoss socket connection problem

Posted on 2008-11-15
Last Modified: 2013-12-02
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.
Question by:tripat
    LVL 1

    Expert Comment

    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.
    LVL 1

    Author Comment

    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. Connection timed out: connect
    	at Method)
    	at Source)
    	at Source)
    	at Source)
    	at Source)
    	at Source)
    	at Source)
    	at<init>(Unknown Source)
    	at<init>(Unknown Source)
    	at MonitorApplet.getDateUsingSocketText(
    	at MonitorApplet.refresh(
    	at Source)

    Open in new window

    LVL 1

    Accepted Solution

    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, you can use, and 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,
    LVL 19

    Expert Comment

    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
    on unix:
    > -b

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Suggested Solutions

    Title # Comments Views Activity
    dividesSelf challange 15 57
    sumHeights2  challenge 7 50
    json example 39 76
    pairs challenge 5 28
    Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now