| Author |
earExport within RAD 6.0
|
Ugur Sipahi
Greenhorn
Joined: Nov 18, 2005
Posts: 3
|
|
Hello, I am used to export EAR file via Ant Task "earExport" for my project within WebSphere Application Developer 5.1.2. Now, I am trying Rational Application Developer and same Ant script containing "earExport" does not work, instead produces following error explanations: Buildfile: D:\UgurS\EARexport.xml ExportEAR: [echo] Exporting EAR... BUILD FAILED: D:\UgurS\EARexport.xml:10: Could not create task or type of type: earExport. Ant could not find the task or a class this task relies upon. This is common and has a number of causes; the usual solutions are to read the manual pages then download and install needed JAR files, or fix the build file: - You have misspelt 'earExport'. Fix: check your spelling. - The task needs an external JAR file to execute and this is not found at the right place in the classpath. Fix: check the documentation for dependencies. Fix: declare the task. - The task is an Ant optional task and the JAR file and/or libraries implementing the functionality were not found at the time you yourself built your installation of Ant from the Ant sources. Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the task and make sure it contains more than merely a META-INF/MANIFEST.MF. If all it contains is the manifest, then rebuild Ant with the needed libraries present in ${ant.home}/lib/optional/ , or alternatively, download a pre-built release version from apache.org - The build file was written for a later version of Ant Fix: upgrade to at least the latest release version of Ant - The task is not an Ant core or optional task and needs to be declared using <taskdef>. - You are attempting to use a task defined using <presetdef> or <macrodef> but have spelt wrong or not defined it at the point of use Remember that for JAR files to be visible to Ant tasks implemented in ANT_HOME/lib, the files must be in the same directory or on the classpath Please neither file bug reports on this problem, nor email the Ant mailing lists, until all of these causes have been explored, as this is not an Ant bug. Total time: 485 milliseconds *** My simple EARExport.xml is as follows: <?xml version="1.0" encoding="UTF-8"?> <project name="PrjExportEAR" default="ExportEAR"> <target name="ExportEAR" description="Exports ProjectEAR"> <echo>Exporting EAR...</echo> <earExport EARProjectName="ProjectEAR" EARExportFile="D:\UgurS\ProjectEAR.ear"/> <echo>Finished building ProjectEAR!</echo> </target> </project> *** Can anybody help me to get rid of errors? Thanks in advance.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26168
|
|
Ugur, Welcome to JavaRanch! earExport is a task provided with RAD 6.0. Since it's not a core part of ant, you have to define a taskdef tag to point to it. I don't have the path information for that tag on hand, but I imagine it is in the RAD 6 help. This isn't necessary within RAD 6 because the tool automatically includes it in the classpath.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Ugur Sipahi
Greenhorn
Joined: Nov 18, 2005
Posts: 3
|
|
Thanks a lot Jeanne... After following your recommendations, though I have got rid of the problem I mentioned, unfortunately I am still in trouble. These are what happened: 1. I have added this line into my EAR Export.xml. <taskdef name="earExport" classname="com.ibm.etools.j2ee.ant.EARExport" classpath="antj2ee.jar" /> 2. I have got a couple of "A class needed by class com.ibm.etools.j2ee.ant.EARExport cannot be found" error. I found out the missing dependencies from eclipse and the "class cannot be found" errors disappeared after adding core.runtime, core.resources and osgi plugin jars to the ant classpath. 3. I now have no more "class cannot be found" errors but instead NullPointerException (without any explanation, no stack info) during earExport task execution: Buildfile: D:\UgurS\EARexport.xml ExportEAR: [echo] Exporting EAR ... [earExport] Exporting: ProjectEAR (Begin) ... BUILD FAILED: D:\UgurS\EARexport.xml:7: java.lang.NullPointerException Total time: 249 milliseconds *** My EARExport.xml is as follows now: <?xml version="1.0" encoding="UTF-8"?> <project name="PrjExportEAR" default="ExportEAR"> <taskdef name="earExport" classname="com.ibm.etools.j2ee.ant.EARExport" classpath="antj2ee.jar" /> <target name="ExportEAR" description="Exports ProjectEAR"> <echo message="Exporting EAR ..."/> <earExport EARProjectName="ProjectEAR" EARExportFile="D:\UgurS\ProjectEAR.ear"/> <echo>Finished building ProjectEAR!</echo> </target> </project> *** So, do you have any further recommendations?
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26168
|
|
Ugur, I'm still on WSAD 6, so I haven't used this task myself. A couple of general things though: 1) Does the EAR export without error in RAD (without using Ant) ? 2) Does a simplified ear export? Maybe one with just a web project? Often a NullPointer is a sign of some unexpected input.
|
 |
usama rashwan
Greenhorn
Joined: Nov 27, 2005
Posts: 1
|
|
Hi Ugur Sipahi , to run the RAD ant tasks you need to run the task on the same JRE as the RAD , you can do this by select Run Ant .... from ant view this will open Ant proparty page in the JRE tap select run on the same JRE
|
 |
Ugur Sipahi
Greenhorn
Joined: Nov 18, 2005
Posts: 3
|
|
Hi Usama, Thank you very much for your recommendations. I could not find this clue myself... My EAR export worked this time. But, I observed that, there is also a problem with the mail sending portion of my whole ant script (which worked fine with WSAD 5.1.2). It looks like: *** <target name="SendMail" depends="ExportEAR" description="Sends mail to project participants"> <echo message="Sending mail to project participants..."/> <mail mailhost="server" subject="New EAR exported" from = "UserEmail" tolist ="RecipientEmail" message = "New EAR exported to this path: ..." /> </target> *** Note that the mail sending script only worked successfully with "Seperate JRE" set as Java SDK... The error message says "java.lang.NoClassDefFoundError: com.sun.mail.util.SharedByteArrayInputStream Do you know how it can be resolved?
|
 |
Damien Joldersma
Greenhorn
Joined: Mar 24, 2005
Posts: 4
|
|
Originally posted by usama rashwan: Hi Ugur Sipahi , to run the RAD ant tasks you need to run the task on the same JRE as the RAD , you can do this by select Run Ant .... from ant view this will open Ant proparty page in the JRE tap select run on the same JRE
Right on, thanks alot I had this problem for a while and finally found your post and solved it, thx!
|
 |
Ranvir Dalal
Greenhorn
Joined: Jan 31, 2003
Posts: 8
|
|
Hi I am using this ant file in RAD 6 <?xml version="1.0" encoding="UTF-8"?> <project default="exportEar"> <target name="exportEar" depends=""> <echo message="Exported EAR files to " /> <earExport earprojectname="e1" earexportfile="C:/RTemp/e1.ear" exportsource="true" IncludeProjectMetaFiles="false" overwrite="true" /> <echo message="Test Message"/> </target> </project> It works fine no errors but I do not see the file generated here is the output at console Buildfile: C:\workspace\e1\META-INF\build.xml exportEar: [echo] Exported EAR files to [earExport] Exporting: e1 (Begin) ... [echo] Test Message BUILD SUCCESSFUL Total time: 219 milliseconds Thanks
|
 |
aitor alzola
Greenhorn
Joined: Sep 07, 2004
Posts: 14
|
|
|
Same problem, good solution, thanks!!!
|
 |
 |
|
|
subject: earExport within RAD 6.0
|
|
|