Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Junit test on servers

 
sankar dunga
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir,

I am JUnit 4.8.2 testing tool to test my EJB and servlet classes.
I am using JBoss server to run my programs. I created test classes for my java classes.
When i am running project as rightclick on project->run as-> junit test, i am getting following error.............


java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


I am not getting what is this error.
Is there is any other way to execute the web applications using junit tool.

please give the best solution
Thank you in advance.

regards
sankar
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.UnsupportedClassVersionError: Bad version number in .class file

This is the error you get when running code compiled with a later version of Java on an earlier version of Java. What version did you compile with? What version is your JBoss server using?
 
sankar dunga
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply.

Right now i am using JDK 1.5 version which is supported for my project.
I will try with JDK 1.6 version.

And one more small doubt: Is there is any special process to test web application on web server using JUnit.
Or it is also same as normal application testing?


please sorry for my poor doubts, i am new to the JUnit.


regards
sankar
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For testing the web app through the GUI, you would want an extension to junit (jwebunit) or a browser plugin (like selenium). These tests you can run on your machine since they don't rely on the server JVM.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic