Sunday, July 29, 2012

Getting to work on MacOSX

If you use MacOSX and JBossAS, then you might have encountered this problem when using the tool:

$ bin/ 
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
The controller is not available at localhost:9999

Or you will get this:

$ bin/ --connect Failed to connect to the controller
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.jboss.modules.Main.main(
Caused by: The controller is not available at localhost:9999
... 8 more

It turns out this is bug on the JDK 1.7 that only appears on MacOSX JDK7! To be exact, I have the following: MacOSX 10.7.4 with JDK 1.7.0_05 and JBossAS 7.1.1.Final.

This problem has already been discovered by these posts:

Except after ready through all, and I can't still get it to work because no one listed a clear steps by steps solution. So I re-summarize it again. You need to use that bug's report workaround solution on both the server and client!

Start the server: 

$ bin/ 
18:37:22,555 INFO  [] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 1686ms - Started 133 of 208 services (74 services are passive or on-demand)

And on separate terminal, run the CLI:

$JAVA_OPTS="" bin/ --connect 
[standalone@localhost:9999 /] 

There, now we may continue to explore the cool JBossAS on the fancy OS.