How to integrate SWTBot test in Jenkins CI? - ant

I've got a SWT application (not Eclipse RCP based) and I currently test it using SWTBot. This works fine while running the tests from Eclipse. I'm using ant as buildsystem.
On Jenkins the tests fail - an exception is thrown
[junit] Testcase: testPasswordChange(de.rssit.kgepc.swtbot.ChangePasswordTest): Caused an ERROR
[junit] null
[junit] java.lang.ExceptionInInitializerError
[junit] at org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeCharacter(Keyboard.java:100)
[junit] at org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeText(Keyboard.java:89)
[junit] at org.eclipse.swtbot.swt.finder.widgets.SWTBotText.typeText(SWTBotText.java:92)
[junit] at org.eclipse.swtbot.swt.finder.widgets.SWTBotText.typeText(SWTBotText.java:78)
[junit] at de.foo.swtbot.pages.PasswordDialogPage.setText(PasswordDialogPage.java:70)
[junit] at de.foo.swtbot.pages.PasswordDialogPage.setOldPassword(PasswordDialogPage.java:30)
[junit] at de.foo.swtbot.ChangePasswordTest.testPasswordChange(ChangePasswordTest.java:43)
[junit] at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getKeyboardLayout(KeyboardLayout.java:89)
[junit] at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getDefaultKeyboardLayout(KeyboardLayout.java:75)
[junit] at org.eclipse.swtbot.swt.finder.keyboard.Keystrokes.<clinit>(Keystrokes.java:110)
Searching for this specific problem did not result in any helpful solution.
Edit:
Adding the jvm args to set US english fixes this isse and makes some tests run; all other bring the following stacktrace:
[junit] Running foo.bar.swtbot.ChangePasswordTest
[junit] Testsuite: foo.bar.swtbot.ChangePasswordTest
[junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 1.453 sec
[junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 1.453 sec
[junit]
[junit] Testcase: testPasswordChange(foo.bar.swtbot.ChangePasswordTest): FAILED
[junit] null
[junit] junit.framework.AssertionFailedError: null
[junit] at foo.bar.swtbot.ChangePasswordTest.testPasswordChange(ChangePasswordTest.java:46)
[junit]
[junit]
[junit] Cobertura: Loaded information on 219 classes.
[junit] Cobertura: Saved information on 219 classes.
[junit] Test foo.bar.swtbot.ChangePasswordTest FAILED
[junit] Running foo.bar.swtbot.LoginDialogTest
[junit] Testsuite: foo.bar.swtbot.LoginDialogTest
[junit] Exception in thread "UIThread" org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.swt.SWTException: Widget is disposed)
[junit] at org.eclipse.swt.SWT.error(SWT.java:4282)
[junit] at org.eclipse.swt.SWT.error(SWT.java:4197)
[junit] at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
[junit] at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
[junit] at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
[junit] at foo.bar.swtbot.UIThread$1.run(UIThread.java:79)
[junit] at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
[junit] at foo.bar.swtbot.UIThread.startEventLoop(UIThread.java:74)
[junit] at foo.bar.swtbot.UIThread.run(UIThread.java:59)
[junit] Caused by: org.eclipse.swt.SWTException: Widget is disposed
[junit] at org.eclipse.swt.SWT.error(SWT.java:4282)
[junit] at org.eclipse.swt.SWT.error(SWT.java:4197)
[junit] at org.eclipse.swt.SWT.error(SWT.java:4168)
[junit] at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
[junit] at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:340)
[junit] at org.eclipse.swt.widgets.Control.setVisible(Control.java:3725)
[junit] at foo.bar.gui.Main.tryLogin(Main.java:142)
[junit] at foo.bar.gui.Main.open(Main.java:117)
[junit] at foo.bar.swtbot.AbstractMainTest$1.run(AbstractMainTest.java:46)
[junit] at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
[junit] at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
[junit] ... 6 more
[junit] Exception in thread "Timer-0" org.eclipse.swt.SWTException: Widget is disposed
[junit] at org.eclipse.swt.SWT.error(SWT.java:4282)
[junit] at org.eclipse.swt.SWT.error(SWT.java:4197)
[junit] at org.eclipse.swt.SWT.error(SWT.java:4168)
[junit] at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
[junit] at org.eclipse.swt.widgets.Widget.getDisplay(Widget.java:582)
[junit] at foo.bar.gui.AbstractKGEAdminDialog$1.run(AbstractKGEAdminDialog.java:46)
[junit] at java.util.TimerThread.mainLoop(Timer.java:512)
[junit] at java.util.TimerThread.run(Timer.java:462)

Regarding java.lang.ExceptionInInitializerError
I notice that there are / have been Eclipse bugs relating to missing keyboard layout for DE_DE locale. Could I suggest you check the locale settings of the process running the junit tests. If you set the locale to en_US, does the problem still arise?
Apart from setting the locale for the server process (e.g. LC_ALL environment variable?), perhaps you could use explicit locale in your junit task, e.g.
<junit fork="yes">
<jvmarg value="-Duser.language=en"/>
<jvmarg value="-Duser.region=US"/>
Regarding org.eclipse.swt.SWTException: Widget is disposed
Maybe this is exposing a real bug in your UI code, but I suspect you need to look at your unit tests. Are they stateless, or do they depend on a certain execution order to work reliably? Perhaps this error can arise if the tests are executed in a different order than you expect.

Related

building cassandra test cases failing

I am trying to build cassandra binaries from source and when I try to compile unit test cases, some of them give me errors. I tried versions 2.0.14, 2.1.4 and 2.1.5 with ubuntu 14.04 and Java 7 as well as Java 8. This is the message I get after building the test cases:
BUILD FAILED
/opt/cassandra/build.xml:1139: Some test bucket 0 test(s) failed.
Total time: 17 minutes 13 seconds
Buildfile: `/opt/cassandra/build.xml`
Am I doing something wrong? This is how I am trying to build:
ant
ant build
ant build-test
ant test
ant artifacts
[junit] Testsuite: org.apache.cassandra.utils.BitSetTest
[junit] Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.075 sec
[junit]
[junit] Testcase: compareBitSets(org.apache.cassandra.utils.BitSetTest): Caused an ERROR
[junit] java.io.FileNotFoundException: /usr/share/dict/words (No such file or directory)
[junit] java.lang.RuntimeException: java.io.FileNotFoundException: /usr/share/dict/words (No such file or directory)
[junit] at org.apache.cassandra.utils.KeyGenerator$WordGenerator.reset(KeyGenerator.java:137)
[junit] at org.apache.cassandra.utils.KeyGenerator$WordGenerator.<init>(KeyGenerator.java:126)
[junit] at org.apache.cassandra.utils.BitSetTest.compareBitSets(BitSetTest.java:50)
[junit] Caused by: java.io.FileNotFoundException: /usr/share/dict/words (No such file or directory)
[junit] at java.io.FileInputStream.open(Native Method)
[junit] at java.io.FileInputStream.<init>(FileInputStream.java:146)
[junit] at java.io.FileInputStream.<init>(FileInputStream.java:101)
[junit] at org.apache.cassandra.utils.KeyGenerator$WordGenerator.reset(KeyGenerator.java:135)
[junit]
[junit]
[junit] Test org.apache.cassandra.utils.BitSetTest FAILED
There's your error. The test is looking for /usr/share/dict/words.
apt-get install wamerican

compiling cassandra test cases failing

I am trying to build cassandra binaries from source and when I try to compile unit test cases, one of them fails. I am build cassandra-2.1.4 with Java 8.
These are the commands I run:
ant -Dfile.encoding="UTF-8"
ant test
ant artifacts
Failure details:
[junit] Testsuite: org.apache.cassandra.tools.SSTableExportTest
[junit] Tests run: 8, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.903 sec
[junit]
[junit] ------------- Standard Output ---------------
[junit] WARN 17:48:26 No host ID found, created eeaaa375-22f0-4a4c-845a-31decd240218 (Note: This should happen exactly once per node).
[junit] WARN 17:48:26 No host ID found, created eeaaa375-22f0-4a4c-845a-31decd240218 (Note: This should happen exactly once per node).
[junit] Importing 1 keys...
[junit] 1 keys imported successfully.
[junit] ------------- ---------------- ---------------
[junit] Testcase: testExportColumnsWithMetadata(org.apache.cassandra.tools.SSTableExportTest): FAILED
[junit] unexpected serialization format for topLevelDeletion expected:<{"[markedForDeleteAt":0,"localDeletionTime]":0}> but was:<{"[localDeletionTime":0,"markedForDeleteAt]":0}>
[junit] junit.framework.AssertionFailedError: unexpected serialization format for topLevelDeletion expected:<{"[markedForDeleteAt":0,"localDeletionTime]":0}> but was:<{"[localDeletionTime":0,"markedForDeleteAt]":0}>
[junit] at org.apache.cassandra.tools.SSTableExportTest.testExportColumnsWithMetadata(SSTableExportTest.java:298)
[junit]
[junit]
[junit] Test org.apache.cassandra.tools.SSTableExportTest FAILED
[junit] Testsuite: org.apache.cassandra.tools.SSTableImportTest
[junit] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.759 sec
This is a known issue and has been fixed in Apache Cassandra's trunk (will become 2.2) branch. https://issues.apache.org/jira/browse/CASSANDRA-9065

JUnit/Ant in Hudson: How to start tests in headless mode?

I am having trouble with setting up unit tests for a project developed under Netbeans in Hudson. So far, Hudson is running fine, monitoring my git repository, and automatically starting builds.
But when building is finished, Hudson starts the unit tests. And here lies the problem: Some classes use awt, and when started from within Hudson, the tests fail like this:
[junit] Testcase: testParse_SimpleTextAndSymbols(com.dua3.util.text.LatexParserTest): Caused an ERROR
[junit] Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
[junit] java.lang.InternalError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
[junit] at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
[junit] at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
[junit] at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:110)
[junit] at java.security.AccessController.doPrivileged(Native Method)
[junit] at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Class.java:190)
[junit] at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
[junit] at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
[junit] at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:119)
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Class.java:190)
[junit] at java.awt.Toolkit$2.run(Toolkit.java:868)
[junit] at java.security.AccessController.doPrivileged(Native Method)
[junit] at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:860)
[junit] at sun.swing.SwingUtilities2.getSystemMnemonicKeyMask(SwingUtilities2.java:1877)
[junit] at javax.swing.plaf.basic.BasicLookAndFeel.initComponentDefaults(BasicLookAndFeel.java:752)
[junit] at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:434)
[junit] at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:148)
[junit] at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1589)
[junit] at javax.swing.UIManager.setLookAndFeel(UIManager.java:536)
[junit] at javax.swing.UIManager.setLookAndFeel(UIManager.java:576)
[junit] at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1345)
[junit] at javax.swing.UIManager.initialize(UIManager.java:1455)
[junit] at javax.swing.UIManager.maybeInitialize(UIManager.java:1422)
[junit] at javax.swing.UIManager.getLookAndFeelDefaults(UIManager.java:1034)
[junit] at com.dua3.util.graph.javase.swing.SwingFont$SwingFontProvider.getDefaultFont(SwingFont.java:50)
[junit] at com.dua3.util.graph.Font.getDefault(Font.java:52)
[junit] at com.dua3.util.text.LatexParser$Settings.<init>(LatexParser.java:39)
[junit] at com.dua3.util.text.LatexParser.parse(LatexParser.java:61)
[junit] at com.dua3.util.text.LatexParserTest.testParse_SimpleTextAndSymbols(LatexParserTest.java:49)
I thought it should be enough to check GraphicsEnvironment.isHeadless(), but obviously it isn't. This is the code snippet were it goes wrong:
if(!GraphicsEnvironment.isHeadless()) {
final UIDefaults lookAndFeelDefaults = UIManager.getLookAndFeelDefaults(); // SwingFont.java:50
if (lookAndFeelDefaults!=null) {
swingFont = lookAndFeelDefaults.getFont("defaultFont");
}
}
I tried in the following in Hudson:
Setting Java Options to -Djava.awt.headless=true in the "Build" section
Entering a line "java.awt.headless=true" in the Build Properties
All of that doesn't work. It seems those are only passed on to ant, but not onwards when invoking java to run the JUnit tests.
Is there any way to tell ant that I want my tests be run in headless mode?
I spend some time looking for this and finally found the answer. In short: setting java.awt.headless=true is not enough on linux. You have to unset DISPLAY. So, go to "Manage Hudson", "Configure System", make sure "Environment variables" is checked under "Global Properties" and add a new variable of name DISPLAY (leave the value field blank).

Junit - Ant - Soap UI and Data File

I am trying to run a basic REST Web Service Test calling a Soap UI project from JUnit in ANT.
Everything compiles correctly and runs, however when I try to run a test that uses an external data file I get the error:
Unable to obtain resource from C:\soapTest\atmTest3.csv:
java.util.zip.ZipException: error in opening zip file
[junit] Unable to obtain resource from C:\soapTest\atmTest3.csv:
I have already searched and seen others who have had the problem with classes and tried to only include what I believe I need. This is how I include my data file in my build.xml
<path id ="test.input.dir" >
<pathelement path="C:\soapTest\atmTest3.csv" />
</path>
<path id="classpath.junittest">
<path refid="test.input.dir" />
<path refid="jars.dir" />
</path>
My JUNIT method is very basic
public void testRunner() throws Exception
{
SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
runner.setProjectFile("C:/soapTest/ATM-Locator-soapui-project.xml");
runner.run();
}
Has anyone had success using an external datasource file and running in JUNIT?
Are there alternatives?
------------------ ANT Output below -------------------
Building in workspace C:\JENKINS_PROJECTS\workspace\JUNIT_Test
[JUNIT_Test] $ cmd.exe /C '"C:\apache-ant-1.9.3\bin\ant.bat -D-Verbose="" -D-Debug="" && exit %%ERRORLEVEL%%"'
Buildfile: C:\JENKINS_PROJECTS\workspace\JUNIT_Test\build.xml
[echo] Apache Ant version is Apache Ant(TM) version 1.9.3 compiled on December 23 2013
[echo] Apache basedir is C:\JENKINS_PROJECTS\workspace\JUNIT_Test
compile:
[javac] Compiling 2 source files to C:\JENKINS_PROJECTS\workspace\JUNIT_Test\classes
compile-test:
[javac] Compiling 6 source files to C:\JENKINS_PROJECTS\workspace\JUNIT_Test\classes
test:
[junit] Running com.JUnit.AllTests
[junit] Testsuite: com.JUnit.AllTests
Unable to obtain resource from C:\soapTest\atmTest3.csv: java.util.zip.ZipException: error in opening zip file
[junit] Unable to obtain resource from C:\soapTest\atmTest3.csv:
[junit] java.util.zip.ZipException: error in opening zip file
[junit] at java.util.zip.ZipFile.open(Native Method)
[junit] at java.util.zip.ZipFile.<init>(Unknown Source)
[junit] at java.util.jar.JarFile.<init>(Unknown Source)
[junit] at java.util.jar.JarFile.<init>(Unknown Source)
[junit] at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:1006)
[junit] at org.apache.tools.ant.AntClassLoader.getResource(AntClassLoader.java:887)
[junit] at org.apache.log4j.helpers.Loader.getResource(Loader.java:96)
[junit] at org.apache.log4j.LogManager.<clinit>(LogManager.java:103)
[junit] at org.apache.log4j.Logger.getLogger(Logger.java:117)
[junit] at com.eviware.soapui.SoapUI.<clinit>(SoapUI.java:135)
[junit] at com.eviware.soapui.tools.SoapUITestCaseRunner.<clinit>(SoapUITestCaseRunner.java:79)
[junit] at com.util.ParameterATM_Test.testRunner(Unknown Source)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[junit] at java.lang.reflect.Method.invoke(Unknown Source)
[junit] at junit.framework.TestCase.runTest(TestCase.java:168)
[junit] at junit.framework.TestCase.runBare(TestCase.java:134)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:110)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:128)
[junit] at junit.framework.TestResult.run(TestResult.java:113)
[junit] at junit.framework.TestCase.run(TestCase.java:124)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:243)
[junit] at junit.framework.TestSuite.run(TestSuite.java:238)
[junit] at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
[junit] at org.junit.runners.Suite.runChild(Suite.java:128)
[junit] at org.junit.runners.Suite.runChild(Suite.java:24)
[junit] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
[junit] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
[junit] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
[junit] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
[junit] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
[junit] at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
[junit] at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:532)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:1425)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:852)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1904)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:804)
[junit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[junit] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[junit] at java.lang.reflect.Method.invoke(Unknown Source)
[junit] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[junit] at org.apache.tools.ant.Task.perform(Task.java:348)
[junit] at org.apache.tools.ant.Target.execute(Target.java:435)
[junit] at org.apache.tools.ant.Target.performTasks(Target.java:456)
[junit] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
[junit] at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
[junit] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[junit] at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
[junit] at org.apache.tools.ant.Main.runBuild(Main.java:851)
[junit] at org.apache.tools.ant.Main.startAnt(Main.java:235)
[junit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[junit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

class weblogic.management.WeblogicMBean not found

I meet this problem when I try to run Junit test case in fork mode (starting each test in a separate JVM) using Build ant file.
[junit] Exception in thread "main" java.lang.NoClassDefFoundError:
weblogic/management/WebLogicMBean [junit] at
java.lang.ClassLoader.defineClass1(Native Method) [junit] at
java.lang.ClassLoader.defineClass(ClassLoader.java:621) [junit] at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
[junit] at
java.net.URLClassLoader.defineClass(URLClassLoader.java:260) [junit]
at java.net.URLClassLoader.access$000(URLClassLoader.java:56) [junit]
at java.net.URLClassLoader$1.run(URLClassLoader.java:195) [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:307) [junit] at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) [junit]
at java.lang.ClassLoader.loadClass(ClassLoader.java:252) [junit] at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) [junit]
at java.lang.ClassLoader.defineClass1(Native Method) [junit] at
java.lang.ClassLoader.defineClass(ClassLoader.java:621) [junit] at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
[junit] at
java.net.URLClassLoader.defineClass(URLClassLoader.java:260) [junit]
at java.net.URLClassLoader.access$000(URLClassLoader.java:56) [junit]
at java.net.URLClassLoader$1.run(URLClassLoader.java:195) [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:307) [junit] at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) [junit]
at java.lang.ClassLoader.loadClass(ClassLoader.java:252) [junit] at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) [junit]
at java.lang.ClassLoader.defineClass1(Native Method) [junit] at
java.lang.ClassLoader.defineClass(ClassLoader.java:621) [junit] at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
[junit] at
java.net.URLClassLoader.defineClass(URLClassLoader.java:260) [junit]
at java.net.URLClassLoader.access$000(URLClassLoader.java:56) [junit]
at java.net.URLClassLoader$1.run(URLClassLoader.java:195) ....
I have the library weblogic.jar in my build library folders, which is set as classpath for the junit task. I look at this file and can't find the WeblogicMBean.class inside.
However, in Jdev, I can import weblogic.management.WeblogicMBean into my class if I set library reference to this weblogic.jar file and compile my class without problem.
Any suggestion of what really goes wrong?
Thanks a lot.
NoClassDefFoundError usually means the correct version of the class was not found at runtime.
Since your compile is fine, does your CLASSPATH at compile time refer to the same jar as at runtime?
Also check if there are multiple weblogic.jar in the runtime CLASSPATH for JUnit.
Whats your version of weblogic, the class is in the weblogic.jar for version 9 at least.

Resources