1.windows->Preference->server->Runtime Environment->add
选择tomcat安装路径,及JRE版本,点击finish。
双击建好的服务器,修改,保存。
启动服务器,右键项目,run as ->run on serve->finish
=========================================
错误1
报错:Could not publish server configuration for Tomcat v8.5 Server at localhost.
如果是使用的eclipse tomcat 插件,需要在你的工作空间 找到如下文件:
${WoskSpace}/.metadata\.plugins\org.eclipse.wst.server.cor\e\tmp0\conf\server.xml文件。
如果是Tomcat单独服务器就需要找Tomcat的安装目录:
${Tomcat_home}\apache-tomcat-6.0.37\conf\server.xml
删除多余语句。
===========================
错误2
启动服务器超时
报错:Server Tomcat v8.5 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
解决:应该是项目没有配置好
===================================
错误3
eclipse启动tomcat报错:Server Tomcat v8.5 Server at localhost failed to start.(2019年5月17日,配置好Maven后启动报错)
console控制台上显示好多错误,主要看causedby错误,可能是jar包错误。
1)项目名右键 -> Run as -> Maven test ,这时控制台会报哪个jar包出错。
解决:最后问题出在一个文件中,包类名称没有更改
更改之后,又出现错误2
console显示结果为:
Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1br4juna21iw7bv0tuudhn|30e80da9, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.cj.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1br4juna21iw7bv0tuudhn|30e80da9, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/estate?useUnicode=true&characterEncoding=utf8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 1800, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 5, maxStatements -> 8, maxStatementsPerConnection -> 5, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
解决:
连接池初始化出现问题,数据库相应服务没有启动。计算机右键->管理->服务,将SQL相关服务启动
最后我把启动时间改成450,就启动成功了...真神奇
===================================
错误4
报错为
解决:
============
错误5
再次启动,报错如下:
Port 8009 required by Tomcat v8.5 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
解决:
找到占用端口号的进程:cmd下输入netstat -aon|findstr "8009"
得到进程号 2616和7924,继续输入命令: tasklist|findstr "2616"得到进程名称
关闭了数据库navicat,重新启动出现错误2。