Ant Build Issue:嵌套异常是java.lang.NoClassDefFoundError:org/apac



Ant 构建脚本

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<project basedir="." name="myapp">
    <property name="debuglevel" value="source,lines,vars"/>
    <property name="target" value="1.7"/>
    <property name="source" value="1.7"/>
    <property name="src.dir"    location="src"/>
    <property name="web.dir" location="war"/>
    <property name="build.dir" location="${web.dir}/WEB-INF/classes"/>
    <property name="lib.dir" location="${web.dir}/WEB-INF/lib"/>
    <property name="dist.dir" location="dist"/>
    <property name="conf.dir" location="conf"/>
    <property name="resources.dir" location="resources"/>
    <property name="war.file" value="${dist.dir}/${ant.project.name}.war"/>
    <property name="ear.file" value="${dist.dir}/${ant.project.name}.ear"/>
    <property name="version" value="3.2"/>
    <path id="compile.app.classpath">
        <fileset dir="${web.dir}/WEB-INF/lib">
            <include name="*.jar"/>
        </fileset>
        <pathelement path="${build.dir}"/>
    </path>
    <target name="clean">
        <delete dir="${build.dir}"/>
        <delete dir="${dist.dir}"/>
    </target>
    <target name="init" depends="clean">
        <tstamp/>
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${dist.dir}"/>
    </target>
    <target name="compile-app" depends="init">
        <javac 
            debug="true" 
            debuglevel="${debuglevel}"
            srcdir="${src.dir}"
            destdir="${build.dir}" 
            includeantruntime="false" 
            source="${source}" 
            target="${target}"
            deprecation="on"
            classpathref="compile.app.classpath"
            excludes="test/**"/>
        <copy todir="${build.dir}">
            <fileset dir="${resources.dir}">
                <include name="**/*.xml"/>
            </fileset>
        </copy>
    </target>
    <target name="build-war" depends="compile-app" description="Create WAR file for binary distribution">
        <war destfile="${war.file}" webxml="${web.dir}/WEB-INF/web.xml">
            <webinf dir="${web.dir}/WEB-INF"/>
            <fileset dir="${dist.dir}"/>
            <lib dir="${lib.dir}">
                <exclude name="junit*.jar"/>
                <exclude name="hamcrest*.jar"/>
            </lib>
        </war>
    </target>
</project>

目录结构:

src
|
resources
|--log4j2.xml
war
|--META-INF
|--resources
|  |--css
|  |--img
|  |--js
|--WEB-INF
|  |--classes
|  |--lib (jar's)
|  |--views (jsp's)
|  |  |--layouts
|  |  |--templates
|  |--root-context.xml
|  |--security-context.xml
|  |--servlet-context.xml
|  |--web.xml
|  |--layout.xml (Tiles layout definitions)
|  |--template.xml (Tiles Templates)

网络逻辑部署错误:

Servlet: "appServlet" failed to preload on startup in Web application: "myapp.war". 
org.springframework.beans.factory.BeanCreationException: Error creating bean with 
name 'tilesConfigurer' defined in ServletContext resource [/WEB-INF/servlet-context.xml]: 
Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: 
org/apache/tiles/request/servlet/ServletApplicationContext at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578

上下文:尝试创建将应用程序打包到 WAR 文件中的 ANT 构建脚本。

我已经搜索了很长时间的问题,但我找不到适合这种情况的任何内容。

我发现了问题。我仔细检查了我正在使用的库,在将其添加到项目中时.jar错过了tiles-request-servlet-1.0.6。

相关内容

  • 没有找到相关文章

最新更新