websphere 7 (and Spring Roo) incompatible with javax.el.ELException

后端 未结 3 1750
不思量自难忘°
不思量自难忘° 2021-02-03 14:58

I have a application where the frontend is based on the Spring Roo 1.1.2 jspx files.

Every think works fine in Tomcat 6, but if I deploy the same application in a Websph

相关标签:
3条回答
  • 2021-02-03 15:37

    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)

    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>
    

    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

    <mime-mapping>
      <extension>png</extension>
      <mime-type>image/png</mime-type> 
    </mime-mapping>
    
    0 讨论(0)
  • 2021-02-03 15:41

    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.

    0 讨论(0)
  • 2021-02-03 15:45

    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 from load-scripts.tagx to default.jspx in step 1. My workarround is: to replace:

      <script type="text/javascript">var djConfig = {parseOnLoad: false, isDebug: false, locale: '${fn:toLowerCase(userLocale)}'};</script>
      

    by:

       <c:set var="userLocalLowerCase" value="${fn:toLowerCase(userLocale)}" /> 
       <script type="text/javascript">var djConfig = {parseOnLoad: false, isDebug: false, locale: '${userLocalLowerCase}'};</script>
    
    • 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:

      <jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core" ... version="2.0">
      <div>
          ...
      </div>
      </jsp:root>
      

      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:

      <script src="${spring_dojo_url}" type="text/javascript"><!-- required for FF3 and Opera --></script>
      

      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.

      <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>
      

    At least your default.jspx look like this:

    <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>
    
    0 讨论(0)
提交回复
热议问题