ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd Espy" <todde...@mediaone.net>
Subject Newbie EJB question
Date Wed, 25 Oct 2000 21:54:54 GMT
I just joined the mailing list and the FAQ-o-matic is down at Apache, so
please forgive this question if it has been asked and/or answered elsewhere.

Is there an example anywhere of how to use Ant to build a Sun J2EE reference
implementation (no Weblogic or other, just J2SE + JDBC ext + J2EE + TOMCAT +
Apache) EJB web app?  Perhaps the ConverterJSPApp example?

I have successfully deployed and tested the ConverterJSPApp on the j2ee
server on port 8000, but I'd like to figure out how to use Ant to build my
JSP apps that use EJBs for database access (cloudscape) and deploy them in
the standard Apache/Tomcat manner.

I've tried modifying my build.xml and build.bat files of a project very
similar to the ConverterJSPApp using the Ant directory structure to include
%J2EE_HOME%\lib\j2ee.jar in the classpath as follows:

build.xml
----------------------------------------------------------------------------
--------
<pre>
<project name="RuthsChris" default="compile" basedir=".">

<!-- Test VXML app to do phone transfer to local restaurants.

     NOTE:  Before using this file as is, you should review the
     values for the properties that are defined below.
     In particular, it is assumed that you wish to install this
     application under context path "/myapp" in the Tomcat installation
     defined by your TOMCAT_HOME environment variable.
-->

  <property name="app.name"       value="RuthsChris" />
  <property name="deploy.home"
value="${tomcat.home}/webapps/${app.name}"/>
  <property name="dist.home"      value="${deploy.home}"/>
  <property name="dist.src"       value="${app.name}.jar"/>
  <property name="dist.war"       value="${app.name}.war"/>
  <property name="javadoc.home"   value="${deploy.home}/javadoc"/>
  <property name="j2ee.home"   	value="f:/j2sdkee1.2.1"/>


  <target name="prepare" init="init" >
    <mkdir dir="${deploy.home}"/>
    <copydir src="web" dest="${deploy.home}"/>
    <mkdir dir="${deploy.home}/WEB-INF"/>
    <copyfile src="etc/web.xml" dest="${deploy.home}/WEB-INF/web.xml"/>
    <mkdir dir="${deploy.home}/WEB-INF/classes"/>
    <mkdir dir="${deploy.home}/WEB-INF/lib"/>
    <copydir src="lib" dest="${deploy.home}/lib"/>
    <mkdir dir="${javadoc.home}"/>
  </target>


  <target name="clean" init="init" >
    <deltree dir="${deploy.home}"/>
  </target>


  <target name="compile" depends="prepare" init="init" >
    <javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"

classpath="${deploy.home}/WEB-INF/classes;${j2ee.home}/lib/j2ee.jar"
           debug="on" optimize="off" deprecation="off"/>
  </target>


  <target name="javadoc" depends="prepare" init="init" >
    <!-- TODO -->
  </target>


  <target name="all" depends="clean,prepare,compile,javadoc" init="init" />


  <target name="dist" depends="prepare,compile" init="init" >
    <jar jarfile="${dist.home}/${dist.src}"
         basedir="." items="*"/>
    <jar jarfile="${dist.home}/${dist.war}"
         basedir="${deploy.home}" items="*"/>
  </target>


</project>

</pre>
----------------------------------------------------------------------------
--------

build.bat

----------------------------------------------------------------------------
--------
@echo off
rem build.bat -- Build Script for the "RuthsChris" Application

if %CLASSPATH% == "" goto noclasspath

:haveclasspath
set _CLASSPATH=%CLASSPATH%
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\classes
goto restofclasspath

:noclasspath
set _CLASSPATH=
set CLASSPATH=%TOMCAT_HOME%\classes

:restofclasspath
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\ant.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
set CLASSPATH=%CLASSPATH%;%J2EE_HOME%\lib\j2ee.jar

rem Execute ANT to perform the requested build target
java org.apache.tools.ant.Main -Dtomcat.home=%TOMCAT_HOME% %1 %2 %3 %4 %5 %6
%7 %8 %9

set CLASSPATH=%_CLASSPATH%
set _CLASSPATH=

----------------------------------------------------------------------------
--------------

But I still get the following error:

----------------------------------------------------------------------------
---------------------
F:\VXML\RuthsChris>build
Buildfile: build.xml
Project base dir set to: F:\VXML\RuthsChris
The items attribute is deprecated. Please use the includes attribute.
The items attribute is deprecated. Please use the includes attribute.
Executing Target: prepare
Executing Target: compile
Compiling 7 source files to
F:\ApacheGroup\jakarta-tomcat\webapps\RuthsChris\WEB-INF\classes
Exception in thread "main" java.lang.NoClassDefFoundError:
sun/tools/javac/Main
        at
org.apache.tools.ant.taskdefs.Javac.doClassicCompile(Javac.java:418)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:218)
        at org.apache.tools.ant.Target.execute(Target.java:120)
        at org.apache.tools.ant.Project.runTarget(Project.java:675)
        at org.apache.tools.ant.Project.executeTarget(Project.java:422)
        at org.apache.tools.ant.Main.runBuild(Main.java:240)
        at org.apache.tools.ant.Main.main(Main.java:191)


----------------------------------------------------------------------------
---------------------

When I compile the class files manually with
----------------------------------------------------------------------------
---------------------
F:\VXML\RuthsChris>javac -classpath .\src;%J2EE_HOME%\lib\j2ee.jar
src\*.java
----------------------------------------------------------------------------
---------------------
the compilation succeeds.  Should I just manually compile and modify
build.xml to just move the class files?

Any and all help appreciated.


	-Todd


Mime
View raw message