本文介绍了未发现Action类 - Struts的2.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<Jul 29, 2015 10:55:58 AM IST> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.st
ruts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.
Unable to load configuration. - action - zip:C:/DEV/bea92MP3/user_projects/domains/cv_domain/servers/AdminServer/tmp/_WL
_user/ficv2/3ie869/war/WEB-INF/lib/_wl_cls_gen.jar!/struts.xml:9:72
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:493)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:309)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    Truncated. see log file for complete stacktrace
Unable to load configuration. - action - zip:C:/DEV/bea92MP3/user_projects/domains/cv_domain/servers/AdminServer/tmp/_WL
_user/ficv2/3ie869/war/WEB-INF/lib/_wl_cls_gen.jar!/struts.xml:9:72
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
        at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)
        at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
        Truncated. see log file for complete stacktrace
Action class [com.login.action.LoginAction] not found - action - zip:C:/DEV/bea92MP3/user_projects/domains/cv
_domain/servers/AdminServer/tmp/_WL_user/ficv2/3ie869/war/WEB-INF/lib/_wl_cls_gen.jar!/struts.xml:9:72

我得到上面的异常上部署的耳朵用struts 2.3罐子到WebLogic
服务器内置的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>
    <constant name="struts.devMode" value="true" />
    <package name="default" namespace="/" extends="struts-default">
        <action name="login" class="com.login.action.LoginAction">
            <result name="success">/jsp/index.jsp</result>
        </action>
    </package>
</struts>

的web.xml

    <?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>ficv2.0</display-name>
    <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>
    <welcome-file-list>
        <welcome-file>/jsp/index.jsp</welcome-file>
    </welcome-file-list>
</web-app>


下面是使用
jar的列表中。


Below is the list of jars used


  • 公地文件上传-1.3.1.jar

  • 的commons-IO-2.2.jar

  • 公地lang3-3.0.jar

  • 的freemarker-2.3.22.jar

  • Javassist进行-3.11.0.GA.jar

  • OGNL-3.0.6.jar

  • Struts2的核心-2.3.24.jar

  • XWork的核心-2.3.24.jar

  • commons-fileupload-1.3.1.jar
  • commons-io-2.2.jar
  • commons-lang3-3.0.jar
  • freemarker-2.3.22.jar
  • javassist-3.11.0.GA.jar
  • ognl-3.0.6.jar
  • struts2-core-2.3.24.jar
  • xwork-core-2.3.24.jar

的build.xml

<target name="set_env" unless="set_env" description="setup the properties.">

    <!-- All the system environment variables will be accessed by prefixing "env.".
    To do that following property has to be set and be pointing to env -->

    <property environment="env" />
    <property name="java.home" value="${env.JAVA_HOME}" />

    <!-- Settings for global directories -->

    <property name="root.dir" value="." />
    <property name="source.dir" value="${root.dir}/src" />
    <property name="build.dir" value="${root.dir}/build" />
    <property name="webapp.dir" value="${root.dir}/WebContent" />
    <property name="lib.dir" value="${webapp.dir}/WEB-INF/lib" />
    <property name="classes.dir" value="${webapp.dir}/WEB-INF/classes" />

    <!-- Refers to cvs_build dir -->
    <property name="web.jar.name" value="struts2.0-web" />
    <property name="ear.name" value="struts2.0" />
    <property name="war.name" value="struts2.0" />

    <!-- Class path settings -->
    <property name="struts.jars" value="${lib.dir}/struts2-core-2.3.24.jar ; ${lib.dir}/freemarker-2.3.22.jar ;
        ${lib.dir}/xwork-core-2.3.24.jar ; ${lib.dir}/ognl-3.0.6.jar ; ${lib.dir}/commons-fileupload-1.3.1.jar;
        ${lib.dir}/commons-io-2.2.jar; ${lib.dir}/commons-lang3-3.0.jar;${lib.dir}/javaassist-3.11.0.GA.jar;" />
    <!-- End - Class path settings -->

</target>

<target name="init" depends="set_env" description="Initializes the required directories.">
    <mkdir dir="${webapp.dir}" />
    <mkdir dir="${lib.dir}" />
    <mkdir dir="${classes.dir}" />
    <mkdir dir="${build.dir}" />
    <path id="project.class.path">
        <fileset dir="${lib.dir}">
            <include name="*.jar" />
        </fileset>
    </path>
</target>

<target name="clean" depends="set_env" description="Cleans up the classes and output directories">
    <echo message="Deleting Classes..." />
    <delete dir="${classes.dir}" />
    <echo message="Deleting ear and war..." />
    <delete dir="${build.dir}/${ear.name}.ear" />
    <delete dir="${build.dir}/${war.name}.war" />
