Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A brief discussion on the solution of garbled Code and Port occupation of Tomcat

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Tomcat server is a free and open source Web application server, which is a lightweight application server. It is widely used in small and medium-sized systems and not many concurrent access users. It is the first choice for developing and debugging JSP programs. However, some partners will also encounter all kinds of problems when starting Tomcat, such as garbled code, port occupation, flicker after startup of Tomcat startup.bat, and so on. Here we will solve them one by one.

Problem 1: garbled code occurs after Tomcat's startup.bat is started

Find the conf directory under the Tomcat file, and change the value of java.util.logging.ConsoleHandler.encoding in the logging.properties file to GBK

Restart Tomcat and the launch page you see looks like this, indicating that the garbled problem has been solved.

Problem 2: Port occupancy with a flash of retreat

When you start Tomcat, there is a flicker. In fact, you can still see the log output of the Tomcat terminal. At this time, you need to quickly take a screenshot to catch the exception, which is too south.

The most correct way is to check the log and find the catalina log in the logs directory under the Tomcat directory. What I find here is C:\ develop\ Tomcat\ apache-tomcat-8.5.47\ logs\ catalina.2019-10-17.log. You can see output like this in the log. Address already in use: bind indicates that the port is occupied.

17-Oct-2019 11 org.apache.catalina.core.StandardService.initInternal Failed to initialize connector 14 org.apache.catalina.core.StandardService.initInternal Failed to initialize connector serious [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector [HTTP/1.1-8080]] org.apache.catalina.LifecycleException: Protocol handler initialization failed at org.apache.catalina.connector.Connector.initInternal (Connector.java:995) at org.apache.catalina.util.LifecycleBase.init (LifecycleBase.java:136) At org.apache.catalina.core.StandardService.initInternal (StandardService.java:552) at org.apache.catalina.util.LifecycleBase.init (LifecycleBase.java:136) at org.apache.catalina.core.StandardServer.initInternal (StandardServer.java:848) at org.apache.catalina.util.LifecycleBase.init (LifecycleBase.java:136) at org.apache.catalina.startup.Catalina .load (Catalina.java:639) at org.apache.catalina.startup.Catalina.load (Catalina.java:662) at sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethod) 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.load (Bootstrap.java:309) at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:492) Caused by: java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind0 (Native Method) at sun.nio.ch.Net.bind ( Net.java:433) at sun.nio.ch.Net.bind (Net.java:425) at sun.nio.ch.ServerSocketChannelImpl.bind (ServerSocketChannelImpl.java:223) at sun.nio.ch.ServerSocketAdaptor.bind (ServerSocketAdaptor.java:74) at org.apache.tomcat.util.net.NioEndpoint.bind (NioEndpoint.java:219) at org .apache.tomcat.util.net.AbstractEndpoint.init (AbstractEndpoint.java:1118) at org.apache.tomcat.util.net.AbstractJsseEndpoint.init (AbstractJsseEndpoint.java:224) at org.apache.coyote.AbstractProtocol.init (AbstractProtocol.java:581) at org.apache.coyote.http11.AbstractHttp11Protocol.init (AbstractHttp11Protocol.java:68) at org.apache.catalina.connector.Connector.initInternal (Connector.java:993)... 13 more

Find the server.xml configuration file in the conf directory in the Tomcat directory and modify the Tomcat startup port in the Connector tag

Question 3: the flicker of non-port problems

Start Tomcat in a flash, and no error message can be found in the log of logs directory. This is probably due to the mismatch between Tomcat and JDK version. It is possible that your Tomcat version is Tomcat9 version, while your JDK version is 1.7 version. For more information on the correspondence between Tomcat and JDK version, please see the corresponding relationship between Tomcat and JDK version in this article, and the characteristics of each Tomcat version.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report