Glassfish won't start in debug mode on windows - java

asadmin start-domain --debug=true
JDK: jdk1.8.0_172
Payara: 4.1.2.181
produces the following output.
Waiting for domain1 to start ..Error starting domain domain1.
The server exited prematurely with exit code 2.
Before it died, it produced the following output:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=192m; support was removed in 8.0
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
Command start-domain failed.
The glassfish log file only contains this:
There are no additional clues as to why it cannot start in debug mode.
asadmin start-domain works just perfectly.
[2018-05-15T14:43:27.424+0200] [] [INFO] [NCLS-GFLAUNCHER-00005] [javax.enterprise.launcher] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1526388207424] [levelValue: 800] [[
JVM invocation command line:
C:\Program Files\Java\jdk1.8.0_172\bin\java.exe
-cp
C:/Java/payara41/glassfish/modules/glassfish.jar
-agentlib:jdwp=transport=dt_socket,address=9009,server=n,suspend=y
-XX:+UnlockDiagnosticVMOptions
-XX:NewRatio=2
-XX:MaxPermSize=192m
-Xmx512m
-javaagent:C:/Java/payara41/glassfish/lib/monitor/flashlight-agent.jar
-client
-Djavax.xml.accessExternalSchema=all
-Djavax.net.ssl.trustStore=C:\Java\payara41\glassfish\domains\domain1/config/cacerts.jks
-Djdk.tls.rejectClientInitiatedRenegotiation=true
-Djdk.corba.allowOutputStreamSubclass=true
-Dfelix.fileinstall.dir=C:\Java\payara41\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=C:\Java\payara41\glassfish
-Dfelix.fileinstall.poll=5000
-Djava.endorsed.dirs=C:\Java\payara41\glassfish/modules/endorsed;C:\Java\payara41\glassfish/lib/endorsed
-Djava.security.policy=C:\Java\payara41\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=C:\Java\payara41\glassfish\domains\domain1/config/keystore.jks
-Djava.security.auth.login.config=C:\Java\payara41\glassfish\domains\domain1/config/login.conf
-Dfelix.fileinstall.disableConfigSave=false
-Dorg.glassfish.grizzly.DEFAULT_MEMORY_MANAGER=org.glassfish.grizzly.memory.HeapMemoryManager
-Dfelix.fileinstall.bundles.new.start=true
-Dcom.sun.aas.instanceRoot=C:\Java\payara41\glassfish\domains\domain1
-Dosgi.shell.telnet.port=6666
-Dgosh.args=--nointeractive
-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as
-Dorg.jboss.weld.serialization.beanIdentifierIndexOptimization=false
-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=C:\Program Files\Java\jdk1.8.0_172/lib/ext;C:\Program Files\Java\jdk1.8.0_172/jre/lib/ext;C:\Java\payara41\glassfish\domains\domain1/lib/ext
-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver
-Djava.library.path=C:/Java/payara41/glassfish/lib;C:/Program Files (x86)/Common Files/Oracle/Java/javapath;C:/Windows/Sun/Java/bin;C:/Windows/System32;C:/Windows;C:/Utilities;C:/Program Files/Common Files/microsoft shared/Microsoft Online Services;C:/Program Files (x86)/Common Files/microsoft shared/Microsoft Online Services;C:/ProgramData/Oracle/Java/javapath;C:/Windows/System32/wbem;C:/Windows/System32/WindowsPowerShell/v1.0;C:/Program Files/Intel/WiFi/bin;C:/Program Files/Common Files/Intel/WirelessCommon;C:/ProgramData/chocolatey/bin;C:/Program Files/Beyond Compare 4;C:/Users/QXV0615/AppData/Local/Microsoft/WindowsApps;C:/Program Files/PortableGit/cmd;C:/Users/QXV0615/AppData/Local/hyper/app-2.0.0/resources/bin;C:/Program Files/Microsoft VS Code;C:/Java/payara41/bin;C:/Program Files/Java/jdk1.8.0_172/bin;C:/Java/apache-maven-3.5.3/bin;C:/Users/QXV0615/AppData/Local/Programs/Git/cmd;C:/Bin;C:/Program Files/PostgreSQL/10/bin;C:/Projects/mcp/mcp
com.sun.enterprise.glassfish.bootstrap.ASMain
-upgrade
false
-domaindir
C:/Java/payara41/glassfish/domains/domain1
-read-stdin
true
-asadmin-args
--host,,,localhost,,,--port,,,4848,,,--secure=false,,,--terse=false,,,--echo=false,,,--interactive=true,,,start-domain,,,--verbose=false,,,--watchdog=false,,,--debug=true,,,--domaindir,,,C:\Java\payara41\glassfish\domains,,,domain1
-domainname
domain1
-instancename
server
-type
DAS
-verbose
false
-asadmin-classpath
C:/Java/payara41/glassfish/lib/client/appserver-cli.jar
-debug
true
-asadmin-classname
com.sun.enterprise.admin.cli.AdminMain
-watchdog
false]]
any tips on how I should resolve this?
edit
I have discovered that the domain.xml configuration files for debug startup were different between my version 172 and 181 are different.
174:
<java-config classpath-suffix="" debug-options="-agentlib:jdwp=transport=dt_socket,address=9009,server=n,suspend=y" java-home="C:\Program Files\Java\jdk1.8.0_172" system-classpath="">
181:
<java-config classpath-suffix="" debug-options="-agentlib:jdwp=transport=dt_socket,address=9009,server=n,suspend=y" java-home="C:\Program Files\Java\jdk1.8.0_172" system-classpath="">
The server, suspend and java-home are different. The JDK path in the configuration file is correct.
They now both start, but why?

