【问题标题】:Struts2 on WebsphereWebsphere 上的 Struts2
【发布时间】:2015-09-23 10:22:50
【问题描述】:

我有一个 Struts2 应用程序,它在 Eclipse 上运行良好,我还在普通的 Tomcat6 Web 服务器上进行了尝试(将 .war 文件复制到 webapps 文件夹)。

但是在 WebSphere Application Server 上部署 .war 文件后,在应用程序中提交表单时收到以下错误:

知道怎么解决吗?

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 
javax.servlet.ServletException: Filter execution threw an exception



root cause 
java.lang.NoSuchMethodError: ognl/SimpleNode.isEvalChain(Lognl/OgnlContext;)Z
    com.opensymphony.xwork2.ognl.OgnlUtil.isEvalExpression(OgnlUtil.java:223)
    com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:214)

【问题讨论】:

  • 类路径中有一些旧的OGNL依赖,删除它。
  • 生成war文件时,war文件包含一个ognl-3.0.5.jar文件。我试图将它排除在依赖之外,但我收到了同样的问题。 struts2-core 包含 OGNL 依赖项。在 Tomcat6 和 Tomcat7 服务器上,它运行良好,符合预期。
  • 不要排除ognl-3.0.5。在使用应用程序库的 websphere 中配置您的应用程序。
  • 我们计划使用 Apache Geronimo(在 Websphere Application Server 上)。
  • 尝试通过 WebSphere 管理控制台在 Web 模块配置选项中将类加载器配置为 Parent_Last。

标签: java eclipse tomcat struts2 websphere


【解决方案1】:

geronimo-web.xml 文件已添加到生成的 war 文件的根文件夹中

App_ID 是我的应用程序的。

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
    <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
        <dep:moduleId>
            <dep:groupId>default</dep:groupId>
            <dep:artifactId>App_ID</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>war</dep:type>
        </dep:moduleId>
        <dep:hidden-classes>
            <dep:filter>ognl</dep:filter>
            <!--
            <dep:filter>org.apache.axis2</dep:filter>
            <dep:filter>javax.xml.bind</dep:filter>
            <dep:filter>javax.xml.ws</dep:filter>
            -->
        </dep:hidden-classes>
    </dep:environment>
    <context-root>/App_ID</context-root>
</web-app>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-20
    • 2021-09-02
    • 1970-01-01
    • 2012-01-09
    • 2012-10-16
    • 2011-01-13
    相关资源
    最近更新 更多