Closed zayne-wang closed 2 years ago
After changing the "args.override.boolean"
from false
to true
, it works to start the tomcat instance, but when I stop the server, the error below was reported:
Configuration error
java.io.FileNotFoundException: /opt/apache-tomcat-9.0.58/conf/logging.properties (Permission denied)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:490)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:328)
at java.logging/java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:445)
at java.logging/java.util.logging.LogManager$2.run(LogManager.java:394)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.logging/java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:382)
at java.logging/java.util.logging.LogManager.getLogManager(LogManager.java:430)
at java.logging/java.util.logging.Logger.demandLogger(Logger.java:648)
at java.logging/java.util.logging.Logger.getLogger(Logger.java:717)
at java.logging/java.util.logging.Logger.getLogger(Logger.java:701)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:61)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:181)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:133)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:156)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:211)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:50)
Feb 28, 2022 3:32:40 PM org.apache.catalina.startup.Catalina parseServerXml
WARNING: Unable to load server configuration from [/opt/apache-tomcat-9.0.58/conf/server.xml]
java.io.FileNotFoundException: /opt/apache-tomcat-9.0.58/conf/server.xml (Permission denied)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getResource(CatalinaBaseConfigurationSource.java:118)
at org.apache.tomcat.util.file.ConfigurationSource.getConfResource(ConfigurationSource.java:150)
at org.apache.tomcat.util.file.ConfigurationSource.getServerXml(ConfigurationSource.java:127)
at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getServerXml(CatalinaBaseConfigurationSource.java:52)
at org.apache.catalina.startup.Catalina.parseServerXml(Catalina.java:606)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:648)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:391)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:481)
Feb 28, 2022 3:32:40 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Error stopping Catalina
It seems like the catalina_base environment was ignored again, and I could only stop the server manually. Does anyone know how to define the action when stop the server? Thanks a lot!
What is the connection between the 2 machines ? Your server definition specifies a java.util.logging.config.file but it not the one used when starting the server ?
What is the connection between the 2 machines ? Your server definition specifies a java.util.logging.config.file but it not the one used when starting the server ?
Hi Jeff, what's your meaning of connection between the 2 machines? Do you mean if these 2 machines are under the same network? (or anything else, could you please give me any examples?) These two machines are under the same network, and could connect to each other using IP address.
When the server config like below, it could start the tomcat server correctly, but stop it incorrectly. and output the configuration error.
{
"args.override.boolean": "true",
"args.program.override.string": "start",
"args.vm.override.string": "-Djava.util.logging.config.file=/home/user1/tomcat_vscode/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dcatalina.base=/home/user1/tomcat_vscode -Dcatalina.home=/opt/apache-tomcat-9.0.58 -Djava.io.tmpdir=/home/user1/tomcat_vscode/temp",
"id": "Tomcat 9.0.58",
"id-set": "true",
"org.jboss.tools.rsp.server.typeId": "org.jboss.ide.eclipse.as.server.tomcat.90",
"server.deploy.dir": "webapps/",
"server.home.dir": "/opt/apache-tomcat-9.0.58",
"server.http.port": "8080"
}
I'm trying to understand what is the remote server ? what is the local machine ?
I'm trying to understand what is the remote server ? what is the local machine ?
Maybe my description is not very clear.
The remote server is a debian machine that has the develop environment (such as jdk, tomcat etc.). This server is used to compile and debug.
The local machine is another machine that only has the vscode with plugins. When I want to design software, I used the Remote-SSH plugin in vscode to connect to my remote server, and use the environment on that machine to save my codes, compile my codes etc.
Hope this desciption will be more clear.
Can you share the Tomcat log that is displayed when stopping the server ?
Can you share the Tomcat log that is displayed when stopping the server ?
These are the logs when starting the server, it could start the instance in /home/user1/tomcat_vscode
:
01-Mar-2022 10:29:08.656 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.58
01-Mar-2022 10:29:08.674 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jan 15 2022 14:37:38 UTC
01-Mar-2022 10:29:08.675 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.58.0
01-Mar-2022 10:29:08.677 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
01-Mar-2022 10:29:08.678 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.19.0-18-amd64
01-Mar-2022 10:29:08.679 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
01-Mar-2022 10:29:08.679 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /opt/java/jdk-11.0.14
01-Mar-2022 10:29:08.679 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 11.0.14+8-LTS-263
01-Mar-2022 10:29:08.679 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
01-Mar-2022 10:29:08.679 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/user1/tomcat_vscode
01-Mar-2022 10:29:08.679 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /opt/apache-tomcat-9.0.58
01-Mar-2022 10:29:08.690 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/user1/tomcat_vscode/conf/logging.properties
01-Mar-2022 10:29:08.692 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
01-Mar-2022 10:29:08.695 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
01-Mar-2022 10:29:08.696 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
01-Mar-2022 10:29:08.697 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
01-Mar-2022 10:29:08.697 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/user1/tomcat_vscode
01-Mar-2022 10:29:08.697 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/apache-tomcat-9.0.58
01-Mar-2022 10:29:08.697 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/user1/tomcat_vscode/temp
01-Mar-2022 10:29:08.700 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
01-Mar-2022 10:29:09.209 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
01-Mar-2022 10:29:09.251 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [865] milliseconds
01-Mar-2022 10:29:09.325 SEVERE [main] org.apache.catalina.users.MemoryUserDatabase.open The specified user database [conf/tomcat-users.xml] could not be found
01-Mar-2022 10:29:09.328 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
01-Mar-2022 10:29:09.329 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.58]
01-Mar-2022 10:29:09.346 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/user1/tomcat_vscode/webapps/docs]
01-Mar-2022 10:29:09.481 INFO [main] org.apache.catalina.startup.ContextConfig.getDefaultWebXmlFragment No global web.xml found
01-Mar-2022 10:29:09.615 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/user1/tomcat_vscode/webapps/docs] has finished in [268] ms
01-Mar-2022 10:29:09.616 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/user1/tomcat_vscode/webapps/host-manager]
01-Mar-2022 10:29:09.699 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/user1/tomcat_vscode/webapps/host-manager] has finished in [83] ms
01-Mar-2022 10:29:09.700 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/user1/tomcat_vscode/webapps/manager]
01-Mar-2022 10:29:09.737 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/user1/tomcat_vscode/webapps/manager] has finished in [37] ms
01-Mar-2022 10:29:09.739 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/user1/tomcat_vscode/webapps/examples]
01-Mar-2022 10:29:10.050 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/user1/tomcat_vscode/webapps/examples] has finished in [311] ms
01-Mar-2022 10:29:10.055 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/user1/tomcat_vscode/webapps/ROOT]
01-Mar-2022 10:29:10.075 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/user1/tomcat_vscode/webapps/ROOT] has finished in [20] ms
01-Mar-2022 10:29:10.082 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
01-Mar-2022 10:29:10.122 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [869] milliseconds
From the log, I could see that the CATALINA_BASE is recognised correctly.
When stopping the server, see the logs below:
Configuration error
java.io.FileNotFoundException: /opt/apache-tomcat-9.0.58/conf/logging.properties (Permission denied)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:490)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:328)
at java.logging/java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:445)
at java.logging/java.util.logging.LogManager$2.run(LogManager.java:394)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.logging/java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:382)
at java.logging/java.util.logging.LogManager.getLogManager(LogManager.java:430)
at java.logging/java.util.logging.Logger.demandLogger(Logger.java:648)
at java.logging/java.util.logging.Logger.getLogger(Logger.java:717)
at java.logging/java.util.logging.Logger.getLogger(Logger.java:701)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:61)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:181)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:133)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:156)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:211)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:50)
Mar 01, 2022 10:29:16 AM org.apache.catalina.startup.Catalina parseServerXml
WARNING: Unable to load server configuration from [/opt/apache-tomcat-9.0.58/conf/server.xml]
java.io.FileNotFoundException: /opt/apache-tomcat-9.0.58/conf/server.xml (Permission denied)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getResource(CatalinaBaseConfigurationSource.java:118)
at org.apache.tomcat.util.file.ConfigurationSource.getConfResource(ConfigurationSource.java:150)
at org.apache.tomcat.util.file.ConfigurationSource.getServerXml(ConfigurationSource.java:127)
at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getServerXml(CatalinaBaseConfigurationSource.java:52)
at org.apache.catalina.startup.Catalina.parseServerXml(Catalina.java:606)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:648)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:391)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:481)
Mar 01, 2022 10:29:16 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Error stopping Catalina
From the error logs, I could see the plugin send a stop request to stop the server in /opt/apache-tomcat-9.0.58
directory, but not the instance started from /home/user1/tomcat_vscode
.
However, I could stop the Tomcat Server manually with using command catalina stop
in the shell. This command is called WITHOUT the root permission, and the output is:
user1@localhost:~$ catalina stop
Using CATALINA_BASE: /home/user1/tomcat_vscode
Using CATALINA_HOME: /opt/apache-tomcat-9.0.58
Using CATALINA_TMPDIR: /home/user1/tomcat_vscode/temp
Using JRE_HOME: /opt/java/jdk-11.0.14
Using CLASSPATH: /opt/apache-tomcat-9.0.58/bin/bootstrap.jar:/home/user1/tomcat_vscode/bin/tomcat-juli.jar
Using CATALINA_OPTS:
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
user1@localhost:~$
Can you send the log when the server is stopped because there are useful informations and I cannot reproduce in my env
Can you send the log when the server is stopped because there are useful informations and I cannot reproduce in my env
Hi Jeff, these are the logs showed on my screen when stopping the server:
Configuration error
java.io.FileNotFoundException: /opt/apache-tomcat-9.0.58/conf/logging.properties (Permission denied)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:490)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:328)
at java.logging/java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:445)
at java.logging/java.util.logging.LogManager$2.run(LogManager.java:394)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.logging/java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:382)
at java.logging/java.util.logging.LogManager.getLogManager(LogManager.java:430)
at java.logging/java.util.logging.Logger.demandLogger(Logger.java:648)
at java.logging/java.util.logging.Logger.getLogger(Logger.java:717)
at java.logging/java.util.logging.Logger.getLogger(Logger.java:701)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:61)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:181)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:133)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:156)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:211)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:50)
Mar 01, 2022 10:29:16 AM org.apache.catalina.startup.Catalina parseServerXml
WARNING: Unable to load server configuration from [/opt/apache-tomcat-9.0.58/conf/server.xml]
java.io.FileNotFoundException: /opt/apache-tomcat-9.0.58/conf/server.xml (Permission denied)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getResource(CatalinaBaseConfigurationSource.java:118)
at org.apache.tomcat.util.file.ConfigurationSource.getConfResource(ConfigurationSource.java:150)
at org.apache.tomcat.util.file.ConfigurationSource.getServerXml(ConfigurationSource.java:127)
at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getServerXml(CatalinaBaseConfigurationSource.java:52)
at org.apache.catalina.startup.Catalina.parseServerXml(Catalina.java:606)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:648)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:391)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:481)
Mar 01, 2022 10:29:16 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Error stopping Catalina
If these are not the logs that you want, please tell me the file location so that I could show that. Thanks!
Can you send the log when the server is stopped because there are useful informations and I cannot reproduce in my env
Hi Jeff, I read the source code of this project, and find something interesting in the code. Maybe this is the reason:
between line 259 to 300 in the code, it only mentioned a variable {server.home.dir}, and this is the same for Dcatalina.home and Dcatalina.base params.
However, sometimes, the CATALINA_HOME and CATALINA_BASE are not the same, according to the tomcat official document Why_Use_CATALINA_BASE
Therefore, as there is no seperate params of the CATALINA_HOME and CATALINA_BASE variables, no matter how the catalina base was set, the variable will be ignored during stop, as there is no way to determine the action for stopping a server, but just custom the action when start the server.
Is this a useful info for enhancing the code? Thanks for your reply.
I'm running into a different issue with a similar cause- I need to use separate CATALINA_HOME and CATALINA_BASE variables. Is this already supported, or will it eventually be supported?
Actually, I just found this closed issue from 2020 that addresses how to have separate CATALINA_HOME and CATALINA_BASE variables. I'm not sure if this will help you, @N0nePointerException, but it was what I needed.
@jeffmaury Could this be added to docs somewhere? Or is it already somewhere in the docs, and I just didn't see it? Having separate variables is a pretty common situation for a lot of workflows.
@robstryker wdyt?
Actually, I just found this closed issue from 2020 that addresses how to have separate CATALINA_HOME and CATALINA_BASE variables. I'm not sure if this will help you, @N0nePointerException, but it was what I needed.
@jeffmaury Could this be added to docs somewhere? Or is it already somewhere in the docs, and I just didn't see it? Having separate variables is a pretty common situation for a lot of workflows.
@arielrezinn
Hi Ariel,
I followed the solution in the closed issue, but not work. During starting the server, everything is OK, but when stopping the server, the extension still seek for the ${server.home.dir} path, but not followed my settings. If there any recommandation or anything wrong in my config from your side?
{
"args.override.boolean": "true",
"args.program.override.string": "start",
"args.vm.override.string": "-Djava.util.logging.config.file=/home/user1/.tomcat-vscode/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dcatalina.base=/home/user1/.tomcat-vscode -Dcatalina.home=/opt/apache-tomcat-9.0.62 -Djava.io.tmpdir=/home/user1/.tomcat-vscode/temp",
"id": "Tomcat 9.x",
"id-set": "true",
"org.jboss.tools.rsp.server.typeId": "org.jboss.ide.eclipse.as.server.tomcat.90",
"server.deploy.dir": "webapps/",
"server.home.dir": "/opt/apache-tomcat-9.0.62",
"server.http.port": "8080"
}
Configuration error
java.io.FileNotFoundException: /opt/apache-tomcat-9.0.62/conf/logging.properties (Permission denied)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:488)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:325)
at java.util.logging.LogManager$3.run(LogManager.java:399)
at java.util.logging.LogManager$3.run(LogManager.java:396)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:396)
at java.util.logging.LogManager.access$800(LogManager.java:145)
at java.util.logging.LogManager$2.run(LogManager.java:345)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
at java.util.logging.LogManager.getLogManager(LogManager.java:378)
at java.util.logging.Logger.demandLogger(Logger.java:448)
at java.util.logging.Logger.getLogger(Logger.java:502)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:61)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:181)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:133)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:156)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:211)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:50)
Apr 19, 2022 9:32:30 PM org.apache.catalina.startup.Catalina parseServerXml
WARNING: Unable to load server configuration from [/opt/apache-tomcat-9.0.62/conf/server.xml]
java.io.FileNotFoundException: /opt/apache-tomcat-9.0.62/conf/server.xml (Permission denied)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getResource(CatalinaBaseConfigurationSource.java:118)
at org.apache.tomcat.util.file.ConfigurationSource.getConfResource(ConfigurationSource.java:150)
at org.apache.tomcat.util.file.ConfigurationSource.getServerXml(ConfigurationSource.java:127)
at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getServerXml(CatalinaBaseConfigurationSource.java:52)
at org.apache.catalina.startup.Catalina.parseServerXml(Catalina.java:606)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:648)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:391)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:481)
Apr 19, 2022 9:32:30 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Error stopping Catalina
@jeffmaury @robstryker Could you please help to see anywrong in my settings below? Maybe I misunderstand the solution or anything else. Just as Ariel said, "Having separate variables is a pretty common situation for a lot of workflows." Thanks in advance! I really like this extension, and hope it will be more widely spreaded in the future!
If more info is required for helping solving this issue, please tell me the path of the desired file, or the way to get the info
Folder structure and privileges followed the official Tomcat suggestion: Please see Advanced Configuration - Multiple Tomcat Instances section in RUNNING.txt for folder structure; and Non-Tomcat settings section in Apache Tomcat 9 (9.0.62 - Security Considerations).
Additionally, the user has been added into the group tomcat
user1@developer-server:~$ id
uid=1000(user1) gid=1000(user1) groups=1000(user1),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),109(netdev),997(tomcat)
user1@developer-server:~/.tomcat-vscode/logs$ tree -gpu --dirsfirst -C $CATALINA_BASE
/home/user1/.tomcat-vscode
├── [drwxr-x--- user1 user1 ] bin
│ ├── [-rwxr----- user1 user1 ] setenv.sh
│ └── [-rw-r----- user1 user1 ] tomcat-juli.jar
├── [drwx------ user1 user1 ] conf
│ ├── [drwxr-x--- user1 user1 ] Catalina
│ │ └── [drwxr-x--- user1 user1 ] localhost
│ ├── [-rw------- user1 user1 ] catalina.policy
│ ├── [-rw------- user1 user1 ] catalina.properties
│ ├── [-rw------- user1 user1 ] context.xml
│ ├── [-rw------- user1 user1 ] jaspic-providers.xml
│ ├── [-rw------- user1 user1 ] jaspic-providers.xsd
│ ├── [-rw------- user1 user1 ] logging.properties
│ ├── [-rw------- user1 user1 ] server.xml
│ ├── [-rw------- user1 user1 ] tomcat-users.xml
│ ├── [-rw------- user1 user1 ] tomcat-users.xsd
│ └── [-rw------- user1 user1 ] web.xml
├── [drwxr-x--- user1 user1 ] lib
├── [drwxr-x--- user1 user1 ] logs
├── [drwxr-x--- user1 user1 ] temp
├── [drwxr-x--- user1 user1 ] webapps
└── [drwxr-x--- user1 user1 ] work
user1@developer-server:~/.tomcat-vscode/logs$ sudo tree -gpu --dirsfirst -C $CATALINA_HOME
/opt/apache-tomcat-9.0.62
├── [drwxr-x--- root tomcat ] bin
│ ├── [-rw-r----- root tomcat ] bootstrap.jar
│ ├── [-rw-r----- root tomcat ] catalina.bat
│ ├── [-rwxr-x--- root tomcat ] catalina.sh
│ ├── [-rw-r----- root tomcat ] catalina-tasks.xml
│ ├── [-rw-r----- root tomcat ] ciphers.bat
│ ├── [-rwxr-x--- root tomcat ] ciphers.sh
│ ├── [-rw-r----- root tomcat ] commons-daemon.jar
│ ├── [-rw-r----- root tomcat ] commons-daemon-native.tar.gz
│ ├── [-rw-r----- root tomcat ] configtest.bat
│ ├── [-rwxr-x--- root tomcat ] configtest.sh
│ ├── [-rwxr-x--- root tomcat ] daemon.sh
│ ├── [-rw-r----- root tomcat ] digest.bat
│ ├── [-rwxr-x--- root tomcat ] digest.sh
│ ├── [-rw-r----- root tomcat ] makebase.bat
│ ├── [-rwxr-x--- root tomcat ] makebase.sh
│ ├── [-rw-r----- root tomcat ] setclasspath.bat
│ ├── [-rwxr-x--- root tomcat ] setclasspath.sh
│ ├── [-rw-r----- root tomcat ] shutdown.bat
│ ├── [-rwxr-x--- root tomcat ] shutdown.sh
│ ├── [-rw-r----- root tomcat ] startup.bat
│ ├── [-rwxr-x--- root tomcat ] startup.sh
│ ├── [-rw-r----- root tomcat ] tomcat-juli.jar
│ ├── [-rw-r----- root tomcat ] tomcat-native.tar.gz
│ ├── [-rw-r----- root tomcat ] tool-wrapper.bat
│ ├── [-rwxr-x--- root tomcat ] tool-wrapper.sh
│ ├── [-rw-r----- root tomcat ] version.bat
│ └── [-rwxr-x--- root tomcat ] version.sh
├── [drwx------ root tomcat ] conf
│ ├── [-rw------- root tomcat ] catalina.policy
│ ├── [-rw------- root tomcat ] catalina.properties
│ ├── [-rw------- root tomcat ] context.xml
│ ├── [-rw------- root tomcat ] jaspic-providers.xml
│ ├── [-rw------- root tomcat ] jaspic-providers.xsd
│ ├── [-rw------- root tomcat ] logging.properties
│ ├── [-rw------- root tomcat ] server.xml
│ ├── [-rw------- root tomcat ] tomcat-users.xml
│ ├── [-rw------- root tomcat ] tomcat-users.xsd
│ └── [-rw------- root tomcat ] web.xml
├── [drwxr-x--- root tomcat ] lib
│ ├── [-rw-r----- root tomcat ] annotations-api.jar
│ ├── [-rw-r----- root tomcat ] catalina-ant.jar
│ ├── [-rw-r----- root tomcat ] catalina-ha.jar
│ ├── [-rw-r----- root tomcat ] catalina.jar
│ ├── [-rw-r----- root tomcat ] catalina-ssi.jar
│ ├── [-rw-r----- root tomcat ] catalina-storeconfig.jar
│ ├── [-rw-r----- root tomcat ] catalina-tribes.jar
│ ├── [-rw-r----- root tomcat ] ecj-4.20.jar
│ ├── [-rw-r----- root tomcat ] el-api.jar
│ ├── [-rw-r----- root tomcat ] jasper-el.jar
│ ├── [-rw-r----- root tomcat ] jasper.jar
│ ├── [-rw-r----- root tomcat ] jaspic-api.jar
│ ├── [-rw-r----- root tomcat ] jsp-api.jar
│ ├── [-rw-r----- root tomcat ] servlet-api.jar
│ ├── [-rw-r----- root tomcat ] tomcat-api.jar
│ ├── [-rw-r----- root tomcat ] tomcat-coyote.jar
│ ├── [-rw-r----- root tomcat ] tomcat-dbcp.jar
│ ├── [-rw-r----- root tomcat ] tomcat-i18n-cs.jar
│ ├── [-rw-r----- root tomcat ] tomcat-i18n-de.jar
│ ├── [-rw-r----- root tomcat ] tomcat-i18n-es.jar
│ ├── [-rw-r----- root tomcat ] tomcat-i18n-fr.jar
│ ├── [-rw-r----- root tomcat ] tomcat-i18n-ja.jar
│ ├── [-rw-r----- root tomcat ] tomcat-i18n-ko.jar
│ ├── [-rw-r----- root tomcat ] tomcat-i18n-pt-BR.jar
│ ├── [-rw-r----- root tomcat ] tomcat-i18n-ru.jar
│ ├── [-rw-r----- root tomcat ] tomcat-i18n-zh-CN.jar
│ ├── [-rw-r----- root tomcat ] tomcat-jdbc.jar
│ ├── [-rw-r----- root tomcat ] tomcat-jni.jar
│ ├── [-rw-r----- root tomcat ] tomcat-util.jar
│ ├── [-rw-r----- root tomcat ] tomcat-util-scan.jar
│ ├── [-rw-r----- root tomcat ] tomcat-websocket.jar
│ └── [-rw-r----- root tomcat ] websocket-api.jar
├── [-rw-r----- root tomcat ] LICENSE
├── [-rw-r----- root tomcat ] NOTICE
└── [-rw-r----- root tomcat ] README.md
Hey guys, sorry for the delay. These are all good points. I thought I had fixed the issue a year ago, but since Tomcat confuses me, I likely didn't set it up properly and missed the shutdown case.
I'll see what I can do here to help. I can move to separate catalina_home and catalina_base entirely and force users to fill in both when creating the server, just to be absolutely clear what's going on ;)
Hey guys, sorry for the delay. These are all good points. I thought I had fixed the issue a year ago, but since Tomcat confuses me, I likely didn't set it up properly and missed the shutdown case.
I'll see what I can do here to help. I can move to separate catalina_home and catalina_base entirely and force users to fill in both when creating the server, just to be absolutely clear what's going on ;)
That's a fantastic news!
BTW, another idea, do you consider to read these two variants from the user environment settings. (Also, the config file should be the first choice)
Hope the extension will be widely used for JAVAer!
@N0nePointerException
https://github.com/redhat-developer/rsp-server-community/pull/118
Here's a pull request. It'd be nice if you could review it. I can get you a build, too, if needed. The general idea here is that I've added a new optional parameter server.base.dir
to go with server.home.dir
. In TomcatServerDelegate
I've made sure that if a user does not pick a base directory, it gets automatically filled with the home directory. Finally, I replaced the arguments in the start and stop templates in the server.json
file.
I'm not sure what you mean about the config file being the first choice. Can you explain a bit? Which file, and what contents? What arguments would be needed to respect the config file?
One of the issues we have here is that this adapter is part of our "generic" adapter framework. These adapters in the 'community server connector' are meant to be light-weight and basically templated, with very few changes in behavior to our "generic" framework. So we try not to get too... creative... with solutions for this set of adapters. We like things being light weight, easy to maintain, and kinda dumb to be honest ;)
Also, the architecture of all of our adapters (even our more full-featured ones over at redhat-server-connector) really really prefer users to be explicit with their desires for different variables, and there's a really good reason we do it that way. First, it allows you to have different servers with very specific values that don't rely on your environment. If you want, you can make 5 different instances, each with separate values, to test different launch args, parameters, versions, etc. If we simply pulled from your environment, you wouldn't be able to do this.
Since these tools are primarily created as "development tools" and not meant for use in production, we try to optimize for workflows that allow testing different environments, having very specific setups, etc. It may be annoying to casual users, and of course there's always a way we can try to make it easier for them while still allowing other users the flexibility they want, but, for this set of adapters, we prefer to really keep it light weight.
Let me know what you think of the PR. I've done a basic check and it seems to work as expected, but I'd need to play around a bit more to make sure.
@robstryker
https://github.com/redhat-developer/rsp-server-community/pull/118#pullrequestreview-946999993
I just reviewed the code. Not tested on my machine (because there are some errors during compile, soooo saaaaad! But it should be work, according to the compile with my brain.)
Additionally, I thought the -Djava.util.logging.config.file
and -Djava.io.tmpdir
should pointed to ${server.base.dir}
but not ${server.home.dir}
In the Tomcat Official Document (Running.txt) Advanced Configuration - Multiple Tomcat Instances Section, the folder structure is recommanded as below:
Here we could see, as following the recommanded, conf
directory and temp
directory should be presented in $CATALINA_BASE
dir, but not $CATALINA_HOME
.
If I misunderstood the official doc, please point out!
I'm not sure what you mean about the config file being the first choice. Can you explain a bit? Which file, and what contents? What arguments would be needed to respect the config file?
Nothing more need. If the PR works fine, this should be the expected! Thanks!!
@robstryker Compiled one, and worked as expected!
@arielrezinn This may helped you as well.
@N0nePointerException Thank you for this, glad we could get this sorted out!
I've had a busy week and will have the time to test this in my own workflow tomorrow. I'm assuming it'll function as expected, but I'll be sure to share if I notice any bugs or issues.
@robstryker I just built and installed the master branch locally and discovered that adding a deployment via the UI deploys to the catalina_home webapps directory, instead of the catalina_base webapps directory. Deployment should always be to catalina_base webapps.
@arielrezinn
I forked this repo and fixed one by myself and create a pull request, see Fix Tomcat deploy path . You could download a compiled version from my repo.
@robstryker
It'd be nice if you could review it when it is helpful.
@N0nePointerException @mat-wang @arielrezinn I want to thank all of you for actively helping out here. I've been swamped trying to get my life in order for an impending birth and it's no exaggeration to say that you guys have prevented me from releasing sub-par product. When you know users are depending on your timely merges, and real people are using your code, it's much more motivating to push harder and make things right.
Hey all: I'm closing this bug as I believe the changes were released already.
Feel free to re-open if the current build is not working for you.
System Info
Steps to Reproduce:
On remote server:
Install tomcat as binary archive under
/opt/apache-tomcat-9.0.58
where the folder structure and permissions are shown below:Configure a new instance in
~/tomcat_vscode
where the folder structure and permissions are shown below. (user1 has added into the group tomcat).Configure the env variables in ~/.profile:
Testing start the Tomcat Server manually shows OK (I made a soft link for
catalina.sh
to/usr/bin/catalina
);In Browser, showed like below:
Shutdown the Tomcat server.
On Local mechine
Remote connected to the server;
Add the tomcat server in vscode with the extensions, and the path points to:
/opt/apache-tomcat-9.0.58
. The Server Connector configuration file is shown below:The Error log is shown below:
Firstly, I thought it was caused by the server configuration of the Server Connector extension, after changing the
-Djava.util.logging.config.file
,-Dcatalina.base
, and-Djava.io.tmpdir
, (has shown in the Server Connector configuration file above) it still not working. Is it a bug or the extension doesn't support the multiple instance yet?