That looks like the ports used by Payara are already in use. The most likely reason for that is you already have a running instance of Payara which you haven't stopped.
You check what ports are in use by running netstat -ano.
Also, ensure that the startup options in domain.xml are correct. Some IDE's like Intelij Idea might change the options for local debugging - which break remote debugging. The options need to be restored.

Related

The server exited prematurely with exit code 1 on payara server4.1

I had a trouble when I start the payara server.
The console output is:
domain domain1. The server exited prematurely with exit code 1. Before
it died, it produced the following output:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option
MaxPermSize=192m; support was removed in 8.0 错误: 找不到或无法加载主类 Error:
Could not find or load main class2020.1.bin;
F:.Java.docdoku.payara41.glassfish.bin
com.sun.enterprise.glassfish.bootstrap.ASMain -upgrade false
-domaindir F:.Java.docdoku.payara41.glassfish.domains.domain1 -read-stdin true -asadmin-args --host,,,localhost,,,--port,,,4848,,,--secure=false,,,--terse=false,,,--echo=false,,,--interactive=true,,,start-domain,,,--verbose=false,,,--watchdog=false,,,--debug=false,,,--domaindir,,,
F:\Java\docdoku\payara41\glassfish\domains,,,domain1 -domainname
domain1 -instancename server -type DAS -verbose false
-asadmin-classpath
F:.Java.docdoku.payara41.glassfish.lib.client.appserver-cli.jar -debug
false -asadmin-classname com.sun.enterprise.admin.cli.AdminMain
-watchdog false
Command start-domain failed.
But I can start the server on eclipse.

Changing Tomcat logging not working as expected

I have a misbehaving application running under Tomcat on MSWindows. To set up the system to give better insight into what is failing, I am trying to add GC logging - but thus far my attempts have failed.
Initially I had set CATALINA_OPTS in setenv.bat - but these were ignored on restarting the service.
I then tried adding the options using Tomcat8w.exe :
-Xloggc:"C:\PerfLogs\gc-tomcat.log"
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=5M
-XX:+PrintGCDetails
-verbose:gc
-XX:+PrintGCDateStamps
-XX:+HeapDumpOnCtrlBreak
The service fails to start with "error 4". Event viewer shows:
The Apache Tomcat 8.0 Tomcat8 service terminated with the following service-specific error:
The system cannot open the file.
I have checked the path and the SYSTEM user has full control. There are no errors reports in the Tomcat stderr log - only a single entry:
Commons Daemon procrun stdout initialized
I see nothing being added to the other log files.
Removing the options above allows the service to start. Using the above config with the double quotes on the path has no impact. Creating the initial log file before starting the service has no impact.
How do I enable GC logging? How can I find out why this is currently failing?
(sadly, migrating to a more user friendly operating system is not an option).
Update
I found some more log entries - this time in common-daemon-YYYY-MM-DD.log:
[2018-08-29 11:04:52] [info] [ 4068] Running 'Tomcat8' Service...
[2018-08-29 11:04:52] [info] [ 2560] Starting service...
[2018-08-29 11:04:52] [error] [ 4200] CreateJavaVM Failed
[2018-08-29 11:04:52] [error] [ 4200] The system could not find the environment option that was entered.
[2018-08-29 11:04:52] [error] [ 2560] Failed to start Java
[2018-08-29 11:04:52] [error] [ 2560] ServiceStart returned 4
[2018-08-29 11:04:52] [info] [ 4068] Run service finished.
[2018-08-29 11:04:52] [info] [ 4068] Commons Daemon procrun finished
and, in case it is relevant:
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
After a good deal of digging around, I found that the MSWindows jvm is a apparently a second rate citizen in the Java world. According to the Oracle Documentation the MSWindows Java engine does not support log rotation. Removing the following options from the config allowed the JVM to start with GC logging:
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=10
-XX:GCLogFileSize=5M
Why this reported as "The system cannot open the file", I have no idea.
Now I just need to work out what happens when the log files fill up / how I prevent this.

JMX connection fails with "handshake failed...expected JDWP-Handshake"

