Skip to main content

Error. java.lang.RuntimeException: Class or resource not found

5 replies [Last post]
hammmar
Offline
Joined: 2007-10-09

Hi,

Im developing some tests for a project using JT Harness. I have the test harness GUI up and running and I can see my tests in the tree-structure on the left side. When I try to execute a test I get the message:
Error. java.lang.RuntimeException: Class or resource not found:
where is a class that the test is dependant on. The class is listed in the testclasses.lst file.

I have also tried to edit the classpath variable in the testsuite.jtt file, but it doesnt seam like the harness uses that classpath.

I am not sure I understand were the harness looks for classfiles/jarfiles. Am I missing some classpath variable here?

BR
Rickard

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bkurotsu
Offline
Joined: 2004-12-13

Thanks! I knew there was a reason I didn't know what Rickard was talking about. ;)

bkurotsu
Offline
Joined: 2004-12-13

Hi.

Did you model your test suite on the demo? Or are you retrofitting something else?

If you first want to see if things work, you can put it on the classpath when you start the harness, but this should not be considered proper and the way to do it for the final test suite. But you can at least see if your other components are working.

Brian

hammmar
Offline
Joined: 2007-10-09

Hi,
The test suit have been under development for some time. What have changed is that the testclasses.lst file previously didnt contain any dependencies for the tests. It was just a plain list of the testfiles:
com//
/tck/configuration/GetConfigurationTests01.html#GetConfigurationTests01 com//
/tck/configuration/GetConfigurationTests01.class

Now, Im using Jini ClassDep tool to generate the dependencies for the tests, and put those classes in the testclasses.lst file. It looks someting like this:
com//
/tck/configuration/GetConfigurationTests01.html#GetConfigurationTests01 com//
/tck/configuration/GetConfigurationTests01.class,com//companion/CommandMessage.class,com//companion/Properties.class,...

The problem is that the harness now states: "Error. java.lang.RuntimeException: Class or resource not found: com//companion/CommandMessage.class"

I have tried to invoke the harness using "-classpath lib/share.jar" where share.jar is a jar that contains the classes in question. I have also tried to unzip the jar into the classes dir in the testsuit root.

Rickard

vsizikov
Offline
Joined: 2004-11-16

Hi Rickard,

It seems that you're developing a test suite for Java ME (MIDP stack, to be specific)?

If so, then you're probably using ME Framework (an extension of JavaTest Harness, created to help out with writing Java ME test suites).

The testClasses.lst file (please make sure you use the same capitalization) is used by a component called Test bundler. For every test, the Bundler looks into the testClasses.lst file to see which additional classes need to bu bunled into the test bundle. And then the bundle (a JAR file) is created and being sent to the device as a MIDlet.

Typically, the testClasses.lst resides in TCK_ROOT/classes/shared directory, and appropriate classes are in TCK_ROOT/classes/preverified

The bundler looks into these places by default. Please note the "preverified" part. The test classes, once compiled, need to be preverified or the Java ME implementation would reject them.

If all of the above is way off the line, just ignore it. :) But then, if you're not creating a Java ME test suite, you most probably don't need a testClasses.lst file at all.

hammmar
Offline
Joined: 2007-10-09

Hi,

Thats it, thanks!

You are correct in all your assumptions, I am developing for MIDP/CLDC.
The problem was that I had put my classes in TCK_ROOT/classes/shared/preverified instead of TCK_ROOT/classes/preverified.

Does this mean that I cant point out a jar-file by using the classpath in testsuite.jtt?
Does all required classes has to reside in TCK_ROOT/classes/preverified?

Thanks a lot for the answers.

BR
Rickard