websphere 7(和 Spring Roo)与 javax.el.ELException 不兼容
我有一个应用程序,其前端基于 Spring Roo 1.1.2 jspx 文件。
每个想法在 Tomcat 6 中都工作正常,但如果我在 Websphere 7 中部署相同的应用程序(类加载器:父级最后),则会出现异常:
java.lang.ClassCastException:java.lang.NullPointerException 与 javax.el 不兼容。 ELException
[13.04.11 09:53:55:493 UTC] 00000026 servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet /WEB-INF/layouts/default.jspx in application cyber. Exception created : com.ibm.websphere.servlet.error.ServletErrorReport: java.lang.ClassCastException: java.lang.NullPointerException incompatible with javax.el.ELException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:693)
at com.ibm._jsp._default_5F_jspx._jspService(_default_5F_jspx.java:123)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:104)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:895)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:932)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:239)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:341)
at org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:241)
...
Caused by: java.lang.ClassCastException: java.lang.NullPointerException incompatible with javax.el.ELException
at org.apache.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:139)
at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:151)
at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:194)
at org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:67)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:773)
at com.ibm.ws.jsp.tagfile.webinf.util._load_2D_scripts.doTag(_load_2D_scripts.java:74)
at com.ibm._jsp._default_5F_jspx._jspx_meth_util_load$1scripts_0(_default_5F_jspx.java:140)
at com.ibm._jsp._default_5F_jspx._jspService(_default_5F_jspx.java:94)
... 88 more
该应用程序有一个 Flex/BlazeDS 部分,工作正常。但还有这个 JSP(x) 部分。 Spring控制器可以工作,但是JSPX有问题,我不知道从哪里开始,当我正确理解规范时,WAS7提供了JSP 2.1,这正是我所需要的。
WAR 的 POM 的相关部分是:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>com.springsource.javax.servlet.jsp.jstl</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
有人能给我提示吗?
这是 Maven 依赖树:
[INFO] +- cyber:cyber-core:jar:4.0.0.0-D1-SNAPSHOT:compile
[INFO] | +- javax.validation:com.springsource.javax.validation:jar:1.0.0.GA:compile
[INFO] | +- javax.transaction:com.springsource.javax.transaction:jar:1.1.0:compile
[INFO] | +- org.apache.poi:poi:jar:3.6:compile
[INFO] | +- net.sf.jxls:jxls-core:jar:0.9.9:compile
[INFO] | | +- commons-beanutils:commons-beanutils:jar:1.8.2:compile
[INFO] | | \- commons-jexl:commons-jexl:jar:1.1:compile
[INFO] | | \- junit:junit:jar:3.8.1:compile
[INFO] | +- net.sf.jxls:jxls-reader:jar:0.9.9:compile
[INFO] | +- org.apache.commons:com.springsource.org.apache.commons.dbcp:jar:1.2.2.osgi:compile
[INFO] | | \- org.apache.commons:com.springsource.org.apache.commons.pool:jar:1.3.0:compile
[INFO] | +- commons-io:commons-io:jar:1.4:compile
[INFO] | +- org.apache.commons:com.springsource.org.apache.commons.collections:jar:3.2.1:compile
[INFO] | +- commons-lang:commons-lang:jar:2.4:compile
[INFO] | +- commons-math:commons-math:jar:1.2:compile
[INFO] | +- jdom:jdom:jar:1.0:compile
[INFO] +- org.springframework:org.springframework.core:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:org.springframework.beans:jar:3.0.5.RELEASE:compile
[INFO] | \- org.springframework:org.springframework.asm:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:org.springframework.context:jar:3.0.5.RELEASE:compile
[INFO] | \- org.springframework:org.springframework.expression:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:org.springframework.web:jar:3.0.5.RELEASE:compile
[INFO] | \- org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0:compile
[INFO] +- org.springframework:org.springframework.web.servlet:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:org.springframework.aop:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:org.springframework.aspects:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:org.springframework.orm:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:org.springframework.jdbc:jar:3.0.5.RELEASE:compile
[INFO] | \- org.springframework:org.springframework.transaction:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:org.springframework.context.support:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile
[INFO] | | \- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-context-support:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:3.0.5.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework.webflow:spring-js-resources:jar:2.2.1.RELEASE:compile
[INFO] +- org.springframework.security:org.springframework.security.core:jar:3.0.3.RELEASE:compile
[INFO] | \- org.apache.commons:com.springsource.org.apache.commons.logging:jar:1.1.1:compile
[INFO] +- org.springframework.security:org.springframework.security.web:jar:3.0.3.RELEASE:compile
[INFO] +- org.springframework.security:org.springframework.security.config:jar:3.0.3.RELEASE:compile
[INFO] +- org.apache.tiles:tiles-core:jar:2.2.1:compile
[INFO] | +- org.apache.tiles:tiles-api:jar:2.2.1:compile
[INFO] | +- commons-digester:commons-digester:jar:2.0:compile
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.5.10:compile
[INFO] +- org.apache.tiles:tiles-jsp:jar:2.2.1:compile
[INFO] | +- org.apache.tiles:tiles-servlet:jar:2.2.1:compile
[INFO] | \- org.apache.tiles:tiles-template:jar:2.2.1:compile
[INFO] +- org.tuckey:urlrewritefilter:jar:3.1.0:compile
[INFO] +- org.springframework:spring-oxm:jar:3.0.5.RELEASE:compile
[INFO] +- javax.servlet:com.springsource.javax.servlet.jsp.jstl:jar:1.2.0:compile
[INFO] | \- org.apache.taglibs:com.springsource.org.apache.taglibs.standard:jar:1.1.2:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- org.aspectj:aspectjweaver:jar:1.6.9:compile
[INFO] +- org.aspectj:aspectjrt:jar:1.6.9:compile
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使 Roo 生成的 JSPX 在 Websphere 7 上运行的 4 个步骤
或者我最后两天的情况
问题是 Roo (1.1.2) 生成的 JSPX 文件与 IBM Webshpere 不兼容。所以这不是图书馆的问题。
要运行 Roo 模板,您需要执行以下操作:
第一个问题(导致 java.lang.ClassCastException: java.lang.NullPointerException 与 javax.el.ELException 不兼容)异常是这样的WEB-INF/layout/default.jspx 中的
行我绝对不知道为什么,因为所有其他 tagx 都可以工作(我花了整个晚上< /em>))。 tagx)将发生一个新的验证错误:这是因为IBM在解析
'
中的jstl函数时出现问题。例如:${fn:toLowerCase(userLocale)}
。这正是步骤 1 中从load-scripts.tagx
复制到default.jspx
的行之一。我的解决方法是:替换:by:
Now您会看到一些东西,但是我查看输出,您会看到,IBM Websphere 7 不会删除 div 形式的名称空间定义。但在模板中你会有很多这样的
我不是 100% 确定是否需要此步骤,但您需要下一步。
现在一切正常,除了 Java 脚本。那是因为 IBM Websphere 7 规范化了 JSPX 输出。所以像这样的行:
成为
不幸的是 IE 和 Firefox (3) 忽略了这个 script 标签。解决方法是将
到所有 (3) 个相关脚本标记的脚本部分,在步骤 1 中复制。至少您的 default.jspx 如下所示:
The 4 steps to make a Roo generated JSPX running on Websphere 7
or how I spend my last two days
The problem is that the Roo (1.1.2) generated JSPX files are not compatible with IBM Webshpere. So it is not a problem of the libaries.
To get the Roo templates running you need to do this:
The first problem (that causes the
java.lang.ClassCastException: java.lang.NullPointerException incompatible with javax.el.ELException
Exception is this line<util:load-scripts />
in WEB-INF/layout/default.jspx I have absolute no idea why, because all other tagx work (I spend my whole evening). The easiest work arround is to "include" the relevant content of /WEB-INF/tags/util/load-scripts.tagx direct by hand in default.jspx. (Then you can delete the load-scripts.tagx)A new Validation error will occure: this is because IBM seams to have problems to parse jstl functions in
'
. For example:${fn:toLowerCase(userLocale)}
. And this is exacly one of the lines copied fromload-scripts.tagx
todefault.jspx
in step 1. My workarround is: to replace:by:
Now you will see something, but I you look at the output, you will see, hat IBM Websphere 7 does not remove the namespace definitions form divs. But in the template you will have a lot of this
<div xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:spring="http://www.springframework.org/tags" version="2.0">
So what you need to do is extract all of them in to<jsp:root
elements (In all jspx files). So that the files looks like that:I am not 100% sure if this step is need, but you need the next one.
Now everything works, except the Java Scripts. That is because IBM Websphere 7, Normalize the JSPX output. So that lines like that:
become
<script src="${spring_dojo_url}" type="text/javascript" />
unfortunately IE and Firefox (3) ignore this script tags. The workaround is to put a<jsp:text> </jsp:text>
in to the script part of all (3) relevant script tags, copied in step 1.At least your default.jspx look like this:
此外,您还需要使用 js 注释
//
来确保面板与 Websphere7 正常工作,否则您将看不到折叠面板。转换以下文件的最后几行,如下所示:(您可能还需要使用此字段编辑 jsp 文件,以避免执行缓存/编译版本)
此外,Websphere 7 没有内置对 png 文件的支持,并且它们不会渲染,除非您将它们转换为 jpg 并编辑标签以使用 jpg 而不是 png 文件,或者您可以安装支持 png 的插件到 Websphere 7
编辑:
将以下内容添加到 web.xml 也可以解决问题
Also you need to use js comments
//
to make sure panels work with Websphere7 properly, otherwise you won't be seeing folding panels.Convert below file last lines like below: (You may need to edit the jsp files using this fiel as well to avoid the execution of cached/compiled version)
Also Websphere 7 does not have built in support for png files and they won't be rendered unless you convert them to jpg and edit the tags to use jpg instead of png files, or you may install the addon for png support to Websphere 7
EDIT:
Adding below to web.xml may solve the problem as well
WebSphere 7 默认不支持 png 文件;此链接显示您只需添加一个新的 MIME 类型,它对我有用。
http://pic.dhe.ibm.com/infocenter/mpadoc/v7r0m0/index.jsp?topic=%2Fcom.ibm.websphere.wemp.doc%2Fconfiguring%2Fconfiguringwastoacceptmimetypes.html
您可以配置 WebSphere应用服务器支持 PNG MIME 类型。
如果您正在使用 WebSphere Application Server,请执行以下步骤来配置 WebSphere Application Server 以支持 PNG MIME 类型。
过程
1.登录到WebSphere® Application Server 集成解决方案控制台。
2.展开环境>虚拟主机。
3.单击default_host。
4.单击其他属性> MIME 类型。
5.单击新建。
6.输入 image/png 作为 MIME 类型字段的值。
7.输入 png 作为扩展名字段的值。
8.单击“确定”保存新的 MIME 类型。
9.保存配置更改。
png files are not supported by default in WebSphere 7; this links shows that you just have to add a new MIME type and it worked for me.
http://pic.dhe.ibm.com/infocenter/mpadoc/v7r0m0/index.jsp?topic=%2Fcom.ibm.websphere.wemp.doc%2Fconfiguring%2Fconfiguringwastoacceptmimetypes.html
You can configure WebSphere Application Server to support the PNG MIME type.
If you are using WebSphere Application Server, perform the following steps to configure WebSphere Application Server to support the PNG MIME type.
Procedure
1.Log in to the WebSphere® Application Server Integrated Solutions Console.
2.Expand Environments > Virtual Hosts.
3.Click default_host.
4.Click Additional Properties > MIME Types.
5.Click New.
6.Enter image/png as the value for the MIME Type field.
7.Enter png as the value for the Extension field.
8.Click OK to save the new MIME type.
9.Save the configuration changes.