0 0

SSH出现Caused by: java.lang.OutOfMemoryError: Java 5


    [Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/addUser' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'userDAOProxy' while setting bean property 'dao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDAOProxy' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: Java heap space
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDAOProxy' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: Java heap space
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: Java heap space
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: Java heap space
    Caused by: java.lang.OutOfMemoryError: Java heap space
    ]
2008年6月22日 22:18

1个答案 按时间排序 按投票排序

0 0

采纳的答案

看得出来,是在Tomcat等在加载ApplicationContext过程中,由于初始的Bean过多而发生的OOM。解决方法就是给Tomcat启动加大启动内存。

[1] 如果是在Eclipse中的Tomcat启动的,在启动配置中设置一个参数
-Xmx512m 当然视你自己情况配置一个大小。

在我的Eclipse的Tomcat的Run Configuration的VM arguments的内容如下:

引用
-Dcatalina.base="D:\WORKSPACE\SDK-3.4\RAP\.metadata\.plugins\org.eclipse.wst.server.core\tmp0" -Dcatalina.home="D:\JAVA\apache-tomcat-5.5.20" -Dwtp.deploy="D:\WORKSPACE\SDK-3.4\RAP\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps" -Djava.endorsed.dirs="D:\JAVA\apache-tomcat-5.5.20\common\endorsed" -Xmx512m


[2] 如果直接使用Tomcat启动的,
找到tomcat\bin\catalina.bat文件,同样也是加这个启动参数。
下面是我的Tomcat的catalina.bat文件配置效果:
引用
set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties" -Xmx512m

2008年6月22日 23:48

相关推荐

Global site tag (gtag.js) - Google Analytics