Compile EJB using ANT
Hi All,
This is prathap from India(Chennai city).
I have a situation here,please help me to handle it.
" How to compile a EJB project through ANT. ???? "
" Any sample Build.xml file and supporting file to configue and compile my EJB codings through ANT and not with WSAD or what ever ".
Hope u guys got the picture,please reply me ASAP.
Thanks and Regards,
Prathap M
Hi All,
This is prathap from India(Chennai city).
I have a situation here,please help me to handle it.
" How to compile a EJB project through ANT. ???? "
" Any sample Build.xml file and supporting file to configue and compile my EJB codings through ANT and not with WSAD or what ever ".
Hope u guys got the picture,please reply me ASAP.
Thanks and Regards,
Prathap M
Similar Messages
-
"Error running javac.exe compiler" when using ant to compile Eclipse plugin
Hi
I encounter an error "Error running C:\jdk1.5.0_06\bin\javac.exe compiler" when building my project using ant1.7.
My project has 10 eclipse plugins, and each plugin is compiled by invoking following ant target
<!-- ===================================================================
Compile specified plugin
target parameters:
param.plugin.dir: the plugin directory
param.plugin.targetJarFile: the name of jar file for the given plugin
param.plugin.src.dir: the folder name of source codes. Note: it is relative path name
param.fork: indicate if another process is forked to run javac
=================================================================== -->
<target name="compilePlugin">
<!-- Prepare compile environment -->
<!-- Delete obsolete build folder -->
<delete dir="${param.plugin.dir}/${build.dir}" quiet="true"/>
<!-- Delete obsolete jar file -->
<delete file="${param.plugin.dir}/${param.plugin.targetJarFile}" quiet="true"/>
<mkdir dir="${param.plugin.dir}/${build.dir}"/>
<!-- Compile source codes -->
<javac srcdir="${param.plugin.dir}/${param.plugin.src.dir}"
destdir="${param.plugin.dir}/${build.dir}"
failonerror="${javacFailOnError}"
verbose="${javacVerbose}"
debug="${javacDebugInfo}"
deprecation="${javacDeprecation}"
optimize="${javacOptimize}"
source="${javacSource}"
target="${javacTarget}"
fork="${param.fork}" memoryInitialSize="256m" memoryMaximumSize="512m">
<classpath refid="compile.classpath" />
</javac>
<!-- Create plugin jar file -->
<copy todir="${param.plugin.dir}/${build.dir}" failonerror="true">
<fileset dir="${param.plugin.dir}/${param.plugin.src.dir}" excludes="**/*.java, **/package.htm*" />
</copy>
<jar jarfile="${param.plugin.dir}/${param.plugin.targetJarFile}" basedir="${param.plugin.dir}/${build.dir}"/>
<delete dir="${param.plugin.dir}/${build.dir}" quiet="true"/>
</target>
Since each of first 9 plugins contains less than 500 java source files, we always set "param.fork" to false when invoking this ant target.
For the 10th plugin, it has about 1000 source files. If we set "param.fork" to false, we will get the error "Error running javac.exe compiler". So we have to set "param.fork" to true when compiling it. This week, this plugin contains about 1250 files and we get the same error again when compiling it. I tried to increase the "memoryMaximumSize" to "768", but still couldn't get through it.
BTW, There are about 150 jar files in our classpath for compiling plugins. Do many jar files cause this problem?
Any help is highly appreciated.
Many thanks
OceanmanI encountered a very similar error and I was able to resolve it by removing the following parameters from the javac task:
fork="${param.fork}"
memoryInitialSize="256m"
memoryMaximumSize="512m"My values were not the same as yours, before I removed them, the values were set to:
fork="true"
memoryInitialSize="256m"
memoryMaximumSize="256m" Not sure why this fixed my problem but it did. I was using Ant 1.7 and Java 1.6_07 hope this helps. -
Java Compilation issue -- using ant
I get the following error when i use ant to compile my java src directory
Buildfile: build.xml
[echo] JAVA_HOME-->/usr/jdk/jdk1.5.0_06
[echo] CLASSPATH-->/usr/jdk/jdk1.5.0_06/jre/lib/rt.jar:/usr/jdk/jdk1.5.0_06/lib/tools.jar:/usr/jdk/jdk1.5.0_06/lib/dt.jar
[echo] /usr/jdk/jdk1.5.0_06
init:
compile:
[javac] Compiling 1 source file to /tmp/patchtool/classes
BUILD FAILED
/tmp/patchtool/build.xml:27: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
MY build.xml IS......
<project name="OMC" default="compile" basedir=".">
<property environment="env" />
<property name="src.dir" value="./src"/>
<property name="classes.dir" value="./classes"/>
<property name="lib.dir" value="${env.JAVA_HOME}/lib"/>
<property name="build.dir" value="./build/"/>
<property name="patch.jar" value="patch_c_omcpr000000.jar"/>
<target name="init">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<echo message="JAVA_HOME-->${env.JAVA_HOME}"/>
<echo message="CLASSPATH-->${env.CLASSPATH}"/>
<echo message="PATH-->${env.PATH}"/>
<echo message="${env.JAVA_HOME}"/>
<target name="compile" depends="init">
<javac srcdir="${src.dir}"
destdir="${classes.dir}"
debug="on"
deprecation="on"
optimize="off"
classpath="${env.CLASSPATH}"
executable="${env.JAVA_HOME}/bin/javac">
</javac>
</target>
<target name="jarfile" depends="compile">
<mkdir dir="${build.dir}"/>
<jar destfile="${build.dir}/${patch.jar}" basedir="${classes.dir}"/>
</target>
<target name="clean">
<delete dir="${classes.dir}"/>
<delete dir="${build.dir}"/>
</target>
</project>
.........................................................................................................................................................................................................................Once i add fork i get the following error.......
BUILD FAILED
/tmp/patchtool/build.xml:15: Error creating temporary file -
Weblogic.jspc outofmemory error while compiling jsps using ant in eclipse
Hi all,
I am trying to execute this target in my ant build:
<target name="jspc">
<java classname="weblogic.jspc" fork="yes">
<arg line="-verbose -verboseJavac -compileAll -webapp ${project.jsp.dir} -d ${project.jsp.class.dir}" />
<classpath>
<pathelement path="${classpath}" />
</classpath>
</java>
</target>
I am getting the following error:
[java] Error: [jspc]: 0 file(s) failed:
[java] [Compilation errors : ]
[java] The system is out of resources.
[java] Consult the following stack trace for details.
[java] java.lang.OutOfMemoryError
[java] at weblogic.jspc.doCompile(jspc.java:861)
[java] at weblogic.jspc.runJspc(jspc.java:654)
[java] at weblogic.jspc.runBodyInternal(jspc.java:412)
[java] at weblogic.jspc.runBody(jspc.java:319)
[java] at weblogic.utils.compiler.Tool.run(Tool.java:192)
I am using weblogic 8.1, eclipse3.1, java1.4.1.
Can some one please help me with this issue?
thanks in advance.--> some error on posting please refer to the next post...
From the error logs we can trace it out to the web project's Build.xml file ....I was getting a similar error and by commenting out the following lines in the web project's Build.xml I am able to run the build script correctly and get a EAR file. The lines are
<!--
<assemble
moduleDir="${generated.module.root}"
moduleName="${project.name}"
srcOutputDir="${assembly.src}"
appRootDir="${ear.root}">
<assemblyContext factory="org.apache.beehive.controls.runtime.assembly.WebAppAssemblyContext$Factory" />
<assemblyContext factory="org.apache.beehive.controls.runtime.assembly.AppAssemblyContext$Factory" />
<classpath refid="assembly.classpath" />
<fileset dir="${project.dir}">
<include name="**/*.controls.properties" />
</fileset>
</assemble>
-->
Please check it now, also if any one can let us know the function or role played by the above lines it would be great. Also if there would be any future or unseen problems by commenting out these lines please do let us know...
Thanks
-MiM
Edited by prodigymonish83 at 10/22/2007 5:56 AM -
SGD Portlet - Failed to build using Ant - UnsupportedClassVersionError
Hi,
I've downloaded the Sun Secure Global Desktop portlet source code from here: https://portlet-repository.dev.java.net/public/Download.html and I'm trying to compile it using Ant.
I have Ant 1.7.0 and I'm using JRE 1.4.2_15. For some reason, the Ant task fails. Using the -debug and -logfile options, it points to a VersionTask class error:
Adding reference: ant.PropertyHelper
Detected Java version: 1.4 in: C:\Program Files\Java\j2sdk1.4.2_15\jre
Detected OS: Windows XP
Adding reference: ant.ComponentHelper
Setting ro project property: ant.file -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\build.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\build.xml with URI = file:/C:/Documents%20and%20Settings/Administrator/My%20Documents/Projects/2007/Bell/Sun%20SGD/sgdportlet/build.xml
Setting ro project property: ant.project.name -> SGD Portlet
Adding reference: SGD Portlet
Setting ro project property: ant.file.SGD Portlet -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\build.xml
Project base dir set to: C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet
+Target:
+Target: all
+Target: init
+Target: version
+Target: compile
+Target: dist
+Target: clean
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
Setting project property: src -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\src
Setting project property: build.top -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\build
Setting project property: build.webinf -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\build\WEB-INF
Setting project property: build.classes -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\build\WEB-INF\classes
Setting project property: dist -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\dist
Setting project property: lib -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\lib
Setting project property: web -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\web
Setting project property: tools -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\tools
Setting project property: webinf -> C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\web\WEB-INF
Finding class com.tarantella.tools.ant.tasks.VersionTask
Loaded from C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\lib\tarantella-tasks.jar com/tarantella/tools/ant/tasks/VersionTask.class
BUILD FAILED
C:\Documents and Settings\Administrator\My Documents\Projects\2007\Sun SGD\sgdportlet\build.xml:14: java.lang.UnsupportedClassVersionError: com/tarantella/tools/ant/tasks/VersionTask (Unsupported major.minor version 50.0)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
I know this portlet code was just released this week, but has anybody had any success building the portlet into a .WAR file?
Thanks in advance!
Rob.I figured it out... the tarantella-tasks.jar file had class files in it that were compiled using jdk 6, and the rest of the project was compiled using jdk 1.4.2. Luckily, the source code was there so that I could recompile the classes back to 1.4.2 and it now works.
-
Error compiling single ejb using appc/ejbc (long)
This may be related to my earlier post ("no longer able to build ejb
using appc (WLS 8.1)", posted this morning), but the error and the way I
encountered it were different enough that I thought I'd post as a new
topic. I've been trying to build a project using weblogic 8.1, but I've
been running into some problems.
As a test, I tried compiling a single ejb from the command line using
the new appc compiler. I compiled the source files and moved them to a
clean build directory, along with the deployment descriptors. From the
command line, I set the system classpath to the bare minimum necessary
to build the ejb-- the jdk tools.jar, the jre rt.jar, the weblogic.jar
file, the project bin directory, the log4j.jar, and my database driver
jar (see [1] and the echoed resulting classpath at [2] below). I then
invoked appc, specifying the output and source paths ([3]). The
resulting error ([4]) shows a much larger classpath, which abruptly ends
with a "?". I ran the same test using ejbc instead of appc, and I get
the very same problem (same error message). I've never encountered
problems like these before, and other than upgrading to weblogic 8.1, my
system configuration hasn't changed. Any ideas or suggestions would be
greatly appreciated!
system:
weblogic 8.1
sun jdk 1.4.1_02 (bundled with weblogic)
win 2k
Test and resulting error message:
[1] SETTING CLASSPATH...
D:\workspace\TRIPS\deployment\build>set classpath=D:\bea\jdk141_02\jre
\lib\rt.jar;D:\bea\jdk141_02\lib\tools.jar;D:\bea\weblogic81\server\lib
\weblogic.jar;D:\workspace\TRIPS\bin;D:\workspace\TRIPS\lib\log4j.jar;D:
\workspace\TRIPS\lib\ifxjdbc.jar
[2] ECHOING CLASSPATH...
D:\workspace\TRIPS\deployment\build>set classpath
classpath=D:\bea\jdk141_02\jre\lib\rt.jar;D:\bea\jdk141_02\lib
\tools.jar;D:\bea\weblogic81\server\lib\weblogic.jar;D:\workspace\TRIPS
\bin;D:\workspace\TRIPS\lib\log4j.jar;D:\workspace\TRIPS\lib\ifxjdbc.jar
[3] INVOKING APPC...
D:\workspace\TRIPS\deployment\build>java weblogic.appc -output D:
\workspace\TRIP
S\deployment\build\VASKeyGenerator.jar D:\workspace\TRIPS\deployment
\build
[4] ERROR MESSAGE...
java.io.IOException: CreateProcess: javac -classpath "C:\temp\appcgen;C:
\Program
Files\Java\j2re1.4.1_01\lib\rt.jar;C:\Program Files\Java\j2re1.4.1_01
\lib\i18n.
jar;C:\Program Files\Java\j2re1.4.1_01\lib\sunrsasign.jar;C:\Program
Files\Java\
j2re1.4.1_01\lib\jsse.jar;C:\Program Files\Java\j2re1.4.1_01\lib
\jce.jar;C:\Prog
ram Files\Java\j2re1.4.1_01\lib\charsets.jar;C:\Program Files\Java
\j2re1.4.1_01\
classes;D:\bea\jdk141_02\jre\lib\rt.jar;D:\bea\jdk141_02\lib
\tools.jar;D:\bea\we
blogic81\server\lib\weblogic.jar;D:\bea\weblogic81\server\lib
\wlcipher.jar;D:\be
a\weblogic81\server\lib\webservices.jar;D:\bea\weblogic81\server\lib
\xmlx.jar;D:
\bea\weblogic81\server\lib\ojdbc14.jar;D:\bea\weblogic81\server\lib
\EccpressoAsn
1.jar;D:\bea\weblogic81\server\lib\EccpressoCore.jar;D:\bea\weblogic81
\server\li
b\EccpressoJcae.jar;D:\bea\weblogic81\server\lib\ant\ant.jar;D:\bea
\weblogic81\s
erver\lib\ant\optional.jar;D:\bea\weblogic81\server\lib\ant\jakarta-oro-
2.0.4.ja
r;D:\bea\weblogic81\server\lib\ant\xml-apis.jar;D:\bea\weblogic81\server
\lib\ant
\xerc?
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Win32Process.java:63)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:566)
at java.lang.Runtime.exec(Runtime.java:491)
at java.lang.Runtime.exec(Runtime.java:457)
at weblogic.utils.Executable.exec(Executable.java:227)
at weblogic.utils.Executable.exec(Executable.java:156)
at weblogic.utils.Executable.exec(Executable.java:142)
at weblogic.utils.compiler.CompilerInvoker.execCompiler
(CompilerInvoker.
java:246)
at weblogic.utils.compiler.CompilerInvoker.compileMaybeExit
(CompilerInvo
ker.java:463)
at weblogic.utils.compiler.CompilerInvoker.compile
(CompilerInvoker.java:
364)
at weblogic.utils.compiler.CompilerInvoker.compile
(CompilerInvoker.java:
372)
at weblogic.ejb20.ejbc.EJBCompiler.doCompile
(EJBCompiler.java:270)
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB
(EJBCompiler.java:468)
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB
(EJBCompiler.java:387)
at weblogic.appc.compileEJB(appc.java:735)
at weblogic.appc.compileEJB(appc.java:709)
at weblogic.appc.compileInput(appc.java:446)
at weblogic.appc.runBody(appc.java:167)
at weblogic.utils.compiler.Tool.run(Tool.java:146)
at weblogic.utils.compiler.Tool.run(Tool.java:103)
at weblogic.appc.main(appc.java:961)
Exec failed .. exiting
D:\workspace\TRIPS\deployment\build>Hi Tim,
I just got past a similar problem by specifying the full path to javac
in build.xml. Like:
<wlappc source="${dest.dir}" compiler="C:\bea\jdk141_02\bin\javac"
/>
Tim Perrigo <[email protected]> wrote in message news:<[email protected]>...
This may be related to my earlier post ("no longer able to build ejb
using appc (WLS 8.1)", posted this morning), but the error and the way I
encountered it were different enough that I thought I'd post as a new
topic. I've been trying to build a project using weblogic 8.1, but I've
been running into some problems.
As a test, I tried compiling a single ejb from the command line using
the new appc compiler. I compiled the source files and moved them to a
clean build directory, along with the deployment descriptors. From the
command line, I set the system classpath to the bare minimum necessary
to build the ejb-- the jdk tools.jar, the jre rt.jar, the weblogic.jar
file, the project bin directory, the log4j.jar, and my database driver
jar (see [1] and the echoed resulting classpath at [2] below). I then
invoked appc, specifying the output and source paths ([3]). The
resulting error ([4]) shows a much larger classpath, which abruptly ends
with a "?". I ran the same test using ejbc instead of appc, and I get
the very same problem (same error message). I've never encountered
problems like these before, and other than upgrading to weblogic 8.1, my
system configuration hasn't changed. Any ideas or suggestions would be
greatly appreciated!
system:
weblogic 8.1
sun jdk 1.4.1_02 (bundled with weblogic)
win 2k
Test and resulting error message:
[1] SETTING CLASSPATH...
D:\workspace\TRIPS\deployment\build>set classpath=D:\bea\jdk141_02\jre
\lib\rt.jar;D:\bea\jdk141_02\lib\tools.jar;D:\bea\weblogic81\server\lib
\weblogic.jar;D:\workspace\TRIPS\bin;D:\workspace\TRIPS\lib\log4j.jar;D:
\workspace\TRIPS\lib\ifxjdbc.jar
[2] ECHOING CLASSPATH...
D:\workspace\TRIPS\deployment\build>set classpath
classpath=D:\bea\jdk141_02\jre\lib\rt.jar;D:\bea\jdk141_02\lib
\tools.jar;D:\bea\weblogic81\server\lib\weblogic.jar;D:\workspace\TRIPS
\bin;D:\workspace\TRIPS\lib\log4j.jar;D:\workspace\TRIPS\lib\ifxjdbc.jar
[3] INVOKING APPC...
D:\workspace\TRIPS\deployment\build>java weblogic.appc -output D:
\workspace\TRIP
S\deployment\build\VASKeyGenerator.jar D:\workspace\TRIPS\deployment
\build
[4] ERROR MESSAGE...
java.io.IOException: CreateProcess: javac -classpath "C:\temp\appcgen;C:
\Program
Files\Java\j2re1.4.1_01\lib\rt.jar;C:\Program Files\Java\j2re1.4.1_01
\lib\i18n.
jar;C:\Program Files\Java\j2re1.4.1_01\lib\sunrsasign.jar;C:\Program
Files\Java\
j2re1.4.1_01\lib\jsse.jar;C:\Program Files\Java\j2re1.4.1_01\lib
\jce.jar;C:\Prog
ram Files\Java\j2re1.4.1_01\lib\charsets.jar;C:\Program Files\Java
\j2re1.4.1_01\
classes;D:\bea\jdk141_02\jre\lib\rt.jar;D:\bea\jdk141_02\lib
\tools.jar;D:\bea\we
blogic81\server\lib\weblogic.jar;D:\bea\weblogic81\server\lib
\wlcipher.jar;D:\be
a\weblogic81\server\lib\webservices.jar;D:\bea\weblogic81\server\lib
\xmlx.jar;D:
\bea\weblogic81\server\lib\ojdbc14.jar;D:\bea\weblogic81\server\lib
\EccpressoAsn
1.jar;D:\bea\weblogic81\server\lib\EccpressoCore.jar;D:\bea\weblogic81
\server\li
b\EccpressoJcae.jar;D:\bea\weblogic81\server\lib\ant\ant.jar;D:\bea
\weblogic81\s
erver\lib\ant\optional.jar;D:\bea\weblogic81\server\lib\ant\jakarta-oro-
2.0.4.ja
r;D:\bea\weblogic81\server\lib\ant\xml-apis.jar;D:\bea\weblogic81\server
\lib\ant
\xerc?
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Win32Process.java:63)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:566)
at java.lang.Runtime.exec(Runtime.java:491)
at java.lang.Runtime.exec(Runtime.java:457)
at weblogic.utils.Executable.exec(Executable.java:227)
at weblogic.utils.Executable.exec(Executable.java:156)
at weblogic.utils.Executable.exec(Executable.java:142)
at weblogic.utils.compiler.CompilerInvoker.execCompiler
(CompilerInvoker.
java:246)
at weblogic.utils.compiler.CompilerInvoker.compileMaybeExit
(CompilerInvo
ker.java:463)
at weblogic.utils.compiler.CompilerInvoker.compile
(CompilerInvoker.java:
364)
at weblogic.utils.compiler.CompilerInvoker.compile
(CompilerInvoker.java:
372)
at weblogic.ejb20.ejbc.EJBCompiler.doCompile
(EJBCompiler.java:270)
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB
(EJBCompiler.java:468)
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB
(EJBCompiler.java:387)
at weblogic.appc.compileEJB(appc.java:735)
at weblogic.appc.compileEJB(appc.java:709)
at weblogic.appc.compileInput(appc.java:446)
at weblogic.appc.runBody(appc.java:167)
at weblogic.utils.compiler.Tool.run(Tool.java:146)
at weblogic.utils.compiler.Tool.run(Tool.java:103)
at weblogic.appc.main(appc.java:961)
Exec failed .. exiting
D:\workspace\TRIPS\deployment\build> -
JSP precompilation and my .java files compilation issues / building WAR file using ANT
Hello.
I am new to working with WAR files and the whole process of it. A little
background on what we are using. We are using, WLS 6.1 SP3. I am using the
ant.bat that is supplied in the bin directory of the WLS install.
I am trying to work with ANT and getting it to build the file. I am making
progress, but at a point where I am having trouble getting my java code
files to compile using ant. I am having one issue and looking to do one
other item.
1) I would like to precompile the JSPs if possible prior to putting into the
WAR file. Not sure if this is done or not, but there was a utility when I
was working with ibm's app server that gave us the ability to do a batch
complile. Was thinking that maybe a similair concept is possibly here.
2) Having issue getting ant to compile code properly. In the compile
section of the build.xml file for ant, I tell it where the source files are,
and the destionation folder for the compiled class files. I then try to set
the classpath so that it finds the .jar files that are necessary for my
source files to complile. But, it won't find them. And not sure how come.
I may be going about this all wrong, but dont know. Here is the compile
section of the build.xml I am using:
<target name="compile" depends="prepare">
<javac srcdir="classes" destdir="${deploy.home}/WEB-INF/classes"
classpath="$(lib.home)"
debug="on" optimize="on" deprecation="off"/>
</target>
One note, I've tried many different items in the classpath line, which
don't work. if I do *.jar it fails at complie time, invalid argument. As
well as if I use *.* and so on. if I list the explicit file names, it still
doesn't seem to find them.
I was wondering if anyone could help, if you need anymore information let me
know, I can send the entire build.xml if necessary. I may be missing
items, seeing that this is my first try at using ANT.
Any help is appreciated and thanks in advance. Hopefully not sounding too
off the wall. Hopefully get some clarification and understanding.
Thank you.
Kevin.Kevin Price wrote:
Hello.
I am new to working with WAR files and the whole process of it. A little
background on what we are using. We are using, WLS 6.1 SP3. I am using the
ant.bat that is supplied in the bin directory of the WLS install.
I am trying to work with ANT and getting it to build the file. I am making
progress, but at a point where I am having trouble getting my java code
files to compile using ant. I am having one issue and looking to do one
other item.
1) I would like to precompile the JSPs if possible prior to putting into the
WAR file. Not sure if this is done or not, but there was a utility when I
was working with ibm's app server that gave us the ability to do a batch
complile. Was thinking that maybe a similair concept is possibly here.you can use weblogic.jspc
http://e-docs.bea.com/wls/docs70/jsp/reference.html#57794
or just set the precompile flag in weblogic.xml
You can configure WebLogic Server to precompile your JSPs when a Web
Application is deployed or re-deployed or when WebLogic Server starts up
by setting the precompile parameter to true in the <jsp-descriptor>
element of the weblogic.xml deployment descriptor.
>
2) Having issue getting ant to compile code properly. In the compile
section of the build.xml file for ant, I tell it where the source files are,
and the destionation folder for the compiled class files. I then try to set
the classpath so that it finds the .jar files that are necessary for my
source files to complile. But, it won't find them. And not sure how come.
I may be going about this all wrong, but dont know. Here is the compile
section of the build.xml I am using:
<target name="compile" depends="prepare">
<javac srcdir="classes" destdir="${deploy.home}/WEB-INF/classes"
classpath="$(lib.home)"
debug="on" optimize="on" deprecation="off"/>
</target>
maybe because you are not using curly braces there on lib.home??
if you do it the way above, you would have to list all your jars
classpath="$(lib.home)\lib1.jar:$(lib.home)\lib2.jar"
or you can nest
<javac srcdir="classes" destdir="${deploy.home}/WEB-INF/classes"
debug="on" optimize="on" deprecation="off">
<classpath>
<fileset dir="${lib.home}" includes="*.jar" />
</classpath>
</javac>
One note, I've tried many different items in the classpath line, which
don't work. if I do *.jar it fails at complie time, invalid argument. As
well as if I use *.* and so on. if I list the explicit file names, it still
doesn't seem to find them.
I was wondering if anyone could help, if you need anymore information let me
know, I can send the entire build.xml if necessary. I may be missing
items, seeing that this is my first try at using ANT.
Any help is appreciated and thanks in advance. Hopefully not sounding too
off the wall. Hopefully get some clarification and understanding.
Thank you.
Kevin. -
How to compile Java files using Ant in Eclipse
Hi All ,
I would like to compile all Java files using Ant in Eclipse.Since am very new to Ant and Eclipse can someone help me to create a build.xml file and let me know how to compile all the java files.
For ex , I have placed my java files inside the path C:\HEC\Terab.Initially the Terab folder holds 7 jar files which i had decompiled using JD compiler and placed the unzipped 7 folders (which contains the java files ).Now i have imported the HEC project into Eclipse using New ->Project ->Java Project.after importig it throwed me an error saying missing jar files.again i copied the jar files and placed inside Terab folder with other 7 folder.
Now How i can compile the java files and convert in to class files.Then after compiling the files i will again need to jar all the 7 folder.
Please tell me the steps i need to follow.How to write an build.xml file ? where i should keep it ? only one build.xml file is enough or should i write 7 build.xml file for each folder ? Please help me out...
Thanks & Regards
Kar1983put it another way, what I am trying to do is to compile David Brackeen's ch 18 code from his book. The java sourse files can be downloaded here:
http://www.brackeen.com/javagamebook/
my question is that how would I complie all of these file so that I can get the program in ch18src\src\com\brackeen\javagamebook\test\ to run? -
Problem compiling in Linux using ant
Hi,
I have a problem using ant in Linux.
When I build my application using ant in Windows it works fine, but when I try to build the same application with ant in Linux it gives me the following exception:
/identifier/MidiReader.java:5: error: Class or interface `javax.sound.midi.Sequence' not found in import.
I have already checked and the 'javax.sound.midi.Sequence' exists in import.
Can anybody help me?
Regards,
DavidIn your javac task (in Ant), you need to explicitly include any external JAR's required for compilation (see ant.apache.org's docs for info). Importing them in a Java source file does not tell Ant where to locate the JAR for linking.
- Saish
"My karma ran over your dogma." - Anon -
Error deploying JDeveloper project using ant-sca-compile.xml
Hi all, I'm having problems on deploying a JDeveloper project using ant-sca-compile.xml. The output in C:\XXXX\YYYYY\SCA-INF\classes\scac.log is:
java.lang.NoClassDefFoundError: 4\jdeveloper\////oracle_common
Caused by: java.lang.ClassNotFoundException: 4\jdeveloper\....oracle_common
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
Could not find the main class: 4\jdeveloper\/../oracle_common. Program will exit.
Exception in thread "main"
What's missing in wich classpath?
Regards
Efren.Same composite we were able to deploy successfully without any error, from Monday onward we are experiencing this issue.
We checked in Installation Guide provided by oracle. Oracle has suggested few memory related changes in ant-sca-compile.xml file.
Increasing Memory to avoid Compilation Errors
To avoid out-of-memory errors during compilation of a SOA composite application, you need to
increase the following memory settings.
To increase memory settings:
1. Open the ant-sca-compile.xml file in the SOA_HOME/bin directory.
2. Under the scac element, increase the following memory settings.
<jvmarg value="-Xms2048m"/>
<jvmarg value="-Xmx2048m"/>
<jvmarg value="-XX:PermSize=32m"/>
<jvmarg value="-XX:MaxPermSize=256m"/>
3. For Windows change the following memory settings to.
<jvmarg value="-Xms1536m"/>
<jvmarg value="-Xmx1536m"/>
<jvmarg value="-XX:PermSize=32m"/>
<jvmarg value="-XX:MaxPermSize=256m"/>
We did those changes but still experiencing same error. I checked H:\AIASOAProject\AIAReceiptInterface\ReceiptListEbizProvider\SCA-INF\classes\scac.log ; file its showing Could not create the Java virtual machine.
Regards
Manish -
Error while compiling using ant
While compiling a project using ant, I got an error that a particular method is missing in the class.
But the method is actually present in the class.
What may be the problem?. Any link will be useful.
Regards,
JoshuaIts compiling and running fine in eclipse.
-
Compiling flex application using ANT throws error
Hi i m tryin to compile my flex project using ANT, and i have used [Embed(source="/assets/images/inuse/phonering.png")] lot of places in my project. How can i solve this error. I have lot of swf file also for css.
Thanks in advance
RupamOK, I checked my build script and remember having this problem. I'm deploying a war file that contains some java EE and flex code. So my solutions does not apply to your case, but check out this blog post.
http://www.olocity.com/blogs/2009/05/13/adobe-flex-ant-builds/
Also this is probably helpful
http://www.mail-archive.com/[email protected]/msg123564.html//www.mail-archive.com/[email protected]/msg123564.html -
Compile problem using TOMCAT 5.0 and Apache ANT
I got some sample from book.
i just follow the step, place it the class file. it work. it run. show all the detail.
but when i wan to compile it from java file, error came out
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error allocating a servlet instance
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.NoClassDefFoundError: com/jspbook/HelloWorld (wrong name: HelloWorld)
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(Unknown Source)
java.security.SecureClassLoader.defineClass(Unknown Source)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Unknown Source)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.in CMD:
set java_home = C:\Program Files\Java\jdk1.5.0_08
set classpath = C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib
and Apache tomcat originally dont have servlet.jar but servlet-api.jar, i copy the servlet.jar from my friend
i compile it using Apache ANT
here the build.xml
<?xml version="1.0" ?>
<project name="jspbook" default="build" basedir=".">
<target name="build">
<echo>Starting Build </echo>
<!-- Turn Tomcat Off -->
<antcall target="tomcatOff"/>
<!-- Compile Everything -->
<antcall target="compile"/>
<!-- Turn Tomcat On -->
<antcall target="tomcatOn"/>
<echo>Build Finished </echo>
</target>
<target name="tomcatOff">
<echo>Turning Off Tomcat </echo>
<exec executable="bash" os="Windows">
<arg value="../../bin/shutdown.bat"/>
</exec>
<exec executable="bash" os="Linux">
<arg value="../../bin/shutdown.sh"/>
</exec>
</target>
<target name="tomcatOn">
<echo>Starting Tomcat </echo>
<exec executable="bash" os="Windows">
<arg value="../../bin/startup.bat"/>
</exec>
<exec executable="bash" os="Linux">
<arg value="../../bin/startup.sh"/>
</exec>
</target>
<target name="compile">
<javac
srcdir="WEB-INF/classes"
extdirs="WEB-INF/lib:../../common/lib"
classpath="../../common/lib/servlet.jar"
deprecation="yes"
verbose="no">
<include name="com/jspbook/**"/>
</javac>
</target>
</project>compile success, but error in IE
paste the sample class file in,restart tomcat. i work again!
what is the problem!
even i compile the code inside the Jcreator, after set required libraries to servlet.jar or servlet-api.jar
compile it, success then run it in IE, same error!!!.
what should i do.
stil a beginer in servlet and jsp anyway.and Apache tomcat originally dont have servlet.jar but servlet-api.jar, i copy the servlet.jar from my friend servlet.jar is an OLD version, you should only use servlet-api.jar!
wrong name: HelloWorldPerhaps there is a mistake in the class or packagename of the source file. Post the source here. -
Compiling with JRockit using ant
I am considering switching to JRockit.
Our java code is compiled using ant, with the 'javac' task.
The javac task has an option to invoke different compilers:
- classic (the standard compiler of JDK 1.1/1.2) – javac1.1 and javac1.2 can be used as aliases.
- modern (the standard compiler of JDK 1.3/1.4/1.5/1.6) – javac1.3 and javac1.4 and javac1.5 and javac1.6 can be used as aliases.
- jikes (the Jikes compiler).
etc
The Jrockit compiler is not on this list.
I have found a suggestion (http://www2.sys-con.com/ITSG/virtualcd/Java/archives/0811/pepperdine/index.html) to use an exec call as a workaround,
but are there any alternatives? I could perhaps persuade ant to use JRockit by deinstalling any other JDK's and pointing JAVA_HOME to JRockit;
what I want however is to keep the option to use different compilers.
Has anyone got any suggestions?The javac compiler bundled with JRockit is the exact same one that you get with the Sun JDK. Oracle licenses the JDK (class libraries, tools, etc) from Sun. So I would just set JAVA_HOME to point at JRockit as you suggest.
Henrik -
Building weblogic ejbs with ant...
Hi, it may be not the proper place, but I haven't found a better one...
Here comes my question:
I have an ant build.xml file where I have the following tasks defined:
<property name="ejb.dtd.location" value="weblogic/ejb/deployment/xml/ejb-jar.dtd"/>
<condition property="ejb.dtd.location" value="weblogic/ejb20/dd/xml/ejb11-jar.dtd">
<equals arg1="${weblogic.major.version}" arg2="6"/>
</condition>
<property name="weblogic.ejb.dtd.location" value="weblogic/ejb/deployment/xml/weblogic-ejb-jar.dtd"/>
<condition property="ejb.dtd.location" value="weblogic/ejb20/dd/xml/weblogic510-ejb-jar.dtd">
<equals arg1="${weblogic.major.version}" arg2="6"/>
</condition>
<!-- compiles EJBs -->
<target name="compile.ejb" depends="init">
<javac srcdir="${srcDir.ejb}"
destdir="${srcDir.ejb}"
debug="${npm.debug}">
<classpath id="ejb.cpath">
<pathelement path="${weblogic.sp.path}"/>
<pathelement path="${weblogic.core.path}"/>
<pathelement location="${outDir.core}${file.separator}npm.jar"/>
<pathelement location="${srcDir.ejb}"/>
</classpath>
</javac>
</target>
<!-- delivers EJBs -->
<target name="make.ejb" depends="prepare, compile.ejb">
<!-- ejbc 'n jar 'em -->
<ejbjar srcdir="${srcDir.ejb}">
<weblogic destdir="${outDir.ejb}"
compiler="${compiler.ejb}"
keepgeneric="false"
suffix=".jar"
args="-g -nowarn"
oldCMP="false">
<classpath refid="ejb.cpath"/>
</weblogic>
<include name="**/*-ejb-jar.xml"/>
<exclude name="**/*-weblogic-ejb-jar.xml"/>
<!-- WLS v5 DTDs!!! -->
<dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"
location="${ejb.dtd.location}"/>
<dtd publicId="-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN"
location="${weblogic.ejb.dtd.location}"/>
</ejbjar>
</target>This should build my ejbs with either the wls61 ejbc or the wls51 one. Anyway ant seems to have problems finding the local dtds in the classpath, although this is specified in the documentation. When I set both location attributes to point to files it works perfect. The problem is that these are in weblogic.jar for the wls61 release. This has two solutions, but either are bad in my opinion:
1. extract the needed dtds to a temp dir with a jar task and then delete em...
2. put the proper wls.jar in the classpath so ejbc could automatically resolve the dtds
Can anyone help or may be send his ant build file, where a <dtd> nested element is used for <ejbjar> for wls61?
Thank you in advance
AntonAnton,
Your second solution is the correct one. If you look at dtd element description under ejbjar task in the Ant manual, you'll see that vendors jars are required in Ant's classpath in order for ejbjar task to resolve DTD dependencies, in which case you don't need to specify dtd elements. I don't particularly like it either. If you find a better way to solve this problem, let me know.
-Dmitry
Maybe you are looking for
-
Cannot install itunes on window vista properly
I have been trying for hours to install my itunes into my new computer. It has windows vista .I put the ipod disc in the computer and it installs it the i put a music cd in it to copy and it stops a few seconds into the copy and says "ipod has stoppe
-
Is it possible to count the rows returned from a query?
Hello, When using JDBC is there anyway of finding out the number of rows returned from a query before actually getting each row? In Forms 4.5 you can use the count_query function, does anyone know of an equivalent function or work around in JDBC and/
-
Hi, How we will make a field Bolder in HR forms. Tcode PE51. Regards, Karthik.k
-
Stacked contents disappear when reach the end of the field
I have one content canvas and one stacked canvas, I have putting the show_view('canvas1') to show the stacked canvas in the when-new-form-instance. However, when I press enter on the first field in the content canvas, the stacked canvas disappear imm
-
Suddenly morning we can't access the call manager via https or ssh ,then we did hard reboot the server then its work fine. After the system come up then we take the RTMT logs to find out the what root causes of server was hung. As per the log file, I