| "java.lang.ClassNotFoundException " when running junit task | "java.lang.ClassNotFoundException " when running junit task 2007-01-02 - By Scot P. Floess
Oops - my bad...no line wrap :(
Well something else to try, add the path to build-tests as part of the path...
For instance if build-tests exists as /foo/bar/build-test, put /foo/bar/build-tests in as a path element...
Or try using
<pathelement path = " "/>
instead of
<pathelement location = " "/>
I think the problem is you need to use the path attribute
Alasdair Young wrote: > Thanks for the fast response! > > I don't think that's it - ./build-tests should be in there - 3rd from > the end. > > any other ideas perhaps? > > - alasdair > > > > Scot P. Floess wrote: > >> Looks like you need to put ./build-tests in your path element. >> >> <pathelement >> location="./build-tests:.:../java/build:../thirdParty/signedJars/jh.jar:.. /thirdParty/signedJars/jai_codec.jar:../thirdParty/signedJars/jcchart.jar:.. /thirdParty/signedJars/jlfgr-1_0.jar:../thirdParty/signedJars/ojdbc14.jar:.. /thirdParty/signedJars/scrollabledesktop.jar:../thirdParty/signedJars/ftpbean .jar:../thirdParty/signedJars/jai_core.jar:../thirdParty/signedJars/jdbcpool-0 .99.jar:../thirdParty/signedJars/log4j-1.2.5.jar:../thirdParty/signedJars /pg73jdbc3.jar:../thirdParty/unsignedJars/jmf.jar:../thirdParty/unsignedJars /commons-collections.jar:../thirdParty/unsignedJars/commons-pool-1.1.jar:.. /thirdParty/unsignedJars/commons-dbcp-1.1.jar:../thirdParty/signedJars/jcalendar .jar:${tomcat-dir}/common/lib/servlet-api.jar:${tomcat-dir}/common/lib/jsp-api .jar:../thirdParty/unsignedJars/junit-4.1.jar:./build-tests:../javatest:./build -tests/com/vigilos/apps/setup/TestScheduledtlTableModel.class" >> >> /> >> >> >> Alasdair Young wrote: >> >>> I should also mention that >>> ./build-tests/com/vigilos/apps/setup/TestScheduledtlTableModel.class >>> exists and is the class I wish to run. >>> >>> Hmm... could it be an issue with not looking in the right directory? >>> >>> - alasdair >>> >>> Alasdair Young wrote: >>> >>> >>>> Hi! >>>> >>>> I'm trying to set up some automated builds for the first time here and >>>> I'm using a legacy ant build script that I've been hacking away at to >>>> get junit working. >>>> >>>> I am running ant 1.7, Junit 4.1 and java 1.5 on fedora core 5. >>>> >>>> When I try to get junit to run my tests via ant, I get the following: >>>> >>>> >>>> >>>>> test: >>>>> [junit] Testsuite: >>>>> com.vigilos.apps.setup.TestScheduledtlTableModel >>>>> [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec >>>>> >>>>> [junit] Null Test: Caused an ERROR >>>>> [junit] com.vigilos.apps.setup.TestScheduledtlTableModel >>>>> [junit] java.lang.ClassNotFoundException: >>>>> com.vigilos.apps.setup.TestScheduledtlTableModel >>>>> [junit] at >>>>> java.net.URLClassLoader$1.run(URLClassLoader.java:200) >>>>> [junit] at java.security.AccessController.doPrivileged(Native >>>>> Method) >>>>> [junit] at >>>>> java.net.URLClassLoader.findClass(URLClassLoader.java:188) >>>>> [junit] at >>>>> java.lang.ClassLoader.loadClass(ClassLoader.java:306) >>>>> [junit] at >>>>> java.lang.ClassLoader.loadClass(ClassLoader.java:251) >>>>> [junit] at >>>>> java.lang.ClassLoader.loadClass(ClassLoader.java:251) >>>>> [junit] at >>>>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) >>>>> [junit] at java.lang.Class.forName0(Native Method) >>>>> [junit] at java.lang.Class.forName(Class.java:242) >>>>> >>>>> >>>>> >>>>> BUILD FAILED >>>>> /home/ayoung/vigilos/subversion/trunk/java/build.xml:42: Test >>>>> com.vigilos.apps.setup.TestScheduledtlTableModel failed >>>>> >>>>> >>>> relevant parts of build.xml: >>>> >>>> >>>> >>>>> <property name="test.dir" location="../javatest"/> >>>>> <property name="build.test.dir" location="build-tests"/> >>>>> >>>>> <path id="project.classpath"> >>>>> <pathelement >>>>> location=".:../java/build:../thirdParty/signedJars/jh.jar:../thirdParty /signedJars/jai_codec.jar:../thirdParty/signedJars/jcchart.jar:../thirdParty /signedJars/jlfgr-1_0.jar:../thirdParty/signedJars/ojdbc14.jar:../thirdParty /signedJars/scrollabledesktop.jar:../thirdParty/signedJars/ftpbean.jar:.. /thirdParty/signedJars/jai_core.jar:../thirdParty/signedJars/jdbcpool-0.99.jar:. ./thirdParty/signedJars/log4j-1.2.5.jar:../thirdParty/signedJars/pg73jdbc3.jar:. ./thirdParty/unsignedJars/jmf.jar:../thirdParty/unsignedJars/commons-collections .jar:../thirdParty/unsignedJars/commons-pool-1.1.jar:../thirdParty/unsignedJars /commons-dbcp-1.1.jar:../thirdParty/signedJars/jcalendar.jar:${tomcat-dir} /common/lib/servlet-api.jar:${tomcat-dir}/common/lib/jsp-api.jar:../thirdParty /unsignedJars/junit-4.1.jar:./build-tests:../javatest:./build-tests/com/vigilos /apps/setup/TestScheduledtlTableModel.class" >>>>> >>>>> /> >>>>> </path> >>>>> >>>>> >>>> >>>> >>>>> <target name="test"> >>>>> <junit haltonfailure="true" fork="yes"> >>>>> <classpath refid="project.classpath" /> >>>>> <formatter type="brief" usefile="false" /> >>>>> <batchtest> >>>>> <fileset dir="${build.test.dir}" >>>>> includes="**/*.class" /> >>>>> </batchtest> >>>>> </junit> >>>>> </target> >>>>> >>>>> >>>> NOTES: >>>> >>>> I have junit-4.1.jar in my $ANT_HOME/lib >>>> >>>> The project.classpath is a mess - several items at the end were tacked >>>> on as I tried different things. >>>> >>>> I read the FAQ entry >>>> (http://ant.apache.org/faq.html#delegating-classloader) and several >>>> blogs that also described the issue - I am not able to make any of >>>> these >>>> resources useful to me. Either they don't apply or my lack of >>>> understanding is getting in the way. >>>> >>>> (Specifically: "Ant doesn't load the external library directly, it is >>>> the loaded class that does so. In the case of |<junit>| it is the task >>>> implementation itself." doesn't make a lot of sense to me.) >>>> >>>> So... any ideas? >>>> >>>> I tried running ant with -debug turned on and didn't notice anything >>>> obvious. I think my next step is to take that horrible mess of a >>>> project.classpath and turn it into a collection of seperate >>>> <pathelement> tags and then find out if any of these can't be found but >>>> I would welcome any help that anyone can give me. >>>> >>>> Kind regards, >>>> >>>> - alasdair >>>> >>>> Alasdair Young >>>> Vigilos Inc. >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: user-unsubscribe@(protected) >>>> For additional commands, e-mail: user-help@(protected) >>>> >>>> >>>> >>>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@(protected) >>> For additional commands, e-mail: user-help@(protected) >>> >>> >>> >>> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@(protected) > For additional commands, e-mail: user-help@(protected) > > >
-- Scot P. Floess 27 Lake Royale Louisburg, NC 27549
252-478-8087 (Home) 919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate Chief Architect JavaPIM http://sourceforge.net/projects/javapim
|
|
 |