Glassfish Server is not connected. Deploy is not available intelliJ

jsky picture jsky · May 10, 2015 · Viewed 13.4k times · Source

I don't know why, but my glassfish server wont connect anymore.
Last night i opened up Netbeans, and pointed it to same gf (homebrew), to look at example EE apps. I didnt even endup running them, just looked at code.
This was whilst i was working on a project in intelliJ where everything was working. Later it seemed that gf stopped connecting properly in my project in iJ. I made code changes but nothing that would stop the server starting.
I just created another blank EE project with GF server and i get the same result. Ive checked my hosts file:

127.0.0.1   localhost   computer.name
#127.0.0.1  ghconduit.com
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost 

My hostname for some reason is set to my computer/network name: 'computer.ispname`. This seemed to be a problem for me creating a project in Eclipse but when i moved to iJ it wasnt. But maybe it is again. I can ping and it seems to resolve fine:

  jm:~ jsky$ ping computer.name
    PING localhost (127.0.0.1): 56 data bytes
    64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.059 ms
    64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.060 ms

But not on port 4848:

Application Server was not connected before run configuration stop, reason: Unable to ping server at localhost:4848

lsof -i:4848
    jm:~ jsky$ ping localhost:4848
    ping: cannot resolve localhost:4848: Unknown host

When running:

jm:~ jsky$ lsof -i:4848
COMMAND  PID       USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
idea     941 jsky  105u  IPv4 0x45cc6637d4636f39      0t0  TCP localhost:50790->localhost:appserv-http (ESTABLISHED)
java    1449 jsky  379u  IPv6 0x45cc6637ce5b8619      0t0  TCP *:appserv-http (LISTEN)
java    1449 jsky  387u  IPv6 0x45cc6637ce5b5fd9      0t0  TCP localhost:appserv-http->localhost:50790 (ESTABLISHED)
jm:~ jsky$ ping localhost:4848
ping: cannot resolve localhost:4848: Unknown host

I had a publisher and subscriber working through a jms topic, and now the server doesnt start and i need to complete this assignment ASAP. Ive even tried restoring my machine to a previous snapshot with time machine and still get the same error. It tells me that there is another process using the same port 4848. But i dont know where (the extra) process is coming from. Any ideas? I am going to try starting on another domain once i workout how.

Startup log shows connections that i thought were correct:
Grizzly Framework 2.3.15 started in: 16ms - bound to [/0.0.0.0:4848]]]... Created HTTP listener admin-listener on host/port 0.0.0.0:4848|#]

Rest of startup log shows:

[2015-05-10T13:03:51.400+1000] [] [INFO] [NCLS-GFLAUNCHER-00005] [javax.enterprise.launcher] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1431227031400] [levelValue: 800] [[
  JVM invocation command line:
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java
-cp
/usr/local/Cellar/glassfish/4.1/libexec/glassfish/modules/glassfish.jar
-XX:+UnlockDiagnosticVMOptions
-XX:NewRatio=2
-XX:MaxPermSize=192m
-Xmx512m
-javaagent:/usr/local/Cellar/glassfish/4.1/libexec/glassfish/lib/monitor/flashlight-agent.jar
-client
-Djavax.xml.accessExternalSchema=all
-Djavax.net.ssl.trustStore=/usr/local/Cellar/glassfish/4.1/libexec/glassfish/domains/domain1/config/cacerts.jks
-Djdk.corba.allowOutputStreamSubclass=true
-Dfelix.fileinstall.dir=/usr/local/Cellar/glassfish/4.1/libexec/glassfish/modules/autostart/
-Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command,org.apache.felix.shell.remote,org.apache.felix.fileinstall
-Dcom.sun.aas.installRoot=/usr/local/Cellar/glassfish/4.1/libexec/glassfish
-Dfelix.fileinstall.poll=5000
-Djava.endorsed.dirs=/usr/local/Cellar/glassfish/4.1/libexec/glassfish/modules/endorsed:/usr/local/Cellar/glassfish/4.1/libexec/glassfish/lib/endorsed
-Djava.security.policy=/usr/local/Cellar/glassfish/4.1/libexec/glassfish/domains/domain1/config/server.policy
-Dosgi.shell.telnet.maxconn=1
-Dfelix.fileinstall.bundles.startTransient=true
-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory
-Dfelix.fileinstall.log.level=2
-Djavax.net.ssl.keyStore=/usr/local/Cellar/glassfish/4.1/libexec/glassfish/domains/domain1/config/keystore.jks
-Djava.security.auth.login.config=/usr/local/Cellar/glassfish/4.1/libexec/glassfish/domains/domain1/config/login.conf
-Dfelix.fileinstall.disableConfigSave=false
-Dfelix.fileinstall.bundles.new.start=true
-Dcom.sun.aas.instanceRoot=/usr/local/Cellar/glassfish/4.1/libexec/glassfish/domains/domain1
-Dosgi.shell.telnet.port=6666
-Dgosh.args=--nointeractive
-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as
-Dosgi.shell.telnet.ip=127.0.0.1
-DANTLR_USE_DIRECT_CLASS_LOADING=true
-Djava.awt.headless=true
-Dcom.ctc.wstx.returnNullForDefaultNamespace=true
-Djava.ext.dirs=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/ext:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext:/usr/local/Cellar/glassfish/4.1/libexec/glassfish/domains/domain1/lib/ext
-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver
-Djava.library.path=/usr/local/Cellar/glassfish/4.1/libexec/glassfish/lib:/Users/jsky/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:/usr/local/Cellar/glassfish/4.1/libexec/glassfish/bin
com.sun.enterprise.glassfish.bootstrap.ASMain
-upgrade
false
-domaindir
/usr/local/Cellar/glassfish/4.1/libexec/glassfish/domains/domain1
-read-stdin
true
-asadmin-args
[2015-05-10T13:03:59.919+1000] [glassfish 4.1] [INFO] [NCLS-LOGGING-00009] [javax.enterprise.logging] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1431227039604] [timeMillis: 1431227039919] [levelValue: 800] [[
  Running GlassFish Version: GlassFish Server Open Source Edition  4.1  (build 13)]]

[2015-05-10T13:03:59.931+1000] [glassfish 4.1] [INFO] [NCLS-LOGGING-00010] [javax.enterprise.logging] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1431227039604] [timeMillis: 1431227039931] [levelValue: 800] [[
  Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter]]

