tomcat启动成功,但是http://localhost:8080/页面打不开

今天遇到一个问题:

$ ./startup.sh
$ Tomcat started.

启动tomcat显示,tomcat成功,但是页面http://localhost:8080/却打不开

查看日志:catalina.log,发现:

27-Dec-2018 21:22:51.181 严重 [main] org.apache.catalina.core.StandardServer.await 
Failed to create server shutdown socket on address [localhost] and port [8005] 
(base port [8005] and offset [0])
 java.net.BindException: Can't assign requested address (Bind failed)
	at java.net.PlainSocketImpl.socketBind(Native Method)
	at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
	at java.net.ServerSocket.bind(ServerSocket.java:375)
	at java.net.ServerSocket.<init>(ServerSocket.java:237)
	at org.apache.catalina.core.StandardServer.await(StandardServer.java:453)
	at org.apache.catalina.startup.Catalina.await(Catalina.java:783)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:729)
	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.start(Bootstrap.java:350)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)

原来tomcat报错,实际上tomcat并没有启动成功,

绑定地址localhost失败,然后在iterms终端ping一下localhost,果然失败(而ping 127.0.0.1 是成功的)

17 packets transmitted, 0 packets received, 100.0% packet loss

解决方案:sudo vim /etc/hosts 修改hosts文件,添加:
 

127.0.0.1 localhost

然后启动一下tomcat,成功

ps:关于localhost和127.0.0.1的知识点可参考:https://blog.csdn.net/w657395940/article/details/50241693

 

发布了36 篇原创文章 · 获赞 2 · 访问量 1万+
展开阅读全文

Server Tomcat v9.0 Server at localhost failed to start.

04-02

