Tomcat as a Windows Service not picking JAVA_OPTS parameter
Hi, I have deployed ORDS 22.4 version in Tomcat 9 (which is installed as a Windows Service). For ORDS to work e have to set JAVA_OPTS parameter before starting Tomcat. This works perfectly fine when set in cmd and Tomcat started in cmd using startup.bat. But when you start as service, I have tried setting the parameter in ENV variables , right click services and include in Startup, Catalina.properties - nothing worked. Please help on this Regards, Rajagopalan H
Re: [solved] How to debug 404s / How to enable error log
ср, 1 февр. 2023 г. в 00:51, Michael B Allen : > > ├───conf > │ │ server.xml > │ │ tomcat-users.xml > │ │ web.xml > > It assumes that you are familiar with java.util.logging. > > > > That's unfortunate. It would be so much nicer if it was a simple one-liner. It is configured with logging.properties file, and your configuration is missing catalina.properties context.xml logging.properties files that are required for proper operation. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [solved] How to debug 404s / How to enable error log
On Tue, Jan 31, 2023 at 4:33 PM Konstantin Kolinko wrote: > > INFO: No global web.xml found > > The above message is odd. > Essentially, it means that the file %CATALINA_BASE%\conf\web.xml does not > exist. > Solved. That was it. After copying over the conf/web.xml into myapp-base/conf, the app now works. The REALLY embarrassing thing is that I just asked about this on Nov 15, 2021 and even after taking notes about it, I failed to include the web.xml in my notes. How have you configured your %CATALINA_BASE% directory? > These are all of the files that give me what appear to be a working config: C:\tmp\myapp-base>tree /f Folder PATH listing Volume serial number is BAF1-D00E C:. │ cmd.lnk │ ├───bin │ start.bat │ ├───conf │ │ server.xml │ │ tomcat-users.xml │ │ web.xml │ │ │ └───Catalina │ └───localhost ├───logs │ myapp.log │ localhost_access_log.2023-01-31.txt │ ├───temp ├───webapps │ └───myapp │ │ index.jsp │ │ │ └───WEB-INF │ │ example.prp │ │ web.xml │ │ │ └───lib │ myapp-jakarta-1.2.3.jar │ └───work └───Catalina └───localhost └───myapp └───org └───apache └───jsp index_jsp.class index_jsp.java > > > The conf/web.xml configures all the defaults, shared by all web > applications. > That includes > - declaration of DefaultServlet > - declaration of JspServlet > - "welcome-file-list" > - "mime-mapping"s > > > How does one enable a debug log? The documentation about such things is > > pretty cryptic. > > It assumes that you are familiar with java.util.logging. > That's unfortunate. It would be so much nicer if it was a simple one-liner. Mike
Re: How to debug 404s / How to enable error log
ср, 1 февр. 2023 г. в 00:04, Michael B Allen : > > This is embarrassing. I have apparently forgotten how to operate Tomcat. > Welcome! The main help file for running Tomcat is RUNNING.txt, with additional information in webapps/docs/setup.html and webapps/docs/windows-service-howto.html > I just downloaded openjdk 17, Tomcat 10.1.5 to a clean Windows 10, upacked > everything, created a myapp-base with a .bat like: > > --8<-- bin\start.bat --8<-- > > setlocal > > set "JRE_HOME=C:\tmp\java17" > set "CATALINA_HOME=C:\tmp\tomcat10" > set "CATALINA_BASE=C:\tmp\myapp-base" > > %CATALINA_HOME%\bin\catalina.bat start > > -- > > Copied webapp files into the webapps dir. > > On bin\start I get some INFO in the console like: > > Jan 31, 2023 3:46:02 PM org.apache.coyote.AbstractProtocol init > INFO: Initializing ProtocolHandler ["http-nio-8080"] > Jan 31, 2023 3:46:02 PM org.apache.catalina.startup.Catalina load > INFO: Server initialization in [797] milliseconds > Jan 31, 2023 3:46:02 PM org.apache.catalina.core.StandardService > startInternal > INFO: Starting service [Catalina] > Jan 31, 2023 3:46:02 PM org.apache.catalina.core.StandardEngine > startInternal > INFO: Starting Servlet engine: [Apache Tomcat/10.1.5] > Jan 31, 2023 3:46:02 PM org.apache.catalina.startup.HostConfig > deployDirectory > INFO: Deploying web application directory [C:\tmp\myapp-base\webapps\myapp] > Jan 31, 2023 3:46:02 PM org.apache.catalina.startup.ContextConfig > getDefaultWebXmlFragment > INFO: No global web.xml found The above message is odd. Essentially, it means that the file %CATALINA_BASE%\conf\web.xml does not exist. How have you configured your %CATALINA_BASE% directory? The conf/web.xml configures all the defaults, shared by all web applications. That includes - declaration of DefaultServlet - declaration of JspServlet - "welcome-file-list" - "mime-mapping"s > Jan 31, 2023 3:46:03 PM org.apache.jasper.servlet.TldScanner scanJars > INFO: 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. > Jan 31, 2023 3:46:03 PM org.apache.catalina.startup.HostConfig > deployDirectory > INFO: Deployment of web application directory > [C:\tmp\myapp-base\webapps\myapp] has finished in [656] ms > Jan 31, 2023 3:46:03 PM org.apache.coyote.AbstractProtocol start > INFO: Starting ProtocolHandler ["http-nio-8080"] > Jan 31, 2023 3:46:03 PM org.apache.catalina.startup.Catalina start > INFO: Server startup in [765] milliseconds > > The myapp servlet filter init runs. A localhost access log is created in > myapp-base\logs. > > But trying to access anything through localhost:8080 or remotely by > hostname fails with nothing but 404: > > 10.22.10.30 - - [31/Jan/2023:15:14:49 -0500] "GET /myapp/ HTTP/1.1" 404 682 > 10.22.10.30 - - [31/Jan/2023:15:14:49 -0500] "GET /favicon.ico HTTP/1.1" > 404 682 > 0:0:0:0:0:0:0:1 - - [31/Jan/2023:15:22:43 -0500] "GET / HTTP/1.1" 404 682 > 0:0:0:0:0:0:0:1 - - [31/Jan/2023:15:22:43 -0500] "GET /favicon.ico > HTTP/1.1" 404 682 > 0:0:0:0:0:0:0:1 - - [31/Jan/2023:15:22:49 -0500] "GET /myapp HTTP/1.1" 302 - At least the web application is there. A 302 redirect happens. > 0:0:0:0:0:0:0:1 - - [31/Jan/2023:15:22:49 -0500] "GET /myapp/ HTTP/1.1" 404 > 682 > 0:0:0:0:0:0:0:1 - - [31/Jan/2023:15:22:53 -0500] "GET /myapp/index.jsp > HTTP/1.1" 404 682 No JspServlet (to serve it as a JSP page), nor DefaultServlet (to serve it as a plain downloadable file) are configured. > So now I'm just trying to find out how to enable an error log and for the > life of me I'm completely blanking. > > How does one enable a debug log? The documentation about such things is > pretty cryptic. It assumes that you are familiar with java.util.logging. > How can I diagnose this further? > BTW, Note that Tomcat 10+ implements JakartaEE Servlet specification. If your web application is based on JavaEE Servlet specification, it cannot be put into webapps as is, and has to be converted. See Migration guide. https://tomcat.apache.org/migration-10.html#Specification_APIs Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
How to debug 404s / How to enable error log
This is embarrassing. I have apparently forgotten how to operate Tomcat. I just downloaded openjdk 17, Tomcat 10.1.5 to a clean Windows 10, upacked everything, created a myapp-base with a .bat like: --8<-- bin\start.bat --8<-- setlocal set "JRE_HOME=C:\tmp\java17" set "CATALINA_HOME=C:\tmp\tomcat10" set "CATALINA_BASE=C:\tmp\myapp-base" %CATALINA_HOME%\bin\catalina.bat start -- Copied webapp files into the webapps dir. On bin\start I get some INFO in the console like: Jan 31, 2023 3:46:02 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-nio-8080"] Jan 31, 2023 3:46:02 PM org.apache.catalina.startup.Catalina load INFO: Server initialization in [797] milliseconds Jan 31, 2023 3:46:02 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service [Catalina] Jan 31, 2023 3:46:02 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet engine: [Apache Tomcat/10.1.5] Jan 31, 2023 3:46:02 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory [C:\tmp\myapp-base\webapps\myapp] Jan 31, 2023 3:46:02 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment INFO: No global web.xml found Jan 31, 2023 3:46:03 PM org.apache.jasper.servlet.TldScanner scanJars INFO: 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. Jan 31, 2023 3:46:03 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deployment of web application directory [C:\tmp\myapp-base\webapps\myapp] has finished in [656] ms Jan 31, 2023 3:46:03 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-nio-8080"] Jan 31, 2023 3:46:03 PM org.apache.catalina.startup.Catalina start INFO: Server startup in [765] milliseconds The myapp servlet filter init runs. A localhost access log is created in myapp-base\logs. But trying to access anything through localhost:8080 or remotely by hostname fails with nothing but 404: 10.22.10.30 - - [31/Jan/2023:15:14:49 -0500] "GET /myapp/ HTTP/1.1" 404 682 10.22.10.30 - - [31/Jan/2023:15:14:49 -0500] "GET /favicon.ico HTTP/1.1" 404 682 0:0:0:0:0:0:0:1 - - [31/Jan/2023:15:22:43 -0500] "GET / HTTP/1.1" 404 682 0:0:0:0:0:0:0:1 - - [31/Jan/2023:15:22:43 -0500] "GET /favicon.ico HTTP/1.1" 404 682 0:0:0:0:0:0:0:1 - - [31/Jan/2023:15:22:49 -0500] "GET /myapp HTTP/1.1" 302 - 0:0:0:0:0:0:0:1 - - [31/Jan/2023:15:22:49 -0500] "GET /myapp/ HTTP/1.1" 404 682 0:0:0:0:0:0:0:1 - - [31/Jan/2023:15:22:53 -0500] "GET /myapp/index.jsp HTTP/1.1" 404 682 So now I'm just trying to find out how to enable an error log and for the life of me I'm completely blanking. How does one enable a debug log? The documentation about such things is pretty cryptic. How can I diagnose this further? Thanks, Mike
Re: changes in Tomcat 10 break Spring Boot 3 executable JARs
On Tue, Jan 31, 2023 at 5:14 PM Garret Wilson wrote: > > I'm passing on an issue discussed on Spring Boot GitHub which may not > have been passed on to you. The main ticket is > https://github.com/spring-projects/spring-boot/issues/33633 . > > Spring Boot 3 executable JARs with Java 17 will break with > "java.lang.IllegalStateException: zip file closed" when Tomcat 10 tries > to start. You can see an example stack trace at > https://github.com/spring-projects/spring-boot/issues/34028 . > > Apparently Tomcat 9 used to do a JAR file multi-release check like this: > > ```java > @Override > public boolean jarFileIsMultiRelease(JarFile jarFile) { > try { > return ((Boolean) > isMultiReleaseMethod.invoke(jarFile)).booleanValue(); > } catch (ReflectiveOperationException | IllegalArgumentException e) { > return false; > } > } > ``` > > In Tomcat 10.1 it looks like this: > > ```java > multiRelease = jarFile.isMultiRelease(); > ``` > > I don't know anything about this code (I'm merely passing on what is in > the ticket), but I can guess that Tomcat wants to get away from > reflective operations, especially with later Java versions. That's fine > and probably a good idea. Unfortunately the new code does no error > handling whatsoever, so that the `IllegalStateException` kills > everything. If you could at least catch the `IllegalStateException` and > assume `false` I would imagine that would work around this issue. > > The Spring Boot ticket acknowledges that they should improve their > `JarUrlConnection` so that it wouldn't return a `JarFile` that was > closed in the first place. Unfortunately there's no indication when that > would be done, and right now the entire Spring Boot 3 executable JAR > system is broken, requiring a system property to be added as a workaround. > > Would you consider adding more error handling in a Tomcat 10 patch so > that users to explicitly override the Tomcat 10 version and get their > Spring Boot 3 executable JARs working again? The initial version of the compat code already had the try/catch for the ISE, so it would basically have worked by accident, and the result of the method is basically not accurate (it could return false for a multi release JAR - obviously this is not super likely to break something since those are not that common). This compat code is now removed since Tomcat 10.1 is Java 11+ so it has the necessary real API. And we didn't know that the ISE was a problem. Not sure what to do about that though ... Rémy > Thanks, > > Garret > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
changes in Tomcat 10 break Spring Boot 3 executable JARs
I'm passing on an issue discussed on Spring Boot GitHub which may not have been passed on to you. The main ticket is https://github.com/spring-projects/spring-boot/issues/33633 . Spring Boot 3 executable JARs with Java 17 will break with "java.lang.IllegalStateException: zip file closed" when Tomcat 10 tries to start. You can see an example stack trace at https://github.com/spring-projects/spring-boot/issues/34028 . Apparently Tomcat 9 used to do a JAR file multi-release check like this: ```java @Override public boolean jarFileIsMultiRelease(JarFile jarFile) { try { return ((Boolean) isMultiReleaseMethod.invoke(jarFile)).booleanValue(); } catch (ReflectiveOperationException | IllegalArgumentException e) { return false; } } ``` In Tomcat 10.1 it looks like this: ```java multiRelease = jarFile.isMultiRelease(); ``` I don't know anything about this code (I'm merely passing on what is in the ticket), but I can guess that Tomcat wants to get away from reflective operations, especially with later Java versions. That's fine and probably a good idea. Unfortunately the new code does no error handling whatsoever, so that the `IllegalStateException` kills everything. If you could at least catch the `IllegalStateException` and assume `false` I would imagine that would work around this issue. The Spring Boot ticket acknowledges that they should improve their `JarUrlConnection` so that it wouldn't return a `JarFile` that was closed in the first place. Unfortunately there's no indication when that would be done, and right now the entire Spring Boot 3 executable JAR system is broken, requiring a system property to be added as a workaround. Would you consider adding more error handling in a Tomcat 10 patch so that users to explicitly override the Tomcat 10 version and get their Spring Boot 3 executable JARs working again? Thanks, Garret - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org