eclipse中Server Locations选项

  1. 云栖社区>
  2. 博客>
  3. 正文

eclipse中Server Locations选项

填坑大人 2018-07-21 11:08:19 浏览3313
展开阅读全文

这几天在开发的过程,使用mvn tomcat7:redeploy命令打包部署到服务器上是,发现有报内存泄漏的日志。于是想在本地测试一下,看是哪里没有释放好内存。日志如下:

registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
21-Jul-2018 09:54:55.965 WARNING [http-nio-52000-exec-31] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [iicc_inf] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:64)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 java.lang.Thread.run(Thread.java:748)
21-Jul-2018 09:54:55.966 WARNING [http-nio-52000-exec-31] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [iicc_inf] appears to have started a thread named [Thread-17] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.net.SocketInputStream.socketRead0(Native Method)
 java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
 java.net.SocketInputStream.read(SocketInputStream.java:171)
 java.net.SocketInputStream.read(SocketInputStream.java:141)
 java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
 java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
 java.io.BufferedInputStream.read(BufferedInputStream.java:345)
 com.sun.jndi.ldap.Connection.run(Connection.java:860)
 java.lang.Thread.run(Thread.java:748)
21-Jul-2018 09:54:56.015 INFO [http-nio-52000-exec-31] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive 

可能是因为是spring-boot项目的原因,所以我在tomcat中删除项目时,控制台上并没有打印日志。所以我想把manager加上,这样我可以在控制台上卸载项目,命令行一样卸载的目的。这就需要修改Server Locations了,以下说明Server Locations几项目设置。

Server Locations包括三个选项:

  • Use workspace metadata(dose not modify Tomcat installation) 使用workspace的工作空间,不影响本地Tomcat安装配置
  • Use Tomcat installation (takes control of Tomcat installation)
    使用和控制本地安装的Tomcat
  • Use custom location (dose not modify Tomcat installation)
    使用自定义的目录,不影响本地Tomcat安装配置

image

我们平时使用的配置都是第一项,tomcat启动的时候,war包和日志实际的路径可以在Open launch configuration这里找到:

image

image

我今天要使用的是第二项Use Tomcat installation,启动后,可以在tomcat的目录下看到wtpwebapps目录(其中wtpwebapps目录可以改为webapps,因不想影响里边的程序就没改),并且在logs目录下也能看到访问日志。
image

然后在%tomcat%/conf/tomcat-users.xml增加用户,再从http://localhost:8080/manager/html登录就可以部署和卸载war应用了。

网友评论

登录后评论
0/500
评论
填坑大人
+ 关注