ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Petar Tahchiev" <paranoia...@gmail.com>
Subject Re: NoClassDefFoundError: org/apache/tools/ant/Task
Date Mon, 05 Feb 2007 08:03:07 GMT
On 05/02/07, Neeraj Gopalakrishnan Nair, HCL-Industry Solutions <
neerajg@hcl.in> wrote:
>
>
> If it shows the exception 'NoClassDefFoundException',I think it is the
> problem with your classpath. Try running WSDL2Java using java.exe as:
> java org.apache.axis.wsdl.WSDL2Java <file.wsdl>, after setting your
> classpath properly.
>
> Regards,
>
> Neeraj GS
> HCL Tecnologies, STC - Chennai.
>
> -----Original Message-----
> From: Petar Tahchiev [mailto:paranoiabla@gmail.com]
> Sent: Monday, February 05, 2007 1:21 PM
> To: Ant Users List
> Subject: NoClassDefFoundError: org/apache/tools/ant/Task
>
> Hi guys,
>
> Here is my problem. I am currently running on a Windows box at work and
> I
> downloaded the ant-1.7 package and installed it. Then I downloaded the
> axis-1.4 package and I am trying to use the wsdl2java task, like it is
> written in the manual:
>
> <path id="axis.classpath">
>   <fileset dir="${axis.home}/build/lib">
>     <include name="**/*.jar" />
>   </fileset>
> </path>
>
>
> <taskdef resource="axis-tasks.properties"
>   classpathref="axis.classpath" />
>
>
> <axis-wsdl2java
>   output="${generated.dir}"
>   testcase="true"
>   verbose="true"
>   url="${local.wsdl}" >
>     <mapping
>       namespace="http://axis.apache.org/ns/interop"
>       package="interop" />
>   </axis-wsdl2java>
>
> but I get a classNotFound exception in the ant-core:
>
>
> axis-init:
> [antlib:org.apache.tools.ant] Could not load definitions from resource
> org/apac
> e/tools/ant/antlib.xml. It could not be found.
>
> BUILD FAILED
> C:\Documents and Settings\Petar\My
> Documents\workspace\WebServiceClient\build.x
> l:11: taskdef A class needed by class
> org.apache.axis.tools.ant.wsdl.Wsdl2javaA
> tTask cannot be found: org/apache/tools/ant/Task
>         at
> org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java
> :613
>
>         at
> org.apache.tools.ant.taskdefs.Definer.loadProperties(Definer.java
> :41
> )
>         at
> org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:268)
>         at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> :288)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl
> java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAcce
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.apache.tools.ant.dispatch.DispatchUtils.execute(
> DispatchUtils.ja
> a:105)
>         at org.apache.tools.ant.Task.perform(Task.java:348)
>         at org.apache.tools.ant.Target.execute(Target.java:357)
>         at org.apache.tools.ant.Target.performTasks(Target.java:385)
>         at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java
> :1329)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
> (DefaultEx
> cutor.java:41)
>         at
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>         at org.apache.tools.ant.Main.runBuild(Main.java:698)
>         at org.apache.tools.ant.Main.startAnt(Main.java:199)
>         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
>         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> Caused by: java.lang.NoClassDefFoundError: org/apache/tools/ant/Task
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>         at java.security.SecureClassLoader.defineClass(
> SecureClassLoader.java:1
> 4)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at org.apache.tools.ant.AntClassLoader.findBaseClass(
> AntClassLoader.jav
> :1414)
>         at
> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java
> :10
> 8)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:242)
>         at
> org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java
> :583
>
>         ... 19 more
> --- Nested Exception ---
> java.lang.NoClassDefFoundError: org/apache/tools/ant/Task
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>         at java.security.SecureClassLoader.defineClass(
> SecureClassLoader.java:1
> 4)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at org.apache.tools.ant.AntClassLoader.findBaseClass(
> AntClassLoader.jav
> :1414)
>         at
> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java
> :10
> 8)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:242)
>         at
> org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java
> :583
>
>         at
> org.apache.tools.ant.taskdefs.Definer.loadProperties(Definer.java
> :41
> )
>         at
> org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:268)
>         at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> :288)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl
> java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAcce
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.apache.tools.ant.dispatch.DispatchUtils.execute(
> DispatchUtils.ja
> a:105)
>         at org.apache.tools.ant.Task.perform(Task.java:348)
>         at org.apache.tools.ant.Target.execute(Target.java:357)
>         at org.apache.tools.ant.Target.performTasks(Target.java:385)
>         at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java
> :1329)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
> (DefaultEx
> cutor.java:41)
>         at
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>         at org.apache.tools.ant.Main.runBuild(Main.java:698)
>         at org.apache.tools.ant.Main.startAnt(Main.java:199)
>         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
>         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
>
> Total time: 0 seconds
> C:\Documents and Settings\Petar\My
> Documents\workspace\WebServiceClient>echo
> %A
> T_HOME%
> C:\Documents and Settings\Petar\My Documents\apache-ant-1.7.0
>
> ========================================================================
>
> The wierdest thing is that yesterday, at home it was working perfectly
> on my
> Fedora Core 6.
>
> If anyone has an idea what is going on, I would be glad to know.
>
> Thank you.
>
> --
> Regards, Petar!
> Karlovo, Bulgaria.
>
> DISCLAIMER:
>
> -----------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and
> intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its
> affiliates. Any views or opinions presented in
> this email are solely those of the author and may not necessarily reflect
> the opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure,
> modification, distribution and / or publication of
> this message without the prior written consent of the author of this
> e-mail is strictly prohibited. If you have
> received this email in error please delete it and notify the sender
> immediately. Before opening any mail and
> attachments please check them for viruses and defect.
>
>
> -----------------------------------------------------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
I don't think that will help, because when I execute the task like that,
then it will definitely blow the exception again, as the ant.jar will not be
in the classpath.
The excpetion is really wierd, because it tells me that ant.jar is not in my
classpath(the class org/apache/tools/ant/Task is in ant.jar) but after
running ant with -diagnostics option I see that ant.jar is loaded.

Any other opinions?

-- 
Regards, Petar!
Karlovo, Bulgaria.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message