2nrds.com
we dig technology
Programming
- The topics
Suggest an article
Have a good idea for an article? Something you want to know? Suggest an idea for an article and we just might write one for you.Problems with glassfish and Leopard
I work as a Java developer, and the project I’m currently working on is using NetBeans as the IDE. I’m currently running NetBeans 6.0 beta 2 with glassfish v2 b58g. It was running fine (except for the few times it uses 150% CPU while idling) until yesterday. Yesterday when I tried to start glassfish it refused to start because for some reason it used 192.168.2.1 as the IP address for my localhost, even though this is a static IP I use for my en0 ethernet port. Googling around, I found out that a few people were having the same problem and various edits to various xml-files were suggested. None of which worked.
I tried reinstalling NetBeans and glassfish, removing all the hidden config folders and files in my home directory — nothing worked. Having spent over 10 hours on the problem I was ready to give up and just install NetBeans in Ubuntu running Parallels to get the job done. While I was setting up NetBeans in Ubuntu I went to Sharing in System Preferences to enable file sharing so that I could transfer over files to my virtual machine and noticed that I still had internet sharing on from a few days back. Since I was sharing through my ethernet port I figured it was worth a shot to turn it off and try starting glassfish again. And sure enough, it worked! Wohoo!
I’m not sure if this affects users with older Mac OS X versions, but if you run into a similar problem, be sure to check that you have internet sharing turned off when running glassfish.
Below is the server log:
Starting Sun Java System Application Server 9.1 (build b58g-fcs) ...
MBeanServer started: com.sun.enterprise.interceptor.DynamicInterceptor
CORE5098: AS Socket Service Initialization has been completed.
CORE5076: Using [Java HotSpot(TM) Client VM, Version 1.5.0_13] from [Apple Inc.]
SEC1002: Security Manager is OFF.
/Applications/NetBeans/glassfish-v2b58g/domains/domain1/config/.__com_sun_appserv_pid
ADM0001:SunoneInterceptor is now enabled
SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
WEB0114: SSO is disabled in virtual server [server]
WEB0114: SSO is disabled in virtual server [__asadmin]
ADM1079: Initialization of AMX MBeans started
java.net.SocketException: Cannot allocate memory];_RequestID=c78a756d-396b-4de4-8eb7-007dec0a1c07;|Service com.sun.enterprise.admin.server.core.JmxConnectorLifecycle c8ca96 cannot be started! : com.sun.appserv.server.ServerLifecycleException: Cannot bind to URL [rmi://192.168.2.1:8686/management/rmi-jmx-connector]: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: Exception creating connection to: 192.168.2.1; nested exception is:
java.net.SocketException: Cannot allocate memory]
CORE5071: An error occured during initialization
com.sun.appserv.server.ServerLifecycleException: Cannot bind to URL [rmi://192.168.2.1:8686/management/rmi-jmx-connector]: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: Exception creating connection to: 192.168.2.1; nested exception is:
java.net.SocketException: Cannot allocate memory]
at com.sun.enterprise.admin.server.core.JmxConnectorLifecycle.onStartup(JmxConnectorLifecycle.java:153)
at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:442)
at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:120)
at com.sun.enterprise.server.PEMain.run(PEMain.java:411)
at com.sun.enterprise.server.PEMain.main(PEMain.java:338)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.server.PELaunch.main(PELaunch.java:412)
Caused by: java.io.IOException: Cannot bind to URL [rmi://192.168.2.1:8686/management/rmi-jmx-connector]: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: Exception creating connection to: 192.168.2.1; nested exception is:
java.net.SocketException: Cannot allocate memory]
at javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:814)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:431)
at com.sun.enterprise.admin.jmx.remote.server.rmi.JmxConnectorServerDriver.startConnectorServer(JmxConnectorServerDriver.java:218)
at com.sun.enterprise.admin.server.core.JmxConnectorLifecycle.onStartup(JmxConnectorLifecycle.java:134)
... 9 more
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: Exception creating connection to: 192.168.2.1; nested exception is:
java.net.SocketException: Cannot allocate memory]
at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:122)
at com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:208)
at javax.naming.InitialContext.bind(InitialContext.java:359)
at javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:635)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:427)
... 11 more
Caused by: java.rmi.ConnectIOException: Exception creating connection to: 192.168.2.1; nested exception is:
java.net.SocketException: Cannot allocate memory
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:587)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:116)
... 15 more
Caused by: java.net.SocketException: Cannot allocate memory
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.server.ss.provider.ASPlainSocketImpl$2.run(ASPlainSocketImpl.java:419)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.server.ss.provider.ASPlainSocketImpl._invoke(ASPlainSocketImpl.java:416)
at com.sun.enterprise.server.ss.provider.ASPlainSocketImpl.connect(ASPlainSocketImpl.java:288)
at com.sun.enterprise.server.ss.provider.ASClientSocketImpl.connect(ASClientSocketImpl.java:267)
at java.net.Socket.connect(Socket.java:520)
at java.net.Socket.connect(Socket.java:470)
at java.net.Socket.<init>(Socket.java:367)
at java.net.Socket.<init>(Socket.java:180)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
... 20 more
Server Startup failed. Exiting...
Server shutdown in progress...
WEB0303: Stopping Sun-Java-System/Application-Server.







The fix at my blog will also work: http://mcc-java.blogspot.com/
Bascially, glassfish is trying to do callbacks for the remote admin stuff on the wrong interface. It seems it varies by user, some people are having problems when using the wireless interface, some when ethernet is connected. Glassfish worked fine as long as I was connected via ethernet, as soon as I went wireless, it stopped working. Disabling the remote admin stuff does work per the blog.
Everything worked great for me with tiger, then I upgraded to leopard, and whamo.
I’m glad your fix worked as well.
thanks
Jonathan · Jan 28, 08:31 PM
Wow, I’ve also been having this problem. Thanks for posting this! Super weird issue, wonder what the underlying cause is?
Seemed to be random for me… normally it would work okay, then every so often I’d get the error. rebooting seemed to work for awhile.Anyway, glad I found this. Thanks again.
larry · Nov 13, 09:46 PM