</target>

<target name="compile" depends="init" description="Compiles all source files">
    <javac debug="on" srcdir="${source.dir}" destdir="${classes.dir}" verbose="true" classpath="${struts.jars}">
    </javac>
    <echo message="${webapp.dir}" />
    <copy file="${source.dir}/struts.xml" todir="${classes.dir}"/>
</target>

<target name="create_jar" depends="compile" description="Package the Java classes into a jar.">
    <echo message="Creating Jar file..." />
    <delete file="${webapp.dir}/WEB-INF/lib/${web.jar.name}.jar" />
    <jar jarfile="${webapp.dir}/WEB-INF/lib/${web.jar.name}.jar" basedir="${classes.dir}" includes="**/action/**" />
</target>

<target name="create_war">
    <delete file="${build.dir}/${war.name}.war" />
    <echo message="${webapp.dir}" />
    <jar jarfile="${build.dir}/${war.name}.war" update="yes" manifest="${webapp.dir}/META-INF/MANIFEST.MF">
        <fileset dir="${webapp.dir}">
            <include name="**" />
        </fileset>
        <zipfileset dir="${webapp.dir}/images" prefix="images">
            <include name="**" />
        </zipfileset>
    </jar>
</target>

<target name="create_ear" depends="create_war">
    <delete file="${build.dir}/${ear.name}.ear" />
    <ear earfile="${build.dir}/${ear.name}.ear" appxml="${root.dir}/META-INF/application.xml">
        <fileset dir="${build.dir}">
            <include name="*.jar" />
        </fileset>
        <fileset file="${build.dir}/${war.name}.war" />
    </ear>
</target>

<target name="all" depends="set_env, create_jar, create_ear" description="Perform all targets." />

请让我知道这可怎么解决的。

推荐答案

我改变了解决错误的虽然不知道什么是错的previous构建脚本(可能是previous构建脚本构建脚本是造成罐冲突)。

<project name="Struts2.0" default="archive" basedir=".">

    <description>
           Basic Struts 2 Java Web Application
    </description>

    <property file="build.properties"/>



    <!-- ==================== Clean Target ==================================== -->

    <!--
      The "clean" target deletes any previous "build" and "dist" directory,
      so that you can be ensured the application can be built from scratch.
    -->
    <target name="clean" description="Delete old build and dist directories">
        <delete dir="${dist.home}"/>
        <delete dir="${build.home}"/>
    </target>

    <!-- ==================== Init Target ================================== -->

    <!--

      The "init" target is used to create the "build" destination directory,
      Normally, this task is executed indirectly when needed.

    -->
    <target name="init" depends="clean"  description="Create build directory">

        <mkdir dir="${build.home}" />

    </target>

    <!-- ==================== Compile Target ================================== -->

    <!--

      The "compile" target transforms source files (from your "src" directory)
      into class files in the appropriate location in the build directory.
      This example assumes that you will be including your classes in an
      unpacked directory hierarchy under "/WEB-INF/classes".

    -->
    <target name="compile" depends="init" description="Compile Java sources">


        <mkdir dir="${build.home}/WEB-INF/classes" />

        <javac srcdir="${source.home}"
                destdir="${build.home}/WEB-INF/classes"
                debug="${compile.debug}"
                deprecation="${compile.deprecation}"
                optimize="${compile.optimize}"
                source="1.5" target="1.5">

            <classpath>
                <path>
                    <fileset dir="${lib.home}" />
                </path>
            </classpath>

        </javac>

    </target>

    <!-- ==================== Build Target ================================== -->

    <!--

      The "build" target copies all non class files to build directory

    -->

    <target name="build" depends="compile" description="Copies all non Java classes to build directoy">
        <copy todir="${build.home}">
            <fileset dir="${webapp.home}" excludes="CVS,**/*.class" />
        </copy>
        <copy todir="${build.home}/WEB-INF/classes">
            <fileset dir="${source.home}" excludes="CVS,**/*.java" />
        </copy>
    </target>

    <!-- ==================== Archive Target ================================== -->

    <!--

      The "archive" target create a binary archive of all files in build.home

    -->

    <target name="archive" depends="build" description="Create binary archive of all files in dist.home">

        <mkdir     dir="${dist.home}" />

        <!-- Create application WAR file -->
        <jar jarfile="${dist.home}/${app.name}.war"
                basedir="${build.home}" />

    </target>

</project>

这篇关于未发现Action类 - Struts的2.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 06:28