[2015-05-10T13:04:01.301+1000] [glassfish 4.1] [INFO] [NCLS-SECURITY-01115] [javax.enterprise.system.core.security] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227041301] [levelValue: 800] [[
  Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.]]

[2015-05-10T13:04:01.305+1000] [glassfish 4.1] [INFO] [NCLS-SECURITY-01115] [javax.enterprise.system.core.security] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227041305] [levelValue: 800] [[
  Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.]]

[2015-05-10T13:04:01.315+1000] [glassfish 4.1] [INFO] [NCLS-SECURITY-01115] [javax.enterprise.system.core.security] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227041315] [levelValue: 800] [[
  Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.]]

[2015-05-10T13:04:02.785+1000] [glassfish 4.1] [INFO] [SEC-SVCS-00100] [javax.enterprise.security.services] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227042785] [levelValue: 800] [[
  Authorization Service has successfully initialized.]]

[2015-05-10T13:04:03.045+1000] [glassfish 4.1] [INFO] [] [org.glassfish.ha.store.spi.BackingStoreFactoryRegistry] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227043045] [levelValue: 800] [[
  Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry]]

[2015-05-10T13:04:03.725+1000] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1431227039604] [timeMillis: 1431227043725] [levelValue: 800] [[
  Grizzly Framework 2.3.15 started in: 206ms - bound to [/0.0.0.0:8080]]]

[2015-05-10T13:04:03.865+1000] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1431227039604] [timeMillis: 1431227043865] [levelValue: 800] [[
  Grizzly Framework 2.3.15 started in: 4ms - bound to [/0.0.0.0:8181]]]

[2015-05-10T13:04:03.907+1000] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1431227039604] [timeMillis: 1431227043907] [levelValue: 800] [[
  Grizzly Framework 2.3.15 started in: 16ms - bound to [/0.0.0.0:4848]]]

[2015-05-10T13:04:04.058+1000] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227044058] [levelValue: 800] [[
  visiting unvisited references]]

[2015-05-10T13:04:04.143+1000] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1431227039604] [timeMillis: 1431227044143] [levelValue: 800] [[
  Grizzly Framework 2.3.15 started in: 8ms - bound to [/0.0.0.0:3700]]]

[2015-05-10T13:04:05.812+1000] [glassfish 4.1] [INFO] [NCLS-SECURITY-01002] [javax.enterprise.system.core.security] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227045812] [levelValue: 800] [[
  Java security manager is disabled.]]

[2015-05-10T13:04:05.813+1000] [glassfish 4.1] [INFO] [NCLS-SECURITY-01010] [javax.enterprise.system.core.security] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227045813] [levelValue: 800] [[
  Entering Security Startup Service.]]

[2015-05-10T13:04:05.833+1000] [glassfish 4.1] [INFO] [NCLS-SECURITY-01143] [javax.enterprise.system.core.security] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227045833] [levelValue: 800] [[
  Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.]]