在网页上运行可以打开Tomcat ![图片说明](https://img-ask.csdn.net/upload/201904/02/1554202980_793102.jpg) 关掉startup.bat在eclipse上运行时出错,怎么解决!!! ![图片说明](https://img-ask.csdn.net/upload/201904/02/1554202864_193867.jpg) 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server.服务器版本: Apache Tomcat/9.0.16 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server.构建: Feb 4 2019 16:30:29 UTC 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version number: 9.0.16.0 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 10 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS.版本: 10.0 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: 结.造: amd64 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java 环境变量: C:\Program Files\Java\jdk1.8.0_201\jre 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM 版本: 1.8.0_201-b09 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM.供应商: Oracle Corporation 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_BASE: E:\Program flies\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_HOME: E:\Program Files\apache-tomcat-9.0.16 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=E:\Program flies\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=E:\Program Files\apache-tomcat-9.0.16 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=E:\Program flies\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Djava.endorsed.dirs=E:\Program Files\apache-tomcat-9.0.16\endorsed 四月 02, 2019 6:58:40 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=GBK 四月 02, 2019 6:58:40 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5]. 四月 02, 2019 6:58:40 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 四月 02, 2019 6:58:40 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] 四月 02, 2019 6:58:40 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL 信息: OpenSSL successfully initialized [OpenSSL 1.1.1a 20 Nov 2018] 四月 02, 2019 6:58:41 下午 org.apache.coyote.AbstractProtocol init 信息: 初始化协议处理器 ["http-nio-8080"] 四月 02, 2019 6:58:41 下午 org.apache.coyote.AbstractProtocol init 信息: 初始化协议处理器 ["ajp-nio-8009"] 四月 02, 2019 6:58:41 下午 org.apache.catalina.startup.Catalina load 信息: 服务器在[963]毫秒内初始化 四月 02, 2019 6:58:41 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service [Catalina] 四月 02, 2019 6:58:41 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet engine: [Apache Tomcat/9.0.16] 四月 02, 2019 6:58:45 下午 org.apache.jasper.servlet.TldScanner scanJars 信息: 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 四月 02, 2019 6:58:48 下午 org.apache.jasper.servlet.TldScanner scanJars 信息: 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 四月 02, 2019 6:58:50 下午 org.apache.jasper.servlet.TldScanner scanJars 信息: 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 四月 02, 2019 6:58:50 下午 org.apache.coyote.AbstractProtocol start 信息: 开始协议处理句柄["http-nio-8080"] 四月 02, 2019 6:58:50 下午 org.apache.coyote.AbstractProtocol start 信息: 开始协议处理句柄["ajp-nio-8009"] 四月 02, 2019 6:58:50 下午 org.apache.catalina.startup.Catalina start 信息: Server startup in [9,297] milliseconds 四月 02, 2019 6:58:50 下午 org.apache.catalina.core.StandardServer await 严重: Failed to create server shutdown socket on address [localhost] and port [8080] (base port [8080] and offset [0]) java.net.BindException: Address already in use: JVM_Bind at java.net.DualStackPlainSocketImpl.bind0(Native Method) at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190) at java.net.ServerSocket.bind(ServerSocket.java:375) at java.net.ServerSocket.<init>(ServerSocket.java:237) at org.apache.catalina.core.StandardServer.await(StandardServer.java:582) at org.apache.catalina.startup.Catalina.await(Catalina.java:726) at org.apache.catalina.startup.Catalina.start(Catalina.java:672) 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.start(Bootstrap.java:350) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492) 四月 02, 2019 6:58:50 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["http-nio-8080"] 四月 02, 2019 6:58:50 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["ajp-nio-8009"] 四月 02, 2019 6:58:50 下午 org.apache.catalina.core.StandardService stopInternal 信息: Stopping service [Catalina] 四月 02, 2019 6:58:50 下午 org.apache.coyote.AbstractProtocol stop 信息: Stopping ProtocolHandler ["http-nio-8080"] 四月 02, 2019 6:58:50 下午 org.apache.coyote.AbstractProtocol stop 信息: Stopping ProtocolHandler ["ajp-nio-8009"] 四月 02, 2019 6:58:50 下午 org.apache.coyote.AbstractProtocol destroy 信息: 正在摧毁协议处理器 ["http-nio-8080"] 四月 02, 2019 6:58:50 下午 org.apache.coyote.AbstractProtocol destroy 信息: 正在摧毁协议处理器 ["ajp-nio-8009"] 问答

tomcat启动成功但是localhost8080访问不了

07-08

[INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] taotao-manager [INFO] taotao-manager-pojo [INFO] taotao-manager-mapper [INFO] taotao-manager-service [INFO] taotao-manager-web [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building taotao-manager 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ taotao-manager >>> [INFO] [INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ taotao-manager <<< [INFO] [INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ taotao-manager --- [INFO] Skipping non-war project [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building taotao-manager-pojo 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ taotao-manager-pojo >>> [INFO] [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ taotao-manager-pojo --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ taotao-manager-pojo --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ taotao-manager-pojo <<< [INFO] [INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ taotao-manager-pojo --- [INFO] Skipping non-war project [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building taotao-manager-mapper 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ taotao-manager-mapper >>> [INFO] [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ taotao-manager-mapper --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 11 resources [INFO] [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ taotao-manager-mapper --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ taotao-manager-mapper <<< [INFO] [INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ taotao-manager-mapper --- [INFO] Skipping non-war project [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building taotao-manager-service 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ taotao-manager-service >>> [INFO] [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ taotao-manager-service --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ taotao-manager-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ taotao-manager-service <<< [INFO] [INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ taotao-manager-service --- [INFO] Skipping non-war project [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building taotao-manager-web 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ taotao-manager-web >>> [INFO] [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ taotao-manager-web --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 6 resources [INFO] [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ taotao-manager-web --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ taotao-manager-web <<< [INFO] [INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ taotao-manager-web --- [INFO] Running war on http://localhost:8080/ [INFO] Using existing Tomcat server configuration at D:\Users\Administrator\taotao\workspace\taotao-manager\taotao-manager-web\target\tomcat [INFO] create webapp with contextPath: 七月 08, 2016 2:26:09 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-bio-8080"] 七月 08, 2016 2:26:09 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Tomcat 七月 08, 2016 2:26:09 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.47 七月 08, 2016 2:26:16 下午 org.apache.catalina.core.ApplicationContext log 信息: No Spring WebApplicationInitializer types detected on classpath 七月 08, 2016 2:26:17 下午 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 问答

TomCat启动,但是无法打开localhost:8080

10-20

# # 日志信息如下 20-Oct-2016 00:10:33.432 严重 [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0': Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cacheManager' is defined at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1486) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1231) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:751) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682) # 新手,我也不知道那个“cacheManager”的Bean是什么情况,我在自学的教学项目里面是有用到spring框架的,但是我只是要访问localhost:8080啊。还有就是ROOT目录下的Manager里的index.jsp还在的 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览