This article summarizes what happened before when Tomcat couldn't be started from Eclipse. The cause was so blind spot that it could be a hint for those who are similarly troubled. The target is for people who are building a development environment, so it is for beginners.
OS:macOS Catalina(10.15.5) Eclipse:Eclipse2020~2018
I was trying to create a web application using strus2 about 3 months ago, but since I had left it for a long time, I was confused by the flow of making a continuation. (Because there are many libraries, I will move to the maven project) After setting the POM, the server that normally starts in seconds does not start for some reason when the server is about to start ... If I wait as it is, for some reason I get a server timeout error.
I thought it was a little sick, so I changed the server timeout time from 45 seconds to 120 seconds. I still get a timeout error. There is nothing particularly suspicious in the log.
information: Server version: Apache Tomcat/8.5.34 [Fri 6 12 11:04:07 JST 2020]
information: Server built: Sep 4 2018 22:28:22 UTC [Fri 6 12 11:04:07 JST 2020]
information: Server number: 8.5.34.0 [Fri 6 12 11:04:07 JST 2020]
information: OS Name: Mac OS X [Fri 6 12 11:04:07 JST 2020]
information: OS Version: 10.15.5 [Fri 6 12 11:04:07 JST 2020]
information: Architecture: x86_64 [Fri 6 12 11:04:07 JST 2020]
information: Java Home: /Applications/Eclipse_2018-09.app/Contents/java/8/Home/jre [Fri 6 12 11:04:07 JST 2020]
information: JVM Version: 1.8.0_181-b13 [Fri 6 12 11:04:07 JST 2020]
information: JVM Vendor: Oracle Corporation [Fri 6 12 11:04:07 JST 2020]
information: CATALINA_BASE: /Applications/Eclipse_2018-09.app/Contents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0 [Fri 6 12 11:04:07 JST 2020]
information: CATALINA_HOME: /Applications/Eclipse_2018-09.app/Contents/tomcat/8 [Fri 6 12 11:04:07 JST 2020]
information: Command line argument: -Djava.ext.dirs=/Applications/Eclipse_2018-09.app/Contents/java/8/Home/jre/lib/ext [Fri 6 12 11:04:07 JST 2020]
information: Command line argument: -Dcatalina.base=/Applications/Eclipse_2018-09.app/Contents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0 [Fri 6 12 11:04:07 JST 2020]
information: Command line argument: -Dcatalina.home=/Applications/Eclipse_2018-09.app/Contents/tomcat/8 [Fri 6 12 11:04:07 JST 2020]
information: Command line argument: -Dwtp.deploy=/Applications/Eclipse_2018-09.app/Contents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps [Fri 6 12 11:04:07 JST 2020]
information: Command line argument: -Djava.endorsed.dirs=/Applications/Eclipse_2018-09.app/Contents/tomcat/8/endorsed [Fri 6 12 11:04:07 JST 2020]
information: Command line argument: -Dfile.encoding=UTF-8 [Fri 6 12 11:04:07 JST 2020]
information: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/XXXXXXXX/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.] [Fri 6 12 11:04:07 JST 2020]
information: Initializing ProtocolHandler ["http-nio-8080"] [Fri 6 12 11:04:07 JST 2020]
information: Using a shared selector for servlet write/read [Fri 6 12 11:04:07 JST 2020]
information: Initializing ProtocolHandler ["ajp-nio-8009"] [Fri 6 12 11:04:07 JST 2020]
information: Using a shared selector for servlet write/read [Fri 6 12 11:04:07 JST 2020]
information: Initialization processed in 1147 ms [Fri 6 12 11:04:07 JST 2020]
information:service[Catalina]Start[Fri 6 12 11:04:07 JST 2020]
information: Starting Servlet Engine: Apache Tomcat/8.5.34 [Fri 6 12 11:04:07 JST 2020]
information: 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. [Fri 6 12 11:04:10 JST 2020]
information: Starting ProtocolHandler ["http-nio-8080"] [Fri 6 12 11:04:10 JST 2020]
information: Starting ProtocolHandler ["ajp-nio-8009"] [Fri 6 12 11:04:10 JST 2020]
information: Server startup in 2956 ms [Fri 6 12 11:04:10 JST 2020]
Does tomcat not work because I made maven from here? I came up with the idea, and once deleted the project. After deleting the project, when checking whether to start only the server, a timeout error still occurs. I tried to re-install Eclipse with the thought that I might have broken Eclipse from here. Even if I check if only the server is started in the same way, a timeout error still occurs. The Java version and tomcat version match, and I don't know the cause at all. The next thing I did was to check if the server can be started with tomcat alone.
How to install Apache Tomcat on Mac
If you start the server according to the above, it will be started normally and it will be triumphant http://localhost:8080 When I go to connect to ...
** I can't connect after all! !! !! !! !! !! !! ** **
MochiMac:bin XXXXX$ ./startup.sh
Using CATALINA_BASE: /Users/XXXXX/Desktop/apache-tomcat-9.0.36
Using CATALINA_HOME: /Users/XXXXX/Desktop/apache-tomcat-9.0.36
Using CATALINA_TMPDIR: /Users/XXXXX/Desktop/apache-tomcat-9.0.36/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
Using CLASSPATH: /Users/XXXXX/Desktop/apache-tomcat-9.0.36/bin/bootstrap.jar:/Users/XXXXX/Desktop/apache-tomcat-9.0.36/bin/tomcat-juli.jar
Tomcat started.
** You should start because it says "staeted"! !! !! !! ** **
I went to check the log for the first time here with the feeling of wanting to scream. (I regret that I should have searched the log even when I started it with eclipse) Then, for the first time, I touched on the hint of the cause.
12-Jun-2020 09:40:29.349 Information[main] org.apache.coyote.AbstractProtocol.init protocol handler["http-nio-8080"]Initialize.
12-Jun-2020 09:40:29.374 serious[main] org.apache.catalina.util.LifecycleBase.handleSubClassException component[Connector[HTTP/1.1-8080]]Failed to initialize.
org.apache.catalina.LifecycleException:Failed to initialize protocol handler
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1042)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:533)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1057)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:584)
at org.apache.catalina.startup.Catalina.load(Catalina.java:607)
** Is 8080 used? ** ** I didn't mean to use it, but I thought it might have been used somewhere, so I modified it to use 8081.
Simple way to change tomcat port
If you fix it according to the above, you cannot connect to 8081 this time.
Why is the connection refused? And when I remember it well, I remember that I had to re-install security software two months ago ... I wondered if I restarted tomcat with security software around the firewall and access restrictions disabled ...
**moved! !! !! !! !! !! !! You can also connect to localhost: 8080! !! !! !! !! ** **
Furthermore, the server started up safely in Eclipse as it was.
The cause so far was around the firewall of the security software and the setting of access restrictions. It was too silly, it was a blind spot, and it took time to identify the cause, so I wrote this article.
Recommended Posts