db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Suran Jayathilaka <suran...@gmail.com>
Subject Re: ClassDefNotFoundError for ij when running test
Date Mon, 24 Mar 2008 12:37:17 GMT
Hi Narayanan,

Using the $CLASSPATH variable instead of -cp seems to do the trick.
Thanks for the help.

Suran.

On Mon, 2008-03-24 at 08:54 +0530, Narayanan wrote:
> Narayanan wrote:
> > Suran Jayathilaka wrote:
> >> Hi all,
> >>
> >> I have the derby source built successfully and the jars were created.
> >> Using a classpath that contains the jars/classes I can start ij. But
> >> when I try to run a test, say supersimple.sql, with the exact same
> >> classpath, I get a Exception in thread "main"
> >> java.lang.NoClassDefFoundError:org/apache/derby/tools/ij
> >>
> >> -----
> >> 27 del
> >> < 0 rows inserted/updated/deleted
> >> 28 del
> >> < ij> 28 add
> >>  
> >>> Exception in thread "main" java.lang.NoClassDefFoundError:
> >>>     
> >> org/apache/derby/tools/ij
> >> Test Failed.
> >> *** End:   supersimple jdk1.5.0_09 2008-03-24 02:49:30 ***
> >> -----------
> >>
> >> The command I issue is like the following (ignore the linebreaks). This
> >> command I issued from the derby.source folder after successfully
> >> building. The same occurs if I try with the jars.
> >>
> >> java
> >> -cp 
> >> ../derbytest/testingjars/junit-3.8.2.jar:../derbytest/testingjars/jakarta-oro-2.0.8.jar:classes/

> >> org.apache.derbyTesting.functionTests.harness.RunTest 
> >> lang/supersimple.sql
> >>
> >> But if I give
> >> java
> >> -cp 
> >> ../derbytest/testingjars/junit-3.8.2.jar:../derbytest/testingjars/jakarta-oro-2.0.8.jar:classes/

> >> org.apache.derby.tools.ij
> >> ij starts with no trouble.
> >>
> >> I spent a couple of hours trying to fins out what the problem is, to no
> >> avail. Can anyone please help?
> >>
> >> Thanks.
> >> Suran.
> >>
> >>   
> > Hi,
> >
> > I set my CLASSPATH variable to
> >
> > /home/vn/work/workspaces/freshworkspace/trunk/classes:
> > /home/vn/work/workspaces/freshworkspace/trunk/tools/java/jakarta-oro-2.0.8.jar:

> >
> > /home/vn/work/workspaces/freshworkspace/trunk/tools/java/junit.jar
> >
> > basically same as yours,
> >
> > and it seemed to work fine.
> >
> > Narayanan
> 
> I have a theory for why setting CLASSPATH works but -cp does not
> 
> I think internally there is a fork to execute the test you want to run
> 
> See RunTest.java, method execTestProcess(String[] testCmd), line no 2529,
> 
> pr = Runtime.getRuntime().exec(testCmd);
> 
> So basically I think when you do a -cp the classpath is not inherited by 
> the fork.
> 
> So I guess you need to set the environment variable.
> 
> Narayanan


Mime
View raw message