eclipse运行项目,tomcat报错:Exception in thread :http-bio-8080-exec-4

时间:2023-12-10 14:43:50

eclipse运行项目,tomcat报错:Exception in thread :http-bio-8080-exec-4

转自 https://www.cnblogs.com/yby-blogs/p/6283105.html

今天用eclipse开发项目后,新建一个tomcat的server,然后添加项目后启动,利用火狐浏览器进行访问一直报内存溢出:

Exception in thread ""http-bio-8080"-exec-1" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Druid-ConnectionPool-Destory" java.lang.OutOfMemoryError: PermGen space
at java.util.IdentityHashMap.keySet(IdentityHashMap.java:935)
at com.alibaba.druid.pool.DruidDataSource.removeAbandoned(DruidDataSource.java:1312)
at com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:1294)
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space

解决办法:

第一种办法:

  (1)打开tomcat所在的bin目录,找到catalina.bat,并修改:(如D:\Program Files\apache-tomcat-7.0.57\bin\catalina.bat

  (2)在“echo "Using CATALINA_BASE: $CATALINA_BASE"”上面加入以下行: 

      set JAVA_OPTS=%JAVA_OPTS% -server -XX:PermSize=128M -XX:MaxPermSize=512m

如果第一种办法不起作用,请看第二种办法!!!!

第二种办法:

  (1)找到eclipse中的server栏目,然后双击tomcat,打开tomcat的配置文件

  (2)点击General Information栏目下的Open launch configuration

  eclipse运行项目,tomcat报错:Exception in thread :http-bio-8080-exec-4

  (3)找到Arguments选项卡,在VM arguments下的输入项末尾追加这句话:-Xms128m -Xmx1024m -XX:MaxPermSize=512m

eclipse运行项目,tomcat报错:Exception in thread :http-bio-8080-exec-4