You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Jack Bounds <Ja...@googlemail.com> on 2015/09/15 15:56:10 UTC

Running Junit Test in IntelliJ (ChatBeanTest)

Hi TomEE guys!

I introduced myself to TomEE (tomee-plus-1.7.2) and Eclipse (Neon Milestone
1 (4.6.0M1)). I successfully worked on couple of helpful examples from
"Examples Trunk" and got everything running just fine, including the junit
based tests.

Then I switched to IntelliJ (14.1.4) and still almost running fine, exept
the junit based tests, e.g. ChatBeanTest. Added junit-4.12.jar and
hamcrest-core-1.3.jar as external libraries to the project. Both appear in
the project's "..\artifacts\ChatBean_war_exploded\WEB-INF\lib" directory.
Additionally added small test servlets which make use of the provided
example MDBs are working fine.
I am not using Maven. All projects were made from scratch.

But running the ChatBeanTest class fails in IntelliJ and gives me:

java.lang.NoClassDefFoundError: javax/jms/Destination
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2693)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3040)
	at java.lang.Class.getMethod0(Class.java:3010)
	at java.lang.Class.getMethod(Class.java:1776)
	at
org.junit.internal.builders.SuiteMethodBuilder.hasSuiteMethod(SuiteMethodBuilder.java:18)
	at
org.junit.internal.builders.SuiteMethodBuilder.runnerForClass(SuiteMethodBuilder.java:10)
	at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
	at
org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
	at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
	at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
	at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:41)
	at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.ClassNotFoundException: javax.jms.Destination
	at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

I am stuck here and have not a single clue.

Thanks for any help
Regards
Jack



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Running-Junit-Test-in-IntelliJ-ChatBeanTest-tp4676212.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Running Junit Test in IntelliJ (ChatBeanTest)

Posted by Jack Bounds <Ja...@googlemail.com>.
Hi Romain and Uday,

I took a closer look at the command line of the junit test run (formatted
listing below) and I reckon there is indeed all necessary EE stuff missing-
so class path issue sounds good to me. I could not figure out, how to edit a
dedicated class path for the test class in IntelliJ. Any experience?

Thanks for the side note: I'll give it a try then.

Ingmar


"C:\Program Files\Java\jdk1.8.0_25\bin\java" 
-ea 
-Didea.launcher.port=7532 
"-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA
14.1.4\bin"
-Dfile.encoding=windows-1252 
-classpath "
C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\idea_rt.jar
C:\Program Files (x86)\JetBrains\IntelliJ IDEA
14.1.4\plugins\junit\lib\junit-rt.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\charsets.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\deploy.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\javaws.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\jce.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\jfr.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\jfxswt.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\jsse.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\management-agent.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\plugin.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\resources.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\rt.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\access-bridge-64.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\cldrdata.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\dnsns.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\jaccess.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\jfxrt.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\localedata.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\nashorn.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunec.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunjce_provider.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunmscapi.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunpkcs11.jar
C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\zipfs.jar
X:\SandBox-IV\Java\intellij\out\production\ChatBean
X:\SandBox-IV\Java\libraries\junit\hamcrest-core-1.3.jar
X:\SandBox-IV\Java\libraries\junit\junit-4.11.jar
"
com.intellij.rt.execution.application.AppMain
com.intellij.rt.execution.junit.JUnitStarter 
-ideVersion5
test.ChatBeanTest



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Running-Junit-Test-in-IntelliJ-ChatBeanTest-tp4676212p4676220.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Running Junit Test in IntelliJ (ChatBeanTest)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Ok, then Uday is right.

Side note: even without using mvn for the project but if you have it
installed, running "mvn idea:idea" will prepare idea files from mvn
descriptor so no manual setup needed then.
Le 15 sept. 2015 07:42, "Jack Bounds" <Ja...@googlemail.com> a écrit :

> Hi Romain,
>
> I quickly tried with junit 4.11. Sorry, but I get the exact same error
> running the ChatBeanTest class.
>
> Ingmar
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Running-Junit-Test-in-IntelliJ-ChatBeanTest-tp4676212p4676218.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Running Junit Test in IntelliJ (ChatBeanTest)

Posted by Jack Bounds <Ja...@googlemail.com>.
Hi Romain,

I quickly tried with junit 4.11. Sorry, but I get the exact same error
running the ChatBeanTest class.

Ingmar



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Running-Junit-Test-in-IntelliJ-ChatBeanTest-tp4676212p4676218.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Running Junit Test in IntelliJ (ChatBeanTest)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Jack

Remember we got a junit 4.12 issue few times ago we solved on developmznt
branches, can you quickly try with junit 4.11?
Le 15 sept. 2015 07:03, "Jack Bounds" <Ja...@googlemail.com> a écrit :

> Hi TomEE guys!
>
> I introduced myself to TomEE (tomee-plus-1.7.2) and Eclipse (Neon Milestone
> 1 (4.6.0M1)). I successfully worked on couple of helpful examples from
> "Examples Trunk" and got everything running just fine, including the junit
> based tests.
>
> Then I switched to IntelliJ (14.1.4) and still almost running fine, exept
> the junit based tests, e.g. ChatBeanTest. Added junit-4.12.jar and
> hamcrest-core-1.3.jar as external libraries to the project. Both appear in
> the project's "..\artifacts\ChatBean_war_exploded\WEB-INF\lib" directory.
> Additionally added small test servlets which make use of the provided
> example MDBs are working fine.
> I am not using Maven. All projects were made from scratch.
>
> But running the ChatBeanTest class fails in IntelliJ and gives me:
>
> java.lang.NoClassDefFoundError: javax/jms/Destination
>         at java.lang.Class.getDeclaredMethods0(Native Method)
>         at java.lang.Class.privateGetDeclaredMethods(Class.java:2693)
>         at java.lang.Class.privateGetMethodRecursive(Class.java:3040)
>         at java.lang.Class.getMethod0(Class.java:3010)
>         at java.lang.Class.getMethod(Class.java:1776)
>         at
>
> org.junit.internal.builders.SuiteMethodBuilder.hasSuiteMethod(SuiteMethodBuilder.java:18)
>         at
>
> org.junit.internal.builders.SuiteMethodBuilder.runnerForClass(SuiteMethodBuilder.java:10)
>         at
>
> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
>         at
>
> org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
>         at
>
> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
>         at
> org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
>         at
>
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:41)
>         at
>
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
>         at
> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
> Caused by: java.lang.ClassNotFoundException: javax.jms.Destination
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>
> I am stuck here and have not a single clue.
>
> Thanks for any help
> Regards
> Jack
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Running-Junit-Test-in-IntelliJ-ChatBeanTest-tp4676212.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Running Junit Test in IntelliJ (ChatBeanTest)

Posted by Uday Gire <ud...@managecat.com>.
Hi Jack

Is it possible to add TomEE libs jars to the test class path in InteliiJ. This is a definite class path issue.

Best

Uday
ManageCat, http://www.managecat.com <http://www.managecat.com/> 

> On 15 Sep 2015, at 16:56, Jack Bounds <Ja...@googlemail.com> wrote:
> 
> Hi TomEE guys!
> 
> I introduced myself to TomEE (tomee-plus-1.7.2) and Eclipse (Neon Milestone
> 1 (4.6.0M1)). I successfully worked on couple of helpful examples from
> "Examples Trunk" and got everything running just fine, including the junit
> based tests.
> 
> Then I switched to IntelliJ (14.1.4) and still almost running fine, exept
> the junit based tests, e.g. ChatBeanTest. Added junit-4.12.jar and
> hamcrest-core-1.3.jar as external libraries to the project. Both appear in
> the project's "..\artifacts\ChatBean_war_exploded\WEB-INF\lib" directory.
> Additionally added small test servlets which make use of the provided
> example MDBs are working fine.
> I am not using Maven. All projects were made from scratch.
> 
> But running the ChatBeanTest class fails in IntelliJ and gives me:
> 
> java.lang.NoClassDefFoundError: javax/jms/Destination
> 	at java.lang.Class.getDeclaredMethods0(Native Method)
> 	at java.lang.Class.privateGetDeclaredMethods(Class.java:2693)
> 	at java.lang.Class.privateGetMethodRecursive(Class.java:3040)
> 	at java.lang.Class.getMethod0(Class.java:3010)
> 	at java.lang.Class.getMethod(Class.java:1776)
> 	at
> org.junit.internal.builders.SuiteMethodBuilder.hasSuiteMethod(SuiteMethodBuilder.java:18)
> 	at
> org.junit.internal.builders.SuiteMethodBuilder.runnerForClass(SuiteMethodBuilder.java:10)
> 	at
> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
> 	at
> org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
> 	at
> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
> 	at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
> 	at
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:41)
> 	at
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
> Caused by: java.lang.ClassNotFoundException: javax.jms.Destination
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> 
> I am stuck here and have not a single clue.
> 
> Thanks for any help
> Regards
> Jack
> 
> 
> 
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Running-Junit-Test-in-IntelliJ-ChatBeanTest-tp4676212.html
> Sent from the TomEE Users mailing list archive at Nabble.com.