• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

junit.awtui.TestRunner- classnotfound error

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have written a junit testCase to test EJB. I am calling the testcase from a jsp. My problem is i get the awt window but it says class not found.can someone help me with this problem. i have included the junit.jar in my classpath. below is the code for my jsp and testcase.

<%@page import="java.rmi.*" %>
<%@page import="java.util.*" %>
<%@page import="javax.naming.*" %>
<%@page import="javax.rmi.*" %>
<%@page import="teste.*" %>
try {
EndUserTests eu = new EndUserTests("testInsert");
} catch (Exception ex) {

junit TestCase
package teste;

import javax.ejb.*;
import javax.naming.*;
import javax.rmi.*;
import java.rmi.*;
import java.util.*;

import junit.framework.*;

public class EndUserTests extends TestCase{

private EnduserHome home;
public static TestSuite suite;
public EndUserTests(){
public EndUserTests(String testname){

public void setUp() throws Exception{

Context ic = new InitialContext();
Object object = ic.lookup("ejb/Example/Enduser");
home = (EnduserHome)PortableRemoteObject.narrow(object, EnduserHome.class);

//public static void main(String[] args){
public void test1(){

public static TestSuite suite(){
suite = new TestSuite();
suite.addTest(new EndUserTests("testInsert"));
return suite;
public void testInsert() throws Exception{

Enduser eu = null;

eu = home.create(new Integer(1),"muktitest","thomas","Frank","Otto","sunnyvale","california",new Integer(21476890),"thomas@hotmail.com",new Integer(76676654),new Integer(21476890),new Date(),new Integer(76),"Y");
catch(Exception e)


Posts: 11962
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you describe your ClassNotFoundError in a bit more detail?

Also, you really should look into JUnitEE or Cactus for running unit tests inside a server. That JSP thing you're doing is not too user friendly, you know...
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic