The story that Tomcat suffered from a timeout error in Eclipse

Introduction

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.

environment

OS:macOS Catalina(10.15.5) Eclipse:Eclipse2020~2018

The beginning of things

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. スクリーンショット 2020-06-12 11.05.07.png

What I tried

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. image.png

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.

result

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

The story that Tomcat suffered from a timeout error in Eclipse
[Docker] The story that an error occurred in docker-compose up
The story that the build error did not stop when using Eclipse 2020
A story about the JDK in the Java 11 era
A story that suffered from a space that does not disappear even if trimmed with Java The cause is BOM
The right way to see the tomcat source in eclipse
A story that got stuck with an error during migration in docker PHP laravel
A small story that is sometimes useful in Maven
Verification value error that occurred in a clustering environment
A memorandum that the author suffered from an error [bundler: failed to load command: unicorn NameError: uninitialized constant Model]
Java Error Handling Basics-The story that catch is only picked up in the foreground
The story that .java is also built in Unity 2018
A story that deepened the understanding of devise's methods user_signed_in? And current_user through error resolution
A story that I realized that I had to study as an engineer in the first place
Determine that the value is a multiple of 〇 in Ruby
The story of throwing BLOB data from EXCEL in DBUnit
A program that counts the number of words in a List
Install the plugin in Eclipse
Install tomcat plugin in eclipse
A story that a Ruby beginner made and released a LINE BOT that tells the train time in 2 months
[Gradle] The story that the class file did not exist in the jar file
A story that struggled with the introduction of Web Apple Pay
A story that confirmed the profile of Yasuko Sawaguchi 36 years ago
Correspond to "error that basic authentication does not pass" in the test code "The story that could not be done"
A story that I was addicted to twice with the automatic startup setting of Tomcat 8 on CentOS 8
A story about changing skills from COBOL cultivated for 5 years in the late 20s to a Web language
Use the Findbugs plugin in Eclipse
Create a Servlet program in Eclipse
A story about running a program that copies files in Java from a bat file to make the work done every day a little more efficient
Calculation that adds in order from 1
A little troublesome story in Groovy
The story of forgetting to close a file in Java and failing
A story about a Spring Boot project written in Java that supports Kotlin
The story of acquiring Java Silver in two months from completely inexperienced.
[Rails] About the error that the image is not displayed in the production environment
Run x11 apps in a Docker container (supports network access from the container)
Sample program that returns the hash value of a file in Java
A story about converting character codes from UTF-8 to Shift-jis in Ruby
A story that was embarrassing to give anison file to the production environment
The story that the Servlet could not be loaded in the Java Web application
Make the context root a project folder in an Eclipse dynamic web project
[Java] Implement a function that uses a class implemented in the Builder pattern
A story about an arithmetic overflow that you shouldn't encounter in Ruby
The story of an Illegal State Exception in Jetty.
[Docker] The story that an error occurred in docker-compose up
An error occurred when executing a function from MyBatis with the OUT parameter set to CURSOR in PostgreSQL.