[英]Ant failure: Exception in thread “main” java.lang.NoClassDefFoundError org/apache/tools/ant/launch/Launcher
[英]Ant Build Issue: nested exception is java.lang.NoClassDefFoundError: org/apache/tiles/request/servlet/ServletApplicationContext
蚂蚁构建脚本
<?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)
Weblogic部署错误:
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构建脚本。
我已经寻找了好一会儿可能存在问题的时间,但找不到适合这种情况的任何东西。
我发现了问题。 我仔细检查了一下我正在使用的库,并在将其添加到项目中时错过了tiles-request-servlet-1.0.6.jar。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.