大家好:
讲述一下今天遇到的问题:
Linux下部署项目,启动tomcat,项目报初始化错误,经过几次测试,本地项目运行正常,将Linux下tomcat解压的项目放到本地测试运行也正常,看来项目没有问题。
那tomcat启动后,可以访问tomcat,却不能访问项目。重新配置tomcat也是类似的问题,项目初始化报错。
查看日志(部分日志):
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 'wfCommonService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.iss.iaf.workflow.core.service.IWorkflowClientService
最后查找的原因是,tomcat内存设置的太大了……
解决方法:
Windows下,在文件/bin/catalina.bat,Linux下,在文件/bin/catalina.sh的前面,增加如下设置:
JAVA_OPTS=-Xms【初始化内存大小】 -Xmx【可以使用的最大内存】
JAVA_OPTS 这个是,TOMCAT已经定义好的,名,你只需要将
JAVA_OPTS=-Xms256m -Xmx512m
这句话,添加到
catalina.bat(windows)
set JAVA_OPTS=-Xms256m -Xmx512m
catalina.sh(linux)
JAVA_OPTS=-Xms256m -Xmx512m