I'm trying to connect VisualVM to a remote JMX. IntelliJ can connect without hassle, but VisualVM fails with the following in log output:
Listening for transport dt_socket at address: 5005
Debugger failed to attach: recv failed during handshake: Resource temporarily unavailable
Debugger failed to attach: handshake failed - received >< - expected >JDWP-Handshake<
Here are the JVM properties I'm passing at runtime:
-XX:MaxPermSize=50g -XX:+HeapDumpOnOutOfMemoryError -Xmx50g -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=100.100.100.100 -Dcom.sun.management.jmxremote.port=5006 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
Using VisualVM 1.3.9. Not sure why it fails why IntelliJ succeeds. I've tried disabling SSL auth, etc.
The socket listening on 5005 is not a JMX listener, it's the java debug wire protocol listener. As such, VisualVM will not be able to connect to that port, and that's why you're seeing a handshake failure.

GlassFish 4 error starting domain domain1 listening for transport dt_socket at address: 9009 Error: could not find or load main class files

I am trying to run GlassFish4 on Windows 7. At glassfish4\bin I run asadmin start-domain -d and I get the following error message:
Waiting for domain 1 to start. Error starting domain domain1. The
server exited prematurely with exit code 1.
Before it died, it produced the following output:
Listening for transport dt_socket at address: 9009 Error: could not
find or load main class files.
Command start-domain failed
I checked the PATH and CLASSPATH and things appear to be ok but obviously something is wrong here.
Can you try starting the domain without the -d flag? I think that is trying to it in debug mode. Port 9009 is not a standard GlassFish port but is for JPDA debugging, which also uses dt_socket as a transport.

Failed to start glassfish server because Couldn't get lock for /opt/glassfishv3/glassfish/domains/domain1/logs/server.log

admin#BRMSDEV:/opt/glassfishv3/glassfish/bin$ ./asadmin start-domain domain1
java.io.IOException: Couldn't get lock for /opt/glassfishv3/glassfish/domains/domain1/logs/server.log
at java.util.logging.FileHandler.openFiles(FileHandler.java:389)
at java.util.logging.FileHandler.<init>(FileHandler.java:287)
at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:85)
at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:148)
at com.sun.enterprise.admin.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:239)
at com.sun.enterprise.admin.cli.StartDomainCommand.runCommandNotEmbedded(StartDomainCommand.java:122)
at com.sun.enterprise.admin.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:117)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:257)
at com.sun.enterprise.admin.cli.AsadminMain.executeCommand(AsadminMain.java:229)
at com.sun.enterprise.admin.cli.AsadminMain.main(AsadminMain.java:167)
Waiting for DAS to start .Error starting domain: domain1.
The server exited prematurely with exit code 0.
Before it died, it produced the following output:
Warning: Cannot open log file: /opt/glassfishv3/glassfish/domains/domain1/logs/jvm.log
admin#BRMSDEV:/opt/glassfishv3/glassfish/bin$ ./asadmin start-domain domain1
java.io.IOException: Couldn't get lock for /opt/glassfishv3/glassfish/domains/domain1/logs/server.log
at java.util.logging.FileHandler.openFiles(FileHandler.java:389)
at java.util.logging.FileHandler.<init>(FileHandler.java:287)
at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:85)
at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:148)
at com.sun.enterprise.admin.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:239)
at com.sun.enterprise.admin.cli.StartDomainCommand.runCommandNotEmbedded(StartDomainCommand.java:122)
at com.sun.enterprise.admin.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:117)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:257)
at com.sun.enterprise.admin.cli.AsadminMain.executeCommand(AsadminMain.java:229)
at com.sun.enterprise.admin.cli.AsadminMain.main(AsadminMain.java:167)
Waiting for DAS to start .Error starting domain: domain1.
The server exited prematurely with exit code 0.
Before it died, it produced the following output:
Warning: Cannot open log file: /opt/glassfishv3/glassfish/domains/domain1/logs/jvm.log
Warning: Forcing option -XX:LogFile=/tmp/hs_pid2234.log
Jun 27, 2014 8:36:05 AM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on Felix platform
Jun 27, 2014 8:36:05 AM com.sun.enterprise.glassfish.bootstrap.ASMain main
SEVERE: the domain directory is not writable.
java.lang.RuntimeException: the domain directory is not writable.
at com.sun.enterprise.glassfish.bootstrap.ASMainHelper.verifyAndSetDomainRoot(ASMainHelper.java:233)
at com.sun.enterprise.glassfish.bootstrap.AbstractMain.run(AbstractMain.java:89)
at com.sun.enterprise.glassfish.bootstrap.ASMainOSGi.run(ASMainOSGi.java:71)
at com.sun.enterprise.glassfish.bootstrap.AbstractMain.start(AbstractMain.java:78)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:82)
Command start-domain failed.
I just installed glassfish in my host machine and changed the domain.xml with my host ip and started the server through the following command
./asadmin start-domain domain1
I got the above exceptions ,I am new to glassfish please help me out how to over come this issue ,
Thanks in advance
#dinesh
I had the same problem and changing the directory permissions solved that issue. Try this:
sudo chmod -R 777 /opt/glassfishv3/glassfish/
If you are using an ide like IntelliJ for example, you have to start the GlassFish Server inside the ide.
Looks like you don't have writing permissions to the folder /opt/glassfishv3/glassfish/domains/domain1/logs/ and / or file server.log
... and / or the folder / file doesn't exist.
Try sudo or change the folder's permission settings.

Categories

Resources