OutOfMemoryError在C3P0PooledConnectionPoolManager中。

14 浏览
0 Comments

OutOfMemoryError在C3P0PooledConnectionPoolManager中。

我的应用程序运行在以下环境下:\n

    \n

  • apache-tomcat-7.0.27;
  • \n

  • primefaces 3.1.1;
  • \n

  • mysql-connector-java-5.0.8;
  • \n

  • jsf 2.0;
  • \n

  • c3p0-0.9.2-pre2;
  • \n

  • hibernate3;
  • \n

\n在启动服务器和访问几个页面之后的几分钟内,我遇到了以下问题:\n

Exception in thread "C3P0PooledConnectionPoolManager-Helper Thread-#0" java.lang.OutOfMemoryError: PermGen space

\n这很奇怪,因为我并没有对系统造成过大压力,只是进行了简单的访问。\n我猜想这可能是c3p0的问题,或者我漏掉了什么。\n无论如何,这是我的c3p0配置(*):\n

    \n

  • HibernateConnectionProviderClass = \"org.hibernate.connection.C3P0ConnectionProvider\";
  • \n

  • HibernateC3p0MinSize = \"3\"
  • \n

  • HibernateC3p0MaxSize = \"5\"
  • \n

  • HibernateC3p0Timeout = \"1800\"
  • \n

  • HibernateC3p0IdleTestPeriod = \"100\"
  • \n

\n(*)请忽略配置格式,因为它在一个类中并在执行时运行。

0
0 Comments

OutOfMemoryError in C3P0PooledConnectionPoolManager的出现原因是服务器内存有限。解决方法是在setenv.sh或setenv.bat文件中的JAVA_OPTS变量中添加-XX:MaxPermSize=256m。该文件位于tomcat安装目录中的bin文件夹中。

0