将Struts2应用程序部署到Weblogic 12c

NuA*_*Man 6 oracle weblogic struts2 action-mapping

我有一个使用Struts2,Spring和JPA的Web应用程序.在应用程序中,我们正在使用注释.当我们在eclipse中部署应用程序时,如果我们将其部署为虚拟应用程序(右键单击服务器,选择属性,选择WebLogic,选择发布模式),应用程序运行正常.此选项生成_auto_generated_ear文件并运行应用程序. 当我将其部署为展开的归档文件或通过管理控制台手动将应用程序部署为.war文件时,我收到以下错误消息:

[[ACTIVE] ExecuteThread:'8'表示队列:'weblogic.kernel.Default(self-tuning)'] WARN org.apache.struts2.dispatcher.Dispatcher - 找不到操作或结果:/eServices/login.action There没有映射名称空间[/]的动作和与上下文路径[/ eServices]关联的动作名称[登录]. - com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)中的[未知位置]位于org.apache.struts2.impl上的org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63).位于org.apache的org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:552)的com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)中的StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)位于weblogic.servlet.internal.FilterChainImpl.doFilter的org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)中的.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) (FilterChainImpl.java:56)位于oracle.security.jps.util的java.security.AccessController.doPrivileged(Native Method)的oracle.security.jps.ee.http.JpsAbsFilter $ 1.run(JpsAbsFilter.java:111). oracle.security.jps中的JpsSubject.doAsPrivileged(JpsSubject.java:313)位于oracle.security.jps.ee.http.JpsAbsFilter.doFilter的oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)中的.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413) (JpsAbsFilter.java:161)位于oracle.dms的weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)的oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71). servlog.DMSServletFilter.doFilter(DMSServletFilter.java:136)位于weblogic.servome.servial.Web上的weblogic.servlet.inperi.WebAppServletContext $ ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)的weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) .loglet.internal.WebAppServletContext $ ServletInvocationAction.run(WebAppServletContext.java:3681)at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)at weblogic.security.service.SecurityManager.runAs(SecurityManager.java) :120)at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.jav)a:2277)weblogic.servlet.internal.WebAppServletContext.exe(WebAppServletContext.java:2183)at weblogic.servlet.invine.ServletRequestImpl.run(ServletRequestImpl.java:1454)at weblogic.work.ExecuteThread.execute(ExecuteThread.java) :209)at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

任何WebLogic专家都能指出我正确的方向吗?在WebLogic中运行的Struts2的Convention-plugin是否存在问题?任何帮助将不胜感激.提前致谢.

更新:

web.xml中

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">
    <display-name>eServices</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Needed to manage the Java based @Configuration classes for Spring -->
    <context-param>
        <param-name>contextClass</param-name>
        <param-value>
         org.springframework.web.context.support.AnnotationConfigWebApplicationContext
        </param-value>
    </context-param>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>com.ceiwc.es.config</param-value>
    </context-param>

    <!-- Handles Strut2 URL requests -->
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <session-config>
        <session-timeout>20</session-timeout>
    </session-config>
</web-app>
Run Code Online (Sandbox Code Playgroud)

在struts.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

    <!-- Struts Constants that override the struts.properties file -->
    <constant name="struts.devMode" value="false" />
    <constant name="struts.custom.i18n.resources" value="global" />
    <constant name="struts.ui.theme" value="simple" />

</struts>
Run Code Online (Sandbox Code Playgroud)

NuA*_*Man 5

这是最终有效的解决方案!我添加了以下Struts2属性:

<constant name="struts.convention.action.includeJars" value=".*?\.jar(!/|/)?" />
<constant name="struts.convention.action.fileProtocols" value="jar,zip" />
Run Code Online (Sandbox Code Playgroud)

这是基于我在这篇文章中发现

另外,将这个属性添加到weblogic.xml可能也有帮助:

<wls:container-descriptor>
    <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
</wls:container-descriptor>
Run Code Online (Sandbox Code Playgroud)

没有与我的项目做到这一点。

希望这对以后的人有所帮助!