[2015-05-10T13:04:06.489+1000] [glassfish 4.1] [INFO] [NCLS-SECURITY-01011] [javax.enterprise.system.core.security] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227046489] [levelValue: 800] [[
  Security Service(s) started successfully.]]

[2015-05-10T13:04:08.095+1000] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227048095] [levelValue: 800] [[
  Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080]]

[2015-05-10T13:04:08.112+1000] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227048112] [levelValue: 800] [[
  Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181]]

[2015-05-10T13:04:08.123+1000] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227048123] [levelValue: 800] [[
  Created HTTP listener admin-listener on host/port 0.0.0.0:4848]]

[2015-05-10T13:04:08.237+1000] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00200] [javax.enterprise.web] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227048237] [levelValue: 800] [[
  Created virtual server server]]

[2015-05-10T13:04:08.246+1000] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00200] [javax.enterprise.web] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227048246] [levelValue: 800] [[
  Created virtual server __asadmin]]

[2015-05-10T13:04:09.312+1000] [glassfish 4.1] [INFO] [AS-WEB-CORE-00306] [javax.enterprise.web.core] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227049312] [levelValue: 800] [[
  Setting JAAS app name glassfish-web]]

[2015-05-10T13:04:09.315+1000] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00201] [javax.enterprise.web] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227049315] [levelValue: 800] [[
  Virtual server server loaded default web module ]]

[2015-05-10T13:04:13.211+1000] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227053211] [levelValue: 800] [[
  visiting unvisited references]]

[2015-05-10T13:04:13.219+1000] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227053219] [levelValue: 800] [[
  visiting unvisited references]]

[2015-05-10T13:04:16.235+1000] [glassfish 4.1] [INFO] [] [javax.enterprise.resource.jms] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227056235] [levelValue: 800] [[
  addresslist.setjmsservice.provider]]

[2015-05-10T13:04:16.235+1000] [glassfish 4.1] [INFO] [] [javax.enterprise.resource.jms] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227056235] [levelValue: 800] [[
  jms.connection.url]]

[2015-05-10T13:04:17.390+1000] [glassfish 4.1] [INFO] [NCLS-JMX-00005] [javax.enterprise.system.jmx] [tid: _ThreadID=54 _ThreadName=Thread-13] [timeMillis: 1431227057390] [levelValue: 800] [[
  JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://computer.name:8686/jndi/rmi://computer.name:8686/jmxrmi]]

[2015-05-10T13:04:18.225+1000] [glassfish 4.1] [INFO] [] [org.hibernate.validator.internal.util.Version] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227058225] [levelValue: 800] [[
  HV000001: Hibernate Validator 5.0.0.Final]]

[2015-05-10T13:04:19.851+1000] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.monitor] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227059851] [levelValue: 800] [[
  Successfully got INSTRUMENTATION: sun.instrument.InstrumentationImpl@4017f2ce]]

[2015-05-10T13:04:20.140+1000] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227060140] [levelValue: 800] [[
  Grizzly Framework 2.3.15 started in: 2ms - bound to [/0.0.0.0:7676]]]

[2015-05-10T13:04:20.153+1000] [glassfish 4.1] [INFO] [] [javax.resourceadapter.mqjmsra.lifecycle] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227060153] [levelValue: 800] [[
  MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version:  5.1  (Build 9-b) Compile:  July 29 2014 1229]]

[2015-05-10T13:04:20.155+1000] [glassfish 4.1] [INFO] [] [javax.resourceadapter.mqjmsra.lifecycle] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227060155] [levelValue: 800] [[
  MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is EMBEDDED, connection mode is Direct]]

[2015-05-10T13:04:24.069+1000] [glassfish 4.1] [INFO] [] [javax.resourceadapter.mqjmsra.lifecycle] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1431227039629] [timeMillis: 1431227064069] [levelValue: 800] [[
  MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:EMBEDDED]]

And here is the log of the server failing to connect:

/usr/local/Cellar/glassfish/4.1/libexec/glassfish/bin/asadmin start-domain domain1
[2015-05-10 01:03:49,582] Artifact AdminAuditingConsole:war exploded: Server is not connected. Deploy is not available.
Detected server admin port: 4848
[2015-05-10 01:03:49,584] Artifact EEApp:war exploded: Server is not connected. Deploy is not available.
Detected server http port: 8080
Waiting for domain1 to start .......................................................................................................................................

Answer

jsky picture jsky · May 10, 2015

The domain.xml was most likely altered by Netbeans and no longer correct.
The solution was to first kill all processes using the admin port (4848) as @Jarrod Robertson's answer suggested, and then remove the domain (delete the whole folder) and remake it:
./asadmin create-domain domain1