5

フロントエンドが 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
4

3 に答える 3

11

Rooで生成されたJSPXをWebsphere7で実行するための4つのステップ

または私が最後の2日間をどのように過ごすか


問題は、Roo(1.1.2)で生成されたJSPXファイルがIBMWebshpereと互換性がないことです。したがって、それは図書館の問題ではありません。

Rooテンプレートを実行するには、次のようにする必要があります。

  • 最初の問題(java.lang.ClassCastException: java.lang.NullPointerException incompatible with javax.el.ELException例外の原因は<util:load-scripts />WEB-INF / layout / default.jspxのこの行です。他のすべてのtagxが機能するため、理由はまったくわかりません(私は夜中ずっと過ごします)。最も簡単な回避策は「含める」ことです。 /WEB-INF/tags/util/load-scripts.tagxの関連コンテンツをdefault.jspxに手動で直接入力します(その後、load-scripts.tagxを削除できます)

  • 新しい検証エラーが発生します。これは、IBMがでjstl関数を解析する際に問題が発生するため'です。例:${fn:toLowerCase(userLocale)}load-scripts.tagxそして、これはまさにステップ1でからにコピーされた行の1つです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>
  • これで何かが表示されますが、出力を見ると、IBMWebsphere7がdivから名前空間定義を削除していないことがわかります。しかし、テンプレートにはこれがたくさんある<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)はこのスクリプトタグを無視します。回避策は<jsp:text> </jsp:text>、ステップ1でコピーした、関連するすべての(3)スクリプトタグのスクリプト部分にを挿入することです。

    <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>
于 2011-04-14T17:57:43.063 に答える
1

また、パネルが Websphere7 で適切に動作するように js コメントを使用する必要があり//ます。そうしないと、折りたたみパネルが表示されません。

以下のようにファイルの最後の行を変換します: (キャッシュ/コンパイルされたバージョンの実行を避けるために、このフィールドを使用して 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 ファイルのサポートが組み込まれておらず、png ファイルを jpg に変換し、png ファイルの代わりに jpg を使用するようにタグを編集しない限りレンダリングされません。または、Websphere 7 に png サポート用のアドオンをインストールすることもできます。

編集: web.xml に以下を追加すると、問題も解決する場合があります

<mime-mapping>
  <extension>png</extension>
  <mime-type>image/png</mime-type> 
</mime-mapping>
于 2012-01-03T16:22:52.493 に答える
1

png ファイルは、WebSphere 7 ではデフォルトでサポートされていません。このリンクは、新しいMIMEタイプを追加するだけでうまくいくことを示しています。 http://pic.dhe.ibm.com/infocenter/mpadoc/v7r0m0/index.jsp?topic=%2Fcom.ibm.websphere.wemp.doc%2Fconfiguring%2Fconfiguringwastoacceptmimetypes.html

PNG MIME タイプをサポートするように WebSphere Application Server を構成できます。

WebSphere Application Server を使用している場合は、次の手順を実行して、PNG MIME タイプをサポートするように WebSphere Application Server を構成します。

手順

1.WebSphere® Application Server Integrated Solutions Console にログインします。

2.[環境] > [仮想ホスト] を展開します。

3.default_host をクリックします。

4.[追加のプロパティ] > [MIME タイプ] をクリックします。

5. [新規] をクリックします。

6.MIME タイプ フィールドの値として image/png を入力します。

7.拡張子フィールドの値として png を入力します。

8. [OK] をクリックして、新しい MIME タイプを保存します。

9.構成の変更を保存します。

于 2013-05-20T15:07:29.027 に答える