Closed bartonhammond closed 1 year ago
To launch in debugging, you would just right-click the server and say "Run in Debug Mode", ie no jpda flags required on your part. They would be added automatically.
For all the settings of environment variables, yeah, you would need to convert those and migrate them over. An example of setting environment variables can be seen here: https://github.com/redhat-developer/rsp-server-community/issues/124#issuecomment-1124526784. For args and vm-args, you would need to just override the values in those fields and add what you want, as well as set the overrides flag to true instead of false.
For an example of what we actually run to start the server, we basically run the java command, with bin/bootstrap.jar and bin/tomcat-juli.jar on the classpath, executing the org.apache.catalina.startup.Bootstrap main type, with a whole bunch of arguments and vm arguments.
This is an example of the definition file we use to know how to download or start tomcat instances. A user can override some of the settings later by editing the server, but this file is essentially what the server-type looks like.
I updated with the values from "setenv.bat" : "args.vm.override.string": "-Dcatalina.base=\"C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC\" -Dcatalina.home=\"C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC\" -Dwtp.deploy=\"C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC\\webapps\" -Djava.endorsed.dirs=\"C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC\\endorsed\" -Dgov.mo.courts.env=dev-tomcat -Dcrowd.properties=\"C:\\ada\\crowd\\crowd-dev-registration.properties\" -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -XX:+UseSerialGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xms4096m -Xmx4096m -Dhttps.protocols=TLSv1.1,TLSv1.2 -Dcom.ibm.jsse2.overrideDefaultProtocol=SSL_TLSv2 -Dsmc.fileviewer.protocol=https:// -Dsmc.fileviewer.host=wwwdev.courts.mo.gov -Dsmc.fileviewer.path=/fv/s/fileviewer.do -Dgov.mo.courts.smc_deployment=dev -Dsmc.ws.access.salt=[B@55827 -Dsmc.ws.access.key=eLegalFileSafeKey -Dsmc.ws.access.algorithm=PBEWithMD5AndDES -Dsmc.ws.access.passphrase=eLegalPassPhrase -Dsmc.ws.access.casent.passphrase=CASENET -Dsmc.ws.access.pbw.passphrase=PBW -DLOG_ROOT=C:/smc -Dsmc.webservice.context-root=http://127.0.0.1:9080/smc-persistence-ws/ -Dsmc.security.properties=\"C:\\ada\\projects\\smc\\smc.security.properties\" -Dsmc.accesslogging.context-root=http://127.0.0.1:9080/smc-persistence-logging/ -Dsmcwarrant.context-root=http://127.0.0.1:9080/smc-warrant/ -Dsmc.accesslogging.cache-per-thread=10 -Dactivemq.failover.url=tcp://localhost:61616",
But the log only shows these command line arguments:
25-Aug-2023 08:10:02.194 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\ada\servers\tomcat\Tomcat_9.0.12_SMC/conf/logging.properties
25-Aug-2023 08:10:02.194 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
25-Aug-2023 08:10:02.195 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
25-Aug-2023 08:10:02.196 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
25-Aug-2023 08:10:02.197 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
25-Aug-2023 08:10:02.197 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\ada\servers\tomcat\Tomcat_9.0.12_SMC
25-Aug-2023 08:10:02.198 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=c:\ada\servers\tomcat\Tomcat_9.0.12_SMC
25-Aug-2023 08:10:02.198 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\ada\servers\tomcat\Tomcat_9.0.12_SMC/temp```
From the log: java.lang.IllegalArgumentException: Could not resolve placeholder 'gov.mo.courts.env' in value "classpath:log4j-smc-web-${gov.mo.courts.env}.xml"
- the environment variable is defined in args.vm.override.string
.
@robstryker I updated the Tomcat server settings but still the Tomcat log shows that the command line arguments are not correct. When I run from the command line, the Tomcat log shows all the command line arguments correctly.
I also tried setting the environment variables in the Command Prompt where I start VS Code because of this comment
I've made another commit today (not released yet though) that ensures that the vscode environment gets passed to the RSP server, which in turn should pass it to the tomcat or wildfly or whatever you're trying to launch. I think this issue is pretty well fixed now, and it should be in the next release. Good luck!
but that didn't work either
Here is my tomcat server settings
{
"args.override.boolean": "false",
"args.program.override.string": "start",
"args.shutdown.program.override.string": "stop",
"args.shutdown.vm.override.string": "",
"args.vm.override.string": "-Xms4096m,-Xmx4096m",
"id": "Tomcat 9.x",
"id-set": "true",
"mapProperty.launch.env": {
"-Dsmc.ws.access.salt": "[B@55827",
"-Dcatalina.base": "C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC",
"-Dcom.sun.management.jmxremote.authenticate": "false",
"-Dcom.sun.management.jmxremote": "true",
"-Dcom.sun.management.jmxremote.port": "9090",
"-Dcatalina.home": "C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC",
"-Dhttps.protocols": "TLSv1.1,TLSv1.2",
"-Dsmc.ws.access.pbw.passphrase": "PBW",
"-Dgov.mo.courts.env": "dev-tomcat",
"-Dactivemq.failover.url": "tcp://localhost:61616",
"-DLOG_ROOT": "C:/smc",
"-Dsmc.security.properties": "C:\\ada\\projects\\smc\\smc.security.properties",
"-Dwtp.deploy": "C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC\\webapps",
"-Dsmc.fileviewer.protocol": "https://",
"-Dsmc.ws.access.key": "eLegalFileSafeKey",
"-Dcom.ibm.jsse2.overrideDefaultProtocol": "SSL_TLSv2",
"-Dsmc.accesslogging.cache-per-thread": "10",
"-Dgov.mo.courts.smc_deployment": "dev",
"-Dsmc.accesslogging.context-root": "http://127.0.0.1:9080/smc-persistence-logging/",
"-Dsmc.webservice.context-root": "http://127.0.0.1:9080/smc-persistence-ws/",
"-Dsmc.ws.access.algorithm": "PBEWithMD5AndDES",
"-Dsmc.ws.access.passphrase": "eLegalPassPhrase",
"-Dsmc.ws.access.casent.passphrase": "CASENET",
"-Djava.endorsed.dirs": "C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC\\endorsed",
"-Dcrowd.properties": "C:\\ada\\crowd\\crowd-dev-registration.properties",
"-Dcom.sun.management.jmxremote.ssl": "false",
"-Dsmc.fileviewer.host": "wwwdev.courts.mo.gov",
"-Dsmc.fileviewer.path": "/fv/s/fileviewer.do",
"-Dsmcwarrant.context-root": "http://127.0.0.1:9080/smc-warrant/"
},
"org.jboss.tools.rsp.server.typeId": "org.jboss.ide.eclipse.as.server.tomcat.90",
"server.base.dir": "C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC",
"server.classpath.additions": "",
"server.deploy.dir": "${server.base.dir}/webapps/",
"server.home.dir": "c:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC",
"server.http.host": "localhost",
"server.http.port": "8080",
"vm.install.path": "C:\\ada\\java\\1.8\\u172\\x64",
"deployables": {
"c:\\cypress\\smc\\smc-web\\target\\smc-web": {
"label": "c:\\cypress\\smc\\smc-web\\target\\smc-web",
"path": "c:\\cypress\\smc\\smc-web\\target\\smc-web",
"options": {}
},
"c:\\cypress\\smc\\smc-persistence-ws\\target\\smc-persistence-ws": {
"label": "c:\\cypress\\smc\\smc-persistence-ws\\target\\smc-persistence-ws",
"path": "c:\\cypress\\smc\\smc-persistence-ws\\target\\smc-persistence-ws",
"options": {}
}
}
}
And this was reported by Tomcat log:
25-Aug-2023 09:28:48.540 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\ada\servers\tomcat\Tomcat_9.0.12_SMC/conf/logging.properties
25-Aug-2023 09:28:48.540 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
25-Aug-2023 09:28:48.540 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
25-Aug-2023 09:28:48.540 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
25-Aug-2023 09:28:48.540 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
25-Aug-2023 09:28:48.541 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\ada\servers\tomcat\Tomcat_9.0.12_SMC
25-Aug-2023 09:28:48.541 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=c:\ada\servers\tomcat\Tomcat_9.0.12_SMC
25-Aug-2023 09:28:48.541 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\ada\servers\tomcat\Tomcat_9.0.12_SMC/temp
Community Server Connector is v0.26.13
First, change args.override.boolean
to true.
Second, you have made a large error in that you have added your VM arguments (-DsomeKey=someVal) to the environment variable map. They should not be in the environment variable map, they should be in the vm arguments field.
Change args.vm.override.string
to -Xms4096m -Xmx4096m -DsomeKey=someVal
etc etc etc
Thanks for all the help! :)
I had tried that approach initially but didn't update the args.override.boolean
.
Still can't get Tomcat to start but I am getting much closer.
Comparing the logs between starting from the command line vs VS Code, there are just a few lines different at the end
This is the tail from running from command prompt"
:57 CDT 2023]; parent: Root WebApplicationContext
2023-08-25 10:20:12,359 [main] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'springmvc': initialization completed in 15013 ms
<Note: I don't see the following line in VS Code>
25-Aug-2023 10:20:12.369 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\ada\servers\tomcat\Tomcat_9.0.12_SMC\webapps\ROOT]
<Note: I see this following line in vs code>
25-Aug-2023 10:20:12.372 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement No rules found matching 'Context/Context'.
<Note: the following lines aren't in VS code either>
25-Aug-2023 10:20:12.952 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
25-Aug-2023 10:20:12.959 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\ada\servers\tomcat\Tomcat_9.0.12_SMC\webapps\ROOT] has finished in [590] ms
25-Aug-2023 10:20:12.962 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-9080"]
25-Aug-2023 10:20:12.972 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8014"]
25-Aug-2023 10:20:12.977 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 93165 ms
here's from VS Code Output
WebApplicationContext for namespace 'springDispatcher-servlet': startup date [Fri Aug 25 10:16:51 CDT 2023]; parent: Root
WebApplicationContext
2023-08-25 10:17:08,162 [main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Detected @InitBinder methods in
globalBindingInitializer
2023-08-25 10:17:08,208 [main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for @ControllerAdvice:
WebApplicationContext for namespace 'springDispatcher-servlet': startup date [Fri Aug 25 10:16:51 CDT 2023]; parent: Root
WebApplicationContext
2023-08-25 10:17:08,211 [main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Detected @InitBinder methods in
globalBindingInitializer
2023-08-25 10:17:08,689 [main] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'springDispatcher':
initialization completed in 17542 ms
Aug 25, 2023 10:17:08 AM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'Context/Context'.
I don't see anything else in the logs that explains why the App was not deployed.
Have you verified that your deloyment is actually inside C:\ada\servers\tomcat\Tomcat_9.0.12_SMC\webapps ?
I am not sure off the top of my head whether we publish when you start a server, or only after. You might check to make sure the deployment actually exists.
We deploy to webapps
and then Tomcat copies it to work\Catalina\localhost
.
I can start TC from the command line now, with startup.bat
. All I'm doing w/ VS Code is "Start Server".
I do have the Web Application logs - it looks like things are fine and then it just stops. I verified that the server.http.port
is 9080
and the server.http.host
is localhost
. I saw elsewhere that the port
had to be defined if not 8080
.
Here's my Tomcat settings file.
{
"args.override.boolean": "true",
"args.program.override.string": "start",
"args.shutdown.program.override.string": "stop",
"args.shutdown.vm.override.string": "",
"args.vm.override.string": "-Dcatalina.base=\"C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC\" -Dcatalina.home=\"C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC\" -Dwtp.deploy=\"C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC\\webapps\" -Djava.endorsed.dirs=\"C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC\\endorsed\" -Dgov.mo.courts.env=dev-tomcat -Dcrowd.properties=\"C:\\ada\\crowd\\crowd-dev-registration.properties\" -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -XX:+UseSerialGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xms4096m -Xmx4096m -Dhttps.protocols=TLSv1.1,TLSv1.2 -Dcom.ibm.jsse2.overrideDefaultProtocol=SSL_TLSv2 -Dsmc.fileviewer.protocol=https:// -Dsmc.fileviewer.host=wwwdev.courts.mo.gov -Dsmc.fileviewer.path=/fv/s/fileviewer.do -Dgov.mo.courts.smc_deployment=dev -Dsmc.ws.access.salt=[B@55827 -Dsmc.ws.access.key=eLegalFileSafeKey -Dsmc.ws.access.algorithm=PBEWithMD5AndDES -Dsmc.ws.access.passphrase=eLegalPassPhrase -Dsmc.ws.access.casent.passphrase=CASENET -Dsmc.ws.access.pbw.passphrase=PBW -DLOG_ROOT=C:/smc -Dsmc.webservice.context-root=http://127.0.0.1:9080/smc-persistence-ws/ -Dsmc.security.properties=\"C:\\ada\\projects\\smc\\smc.security.properties\" -Dsmc.accesslogging.context-root=http://127.0.0.1:9080/smc-persistence-logging/ -Dsmcwarrant.context-root=http://127.0.0.1:9080/smc-warrant/ -Dsmc.accesslogging.cache-per-thread=10 -Dactivemq.failover.url=tcp://localhost:61616 ",
"id": "Tomcat 9.x",
"id-set": "true",
"org.jboss.tools.rsp.server.typeId": "org.jboss.ide.eclipse.as.server.tomcat.90",
"server.base.dir": "C:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC",
"server.classpath.additions": "",
"server.deploy.dir": "${server.base.dir}/webapps/",
"server.home.dir": "c:\\ada\\servers\\tomcat\\Tomcat_9.0.12_SMC",
"server.http.host": "localhost",
"server.http.port": "9080",
"vm.install.path": "C:\\ada\\java\\1.8\\u172\\x64",
"deployables": {
"c:\\cypress\\smc\\smc-web\\target\\smc-web": {
"label": "c:\\cypress\\smc\\smc-web\\target\\smc-web",
"path": "c:\\cypress\\smc\\smc-web\\target\\smc-web",
"options": {}
},
"c:\\cypress\\smc\\smc-persistence-ws\\target\\smc-persistence-ws": {
"label": "c:\\cypress\\smc\\smc-persistence-ws\\target\\smc-persistence-ws",
"path": "c:\\cypress\\smc\\smc-persistence-ws\\target\\smc-persistence-ws",
"options": {}
}
}
}
Also - this is Tomcat 9.0.12
Changed server.http.host
from localhost
to 127.0.0.1
Thanks @robstryker for all your help! Very much appreciated...
Working on Windows, I run Tomcat 9 from the command line with "bin\startup.bat" which runs "setenv.bat" that contains all the settings.
Using the connector, do I copy all my settings to the
args.vm.override.string
? How does this start a locally installed Tomcat server - does it run "startup.bat" or install the tomcat service? How do I set the JPDA options for debugging?Is there detailed documentation that describes how to migrate from command line to this connector to start in debug mode?