websphere 7(和Spring Roo)与javax.el.E​​LException不兼容

| 我有一个前端基于Spring Roo 1.1.2 jspx文件的应用程序。 每个想法在Tomcat 6中都可以正常工作,但是如果我在Websphere 7中部署相同的应用程序(类加载器:最后一个父级),则会出现异常: java.lang.ClassCastException:java.lang.NullPointerException与javax.el.E​​LException不兼容
[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
    
已邀请:
使Roo生成的JSPX在Websphere 7上运行的4个步骤 或我过去两天的时间 问题是Roo(1.1.2)生成的JSPX文件与IBM Webshpere不兼容。因此,这不是库的问题。 要使Roo模板运行,您需要执行以下操作: 第一个问题(导致
java.lang.ClassCastException: java.lang.NullPointerException incompatible with javax.el.ELException
异常的原因是WEB-INF / layout / default.jspx中的line4ѭ行),我绝对不知道为什么,因为所有其他tagx都可以工作(我整晚都在这里度过)。最简单的工作方法是\手动直接在default.jspx中“包含\” / WEB-INF / tags / util / load-scripts.tagx的相关内容(然后可以删除load-scripts.tagx) 将会发生一个新的验证错误:这是因为IBM似乎在解析
\'
中的jstl函数时遇到了问题。例如:
${fn:toLowerCase(userLocale)}
。这恰好是在步骤1中从
load-scripts.tagx
复制到
default.jspx
的行之一。我的工作方式是:替换为:
<script type=\"text/javascript\">var djConfig = {parseOnLoad: false, isDebug: false, locale: \'${fn:toLowerCase(userLocale)}\'};</script>
通过:
   <c:set var=\"userLocalLowerCase\" value=\"${fn:toLowerCase(userLocale)}\" /> 
   <script type=\"text/javascript\">var djConfig = {parseOnLoad: false, isDebug: false, locale: \'${userLocalLowerCase}\'};</script>
现在您将看到一些内容,但是我将看到输出,您将看到,IBM Websphere 7不会从divs除去名称空间定义。但是在模板中,您将会有很多
<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\">
元素,因此您需要做的就是将它们全部提取到
<jsp:root
元素中(在所有jspx文件中)。这样文件看起来像这样:
<jsp:root xmlns:c=\"http://java.sun.com/jsp/jstl/core\" ... version=\"2.0\">
<div>
    ...
</div>
</jsp:root>
我不确定是否需要执行此步骤,但您不确定是否需要100%的下一步。 现在,除了Java脚本之外,其他所有东西都可以使用。那是因为IBM Websphere 7,规范化JSPX输出。这样的行:
<script src=\"${spring_dojo_url}\" type=\"text/javascript\"><!-- required for FF3 and Opera --></script>
不幸成为
<script src=\"${spring_dojo_url}\" type=\"text/javascript\" />
IE和Firefox(3)忽略了此脚本标签。解决方法是在步骤1中复制的所有(3)相关脚本标记的脚本部分中添加ѭ16。
<script src=\"${dojo_url}\" type=\"text/javascript\"><!-- required for FF3 and Opera --><jsp:text> </jsp:text></script>
<script src=\"${spring_url}\" type=\"text/javascript\"><!-- /required for FF3 and Opera --><jsp:text> </jsp:text></script>
<script src=\"${spring_dojo_url}\" type=\"text/javascript\"><!-- required for FF3 and Opera --><jsp:text> </jsp:text></script>
至少您的default.jspx看起来像这样:
<jsp:root 
        xmlns:jsp=\"http://java.sun.com/JSP/Page\"
        xmlns:fn=\"http://java.sun.com/jsp/jstl/functions\"
        xmlns:c=\"http://java.sun.com/jsp/jstl/core\"
        xmlns:tiles=\"http://tiles.apache.org/tags-tiles\"
        xmlns:spring=\"http://www.springframework.org/tags\"
        xmlns:util=\"urn:jsptagdir:/WEB-INF/tags/util\"
        version=\"2.0\">
<html>  

    <jsp:output doctype-root-element=\"HTML\" doctype-system=\"-//W3C//DTD HTML 4.01//EN\" doctype-public=\"http://www.w3.org/TR/html4/strict.dtd\"/>

    <jsp:directive.page contentType=\"text/html;charset=UTF-8\" />  
    <jsp:directive.page pageEncoding=\"UTF-8\" /> 

    <head>
        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />
        <meta http-equiv=\"X-UA-Compatible\" content=\"IE=8\" />

        <spring:url value=\"/resources/styles/standard.css\" var=\"roo_css_url\" />
        <spring:url value=\"/resources/dojo/dojo.js\" var=\"dojo_url\" />
        <spring:url value=\"/resources/dijit/themes/tundra/tundra.css\" var=\"tundra_url\" />
        <spring:url value=\"/resources/spring/Spring.js\" var=\"spring_url\" />
        <spring:url value=\"/resources/spring/Spring-Dojo.js\" var=\"spring_dojo_url\" />
        <spring:url value=\"/resources/images/favicon.ico\" var=\"favicon\" />
        <link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"${roo_css_url}\"><!-- required for FF3 and Opera --></link>
        <link rel=\"stylesheet\" type=\"text/css\" href=\"${tundra_url}\"><!-- required for FF3 and Opera --></link>
        <link rel=\"SHORTCUT ICON\" href=\"${favicon}\" />

        <!-- Get the user local from the page context (it was set by Spring MVC\'s locale resolver) -->
        <c:set var=\"userLocale\">
          <c:out value=\"${pageContext.response.locale}\" default=\"en\" />
        </c:set>

        <c:set var=\"userLocalLowerCase\" value=\"${fn:toLowerCase(userLocale)}\" /> 
        <script type=\"text/javascript\">var djConfig = {parseOnLoad: false, isDebug: false, locale: \'${userLocalLowerCase}\'};</script>
        <script src=\"${dojo_url}\" type=\"text/javascript\"><!-- required for FF3 and Opera --><jsp:text> </jsp:text></script>
        <script src=\"${spring_url}\" type=\"text/javascript\"><!-- /required for FF3 and Opera --><jsp:text> </jsp:text></script>
        <script src=\"${spring_dojo_url}\" type=\"text/javascript\"><!-- required for FF3 and Opera --><jsp:text> </jsp:text></script>
        <script language=\"JavaScript\" type=\"text/javascript\">dojo.require(\"dojo.parser\");</script>        

        <spring:message code=\"application_name\" var=\"app_name\"/>
        <title><spring:message code=\"welcome_h3\" arguments=\"${app_name}\" /></title>
    </head>

    <body class=\"tundra spring\">
        <div id=\"wrapper\">
            <tiles:insertAttribute name=\"header\" ignore=\"true\" />
            <tiles:insertAttribute name=\"menu\" ignore=\"true\" />   
            <div id=\"main\">
                <tiles:insertAttribute name=\"body\"/> 
                <tiles:insertAttribute name=\"footer\" ignore=\"true\"/>
            </div>
        </div>
    </body>
</html>
</jsp:root>
    
另外,您还需要使用js注释(ѭ19)来确保面板可以与Websphere7一起正常使用,否则您将看不到折叠面板。 在文件下方转换最后几行,如下所示:(您可能还需要使用此字段来编辑jsp文件,以避免执行缓存/编译的版本)
load-scripts.tagx




  <script src=\"${dojo_url}\" type=\"text/javascript\">//<!-- required for FF3 and Opera --></script>
  <script src=\"${spring_url}\" type=\"text/javascript\">//<!-- /required for FF3 and Opera --></script>
  <script src=\"${spring_dojo_url}\" type=\"text/javascript\">//<!-- required for FF3 and Opera --></script>
  <script language=\"JavaScript\" type=\"text/javascript\">dojo.require(\"dojo.parser\");</script>
此外,Websphere 7还没有内置的对png文件的支持,除非将它们转换为jpg并编辑标签以使用jpg而不是png文件,否则它们将不会呈现,或者您可以为Websphere 7安装png支持的插件 编辑: 在web.xml中添加以下内容也可以解决问题
<mime-mapping>
  <extension>png</extension>
  <mime-type>image/png</mime-type> 
</mime-mapping>
    
缺省情况下,WebSphere 7不支持png文件。此链接表明您只需要添加一个新的MIME类型,它就可以为我工作。 http://pic.dhe.ibm.com/infocenter/mpadoc/v7r0m0/index.jsp?topic=%2Fcom.ibm.websphere.wemp.doc%2Fconfiguring%2Fconfiguringwastoacceptmimetypes.html 您可以将WebSphere Application Server配置为支持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 Type字段的值。 7.输入png作为扩展字段的值。 8.单击“确定”保存新的MIME类型。 9.保存配置更改。     

要回复问题请先登录注册