今天一个在tomcat中运行的好好的Web项目,部署到Jboss4.2.1中之后报各种jsp编译错误:
Unable to compile class for JSP、
statements are only available if source level is 5.0、
网上找到方法:修改
<%JBOSS_HOME%>\server\default\deploy\jbossweb-tomcat55.sar\conf\web.xml
因为在我的Jboss目录中没找到jbossweb-tomcat55.sar
我就修改了<%JBOSS_HOME%>\server\default\all\jboss-web.deployer\conf\web.xml
在org.apache.jasper.servlet.JspServlet中添加
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.5</param-value>
</init-param>
之后正常运行。
原因:JBoss 4.0.5 by default doesn't allow JDK 1.5 code inside jsps. To remove this limitation, we have to uncomment the following init-param inside JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/conf/web.xml