zjnbshifox 2008-06-22 22:18
浏览 240
已采纳

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

[list=1]
[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
]
[/list]

  • 写回答

1条回答 默认 最新

  • lggegegmail 2008-06-22 23:48
    关注

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

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

    在我的Eclipse的Tomcat的Run Configuration的VM arguments的内容如下:
    [quote]-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"[b][color=red] -Xmx512m[/color][/b][/quote]

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 如何解决访问网址被屏蔽的情况
  • ¥15 本地运行的vue2项目,使用内网穿透,前端界面一直转圈圈
  • ¥20 powerbuilder datawindow控件导出Excel数据,可不可以不自动覆盖原数据,而是在后面新插入入数据。
  • ¥100 无轴承永磁同步电机控制
  • ¥15 eps里添加本地倾斜模型
  • ¥15 telegram 问题
  • ¥15 nrf52810-c三个a 程序
  • ¥50 求一个半透明没有锯齿的圆角窗体的实现例子
  • ¥15 STM32cubeMX里的FreeRTOS无法释放内存
  • ¥15 CATIA有些零件打开直接单机确定终止