Navigation Bar

Sunday, March 7, 2010

Java handy tips

 start jbos

run.bat -b 0.0.0.0


shutdown you get errorr

when shutting down jboss server I am getting error Exception in thread "main" javax.naming.CommunicationException: Could not obtain  connection to any of these urls: localhost:1099 [Root exception is javax.naming .CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [R oot exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Co nnection refused: connect]]]         at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1763)


What This Error Means

The shutdown command tries to connect to localhost:1099 (JBoss JNDI port) to send a shutdown signal, but the connection is refused. This happens because:

  • JBoss is already stopped
  • JBoss didn't start properly / crashed
  • JBoss is bound to a different address (not localhost)
  • Port 1099 is blocked

Fix 1 — JBoss Bound to Different Address

If you started JBoss with -b 0.0.0.0 or a specific IP, the shutdown script must target that same IP:

# Windows

shutdown.bat -S -s jnp://YOUR_IP:1099


# Example

shutdown.bat -S -s jnp://192.168.1.10:1099


Force Kill if JBoss is Unresponsive

# Find the JBoss process
tasklist | findstr java

# Kill it by PID
taskkill /PID <pid_number> /F

# Find process
ps -ef | grep jboss

# Kill it
kill -9 <pid_number>

Check if Port 1099 is Listening
# Windows
netstat -ano | findstr :1099
# Linux
netstat -tulnp | grep 1099

 

To open a port in Windows XP

Option 1: Windows XP Built-in Firewall

  1. Go to Start → Control Panel → Network Connections
  2. Right-click your active network connection → Properties
  3. Click the Advanced tab
  4. Click Settings (under Windows Firewall)
  5. Go to Exceptions tab
  6. Click Add Port
  7. Fill in:
    • Name: JBoss
    • Port number: 9090
    • Select TCP
  8. Click OK

No comments:

Post a Comment