tomcat 部署多个工程 内在溢出

在部署多个web project时,有时会出现在以下错误。
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MessageDAO' defined in ServletContext resource [/WEB-INF/applicationContext_beans.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 ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: PermGen space
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: PermGen space

如:web project1和web project2,这两个项目所引用的包都为如下所示,
[img]http://dl.iteye.com/upload/attachment/0083/2365/16b3b60a-33c8-33ff-943f-70164e37698f.png[/img]
这样,将它们一同部署到tomcat后,就会报错。但是,单独部署任何一个工程都可以成功启动。找了一些资料,有的说是得修改eclipse的内存配置,甚至修改相应注册表上的信息,而修改了也未必能够解决。其实大可不必,只需将“Tomcat 6.0\webapps\web project1\WEB-INF\lib”和“Tomcat 6.0\webapps\web project2\WEB-INF\lib”下的包
[img]http://dl.iteye.com/upload/attachment/0083/2375/b9438c2c-a9ce-3991-9680-44de80854238.png[/img]
都剪切到“Tomcat 6.0\lib”下即可,
[img]http://dl.iteye.com/upload/attachment/0083/2379/f2d03238-d565-3eb6-b28e-273484452e90.png[/img]
如果遇到重复,替换一下就行,最后启动tomcat就可以运行了。

你可能感兴趣的:(我的疑问)