For some of our users of watij, they are unable to run tests and receive a noclass def exception. The exception is below. This exception is ocurring in watij when we first try to create an instance of IEAutomation:
WebBrowser webBrowser = new IEAutomation();
The exception is:
java.lang.NoClassDefFoundError
at com.jniwrapper.win32.ie.HeadlessBrowser.a(SourceFile:91)
at com.jniwrapper.win32.ie.HeadlessBrowser.(SourceFile:21)
at watij.runtime.ie.IE$1.isReady(IE.java:85)
at watij.time.WaiterImpl.waitUntil(WaiterImpl.java:16)
at watij.runtime.ie.IE.start(IE.java:82)
at watij.runtime.ie.IE.start(IE.java:408)
at watij.GoogleTest.testGoogleSearch(GoogleTest.java:12)
I double checked with the user that they had jniwrap.dll in their system32 folder and also have jniwrap and jexplorer jars in the classpath. What is odd is that if they run a small test with our preconfigured packaged version of Beanshell, it works just fine. However, running a test from the command line or from eclipse gives us the above stack.
Is there possible a dll on this machine that is not registered? Any help would be appreciated.
Jake Dempsey
www.watij.com
Hi Jake,
I have tried to run the following example from the command line and from eclipse:
IEAutomation automation = new IEAutomation();
automation.setVisible(true);
automation.navigate("www.google.com");
automation.waitReady();
And I didn't get any exceptions. The example works well.
In fact jniwrap.dll doesn't have any relation to the current stack trace. This exception is thrown because the specified class could not be found. Please make sure you didn't change the JExplorer library (jexplorer.jar). Also please specify the build number of JExplorer that you use. You can find the build number in the jexplorer.jar\META-INF\MANIFEST.MF file. It will greatly help us in reproducing the issue.
Regards,
Vladimir
I have not changed the jar... What is odd is that this works on most machines but does not on a few machines. The build info from our jexplorer jar is:
Build: 481
Title: JExplorer Professional
Version: 1.7
Again, this does not fail on all machines, only certain machines. Is there any rules to in what order the jars have to be on the classpath?
We don't have any rules to in what order the jars have to be on the classpath. But I recommend to include the jars onto the classpath in the following order:
- comfyj.jar
- jexplorer.jar
- jniwrap.jar
- winpack.jar
- the libraries of your application
Try to specify the classpath of your application by the above way and let me know the results. Also could you specify the customer environment (like OS and IE version)?
Regards,
Vladimir
Message was edited by: Vladimir Ikryanov
I will try to get this information from the user. I do know that they are using Windows XP (not sure if its sp1 or sp2) and I know they are using IE 6.0.
I also tried moving the jars around in various orders without an issue. I will have them try to put the jars in the order you have provided and also get the system info. I have a couple of users with this issue.
Jake
I figured out the problem:
1. I had the user try the library order as you suggested and that did not solve the problem.
I had the user manually place C:\WINDOWS\system32 on their PATH and it began working. The user was getting the original stack trace, but to further identify the problem, I had the user run the following test:
import com.jniwrapper.win32.ie.IEAutomation;
import com.jniwrapper.win32.ie.WebBrowser;
import junit.framework.TestCase;
public class TestOne extends TestCase {
public void testOne() throws Exception {
WebBrowser browser = new IEAutomation();
((IEAutomation) browser).setVisible(true);
browser.navigate("www.google.com");
browser.waitReady();
}
}
When they ran this test, they got another exception that the jniwrap.dll could not be found. For some reason, it seems that java does not have system32 as a part of its LD_LIBRARY_PATH. After explicitly adding system32 to the PATH, the problem was resolved.
Jake Dempsey
www.watij.com
Hi Jake,
I am glad that you solved the issue.
Please contact us if you have any further questions.
Regards,
Vladimir