Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Glassfish 3中部署ant后,我的控制器类上的ClassNofFoundException_Ant_Glassfish 3_Classnotfoundexception_Build.xml - Fatal编程技术网

在Glassfish 3中部署ant后,我的控制器类上的ClassNofFoundException

在Glassfish 3中部署ant后,我的控制器类上的ClassNofFoundException,ant,glassfish-3,classnotfoundexception,build.xml,Ant,Glassfish 3,Classnotfoundexception,Build.xml,这是我第一次创建ant脚本。在我创建控制器类之前,它一直在使用hello world jsp。这是我得到的错误: deploy: [echo] Application Name: batch_processing [sun-appserv-deploy] Running command deploy --contextroot=batch_processing buil d/war/batch_processing.war [sun-appserv-deploy]

这是我第一次创建ant脚本。在我创建控制器类之前,它一直在使用hello world jsp。这是我得到的错误:

deploy:
     [echo] Application Name: batch_processing
     [sun-appserv-deploy] Running command deploy  --contextroot=batch_processing buil
d/war/batch_processing.war
     [sun-appserv-deploy] remote failure: Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.ClassNotFoundException: batchProcessing.web.HelloController.
Please see server.log for more details.
这是我的build.xml:

<property name="src.dir" value="src"/>
    <property name="web.dir" value="war"/>
    <property name="classes.dir" value="${web.dir}/WEB-INF/classes"/>
    <property name="name" value="batch_processing"/>
    <property name="lib.dir" value="${web.dir}/WEB-INF/lib"/>

    <path id="lib.path">
           <fileset dir="${lib.dir}" includes="**/*.jar"/>
        <!--   <pathelement path="${classes.dir}"/> -->
    </path>

<target name="as-ant-init">
        <taskdef name="sun-appserv-deploy"
            classname="org.glassfish.ant.tasks.DeployTask"
            classpath="${asinstalldir}/lib/ant/ant-tasks.jar"
            classpathref="lib.path"/>
</target>
<target name="clean">
            <delete dir="build/war"/>
            <delete dir="${classes.dir}"/>
    </target>

    <target name="compile">
          <mkdir dir="${classes.dir}"/>
          <javac srcdir="${src.dir}" destdir="${classes.dir}" 
            classpathref="lib.path" includeantruntime="true"/>
          <copy todir="${classes.dir}">
                            <fileset dir="${src.dir}" excludes="**/*.java"/>
          </copy>
    </target>



    <target name="war" depends="compile">
        <mkdir dir="build/war"/>
        <war destfile="build/war/${name}.war" webxml="${web.dir}/WEB-INF/web.xml" update="true"> 
        <classes dir="${classes.dir}"/> 
        <fileset dir="${web.dir}">
             <exclude name="${web.dir}/WEB-INF/web.xml"/>
         </fileset>
        </war>
       </target>

   <target name="deploy" depends="as-ant-init, war"
           description="Install Application to Servlet Container">
      <echo message="Application Name: ${name}"/>
      <sun-appserv-deploy 
                          user="admin"
                          passwordfile="${env.GLASSFISH_HOME}/tmp/glassfish.txt" 
                          host="localhost" 
                          port="${admin.port}"
                          force="true"
                          installDir="${asinstalldir}">
         <component file="build/war/${name}.war"
                    contextroot="${name}"/>
      </sun-appserv-deploy>
   </target>

我的war文件在WEB-INF的classes文件夹中有类,但它有两个相同的控制器副本,对吗


我错过了什么或做错了什么?谢谢

第一个想法是查看server.log以了解详细信息。;)当时有什么有趣的地方吗?事实上,这个错误似乎源于我的应用程序上下文文件,我在声明我的控制器时有一个打字错误,因此这个错误。已经解决了。谢谢