im trying to invoke a specific class from within a jar file but I'm gettign below exception -
Buildfile: C:\Projects\GranHermano\build.xml
SignJadFilesInDir:
[java] java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Cell
My jar file contains all required jars (in this case poi-3.6-20091214.jar) so above exception should not be thrown.
This is how I am invoking the class -
<target name="SignJadFilesInDir" description="Signs all jad files in a dir" >
<java classname="com.src.SignDeviceJadInDir">
<classpath>
<pathelement location="BuildUtils.jar"/>
</classpath>
<arg line="${jadFileDir}"/>
<arg line="${devicesExcelDir}"/>
<arg line="${wtkDir}"/>
<arg line="${keyStoreDir}"/>
<arg line="${keyStoreId}"/>
<arg line="${keyStorePwd}"/>
</java>
</target>
Thanks
Can you please open jar BuildUtils.jar to ensure it well contains the classes of poi (and not poi jar, as I'm not aware of JRE support for jar-in-a-jar out of the box) ?
If your BuildUtils.jar contains poi-3.6-20091214.jar and not its classes, your exception is quite normal.
Related
After building EAR file when i'm trying to extract XML file form the EAR i'm getting error [exec] Failed to open properties file : AppManage.tra
<property name="Appmanage" value="C:\tibco\etascbw513\tra\5.10\bin\AppManage.exe" />
<target name="extract">
<exec executable="${Appmanage}">
<arg value="-export"/>
<arg value="-ear"/>
<arg value="${workdir}\Deploy\EARs\${project}.ear"/>
<arg value="-out"/>
<arg value="${workdir}\Deploy\EARs\${project}.xml"/>
<arg value="-max"/>
</exec>
old Q : can someone share simple build.xml to create ear file from ant script
details : i'm able to pull repositories with the help ant script now i want to create EAR file from ant script for Tibco BW. can any one share simple demo .
try to solve this error using below steps.
try to check your environment variable path.
check TRA_HOME/bin/ using App manage utility.
This error "Failed to open properties file : AppManage.tra" occurs because the AppManage executable tries to look for AppManage.tra in the current execution directory and does not find it. In this particular case, the current execution directory would depend on where you are executing Ant from.
The correct way to avoid this error is to provide full path to the AppManage.tra file as an argument to the AppManage executable in the ant exec statement, as shown below, in the highlighted section (two new arguments are added "--propFile" and "full path to AppManage.tra"). Hope this helps.
<property name="Appmanage" value="C:\tibco\etascbw513\tra\5.10\bin\AppManage.exe" />
<target name="extract">
<exec executable="${Appmanage}">
<arg value="--propFile"/>
<arg value="C:\tibco\etascbw513\tra\5.10\bin\AppManage.tra"/>
<arg value="-export"/>
<arg value="-ear"/>
<arg value="${workdir}\Deploy\EARs\${project}.ear"/>
<arg value="-out"/>
<arg value="${workdir}\Deploy\EARs\${project}.xml"/>
<arg value="-max"/>
</exec>
I am using ant to build my legacy project in which we generate Java class from XSD using JAXB and below is the ant config I have. JAXB parser is getting invoked properly and Java classes are getting created without any issue but ant stops building my project further after it invokes com.sun.tools.xjc.XJCFacade class. Even the echo statement message="Finished creating JAXB class" doesn't get executed. I don't get any error message from ant build but it stops after creating the java classes. Not sure what the issue is; would really appreciate if someone could help me with this issue.
<target name="compile" >
<echo message="start creating JAXB class" />
<java classname="com.sun.tools.xjc.XJCFacade"/">
<arg value="input.xsd"/>
<arg value="-b"/>
<arg value="input.jxb"/>
<arg value="-d"/>
<arg value="target.dir"/>
<classpath>
<pathelement path="classpath"/>
</classpath>
</java>
<echo message="Finished creating JAXB class" />
</target>
I am creating webservice using AXIS and running this using ANT script.
<target if="jars.ok" depends="make.repo" name="start.server">
<property name="port" value="7070"/>
<java fork="true" classname="org.apache.axis2.transport.http.SimpleHTTPServer">
<arg value="${build}/repo"/>
<classpath refid="axis2.class.path"/>
<arg value="-p${port}"/>
</java>
</target>
Setted classpath using
<path id="axis2.class.path">
<pathelement path="${java.class.path}"/>
<pathelement path="${maven.class.path}"/>
<fileset dir="${axis2.home}">
<include name="lib/*.jar"/>
<include name="resources/*.properties"/>
</fileset>
</path>
But i am getting error as
[java] log4j:WARN Please initialize the log4j system properly [SimpleHTTPServer]
What do I need to do to fix this issue, thanks a lot
You can not add Property files as classpath, just folders and Jar files.
So here include the whole resources folder:
pathelement path="${axis2.home}/resources"
My project is as given below.
properties
lib
a.jar
b.jar
c.jar
d.jar
log4j.jar
build.xml
I have a java task which references a jar in the lib folder. It writes the output as per the config in log4j properties.
Now where do i place the log4j.properties & mention it in ant java task.
This is how i run the java task & include jars for my project.
<path id="proj.classpath">
<fileset dir="${basedir}/lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="some-task">
<java classname="my.class.main"
classpathref="proj.classpath">
<arg value="some args"/>
</java>
</target>
In your java class, include this in the main method. Pass the file path of the log4j.properties
PropertyConfigurator.configure(args[0]);
Something like this
<java classname="my.class.main"
classpathref="proj.classpath">
<arg value="log4j.properties path"/>
<arg value="some args"/>
</java>
I need to add a folder in current classpath for ant script that I have written for running java files. How can it be done?
You could add it as an attribute
<java classpath="${extraDir}"
classname="pkg.Class">
...
</java>
Or using the nested <classpath> tag:
<java classname="pkg.Class">
<classpath>
<pathelement path="${extraDir}"/>
</classpath>
</java>
See the documentation for the Java task.
i added the following line in the tag of the task and it ran successfully.
<pathelement path="C:\JunitTest\folderIsHere"/>
and after this the script ran successfully.