• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Exception error

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got error below,i don't know why? is something i did not set up env?
C:\myEjb\classes>java StudentClient
Exception in thread "main" java.lang.NoClassDefFoundError: StudentClient
--------------------------------------------------------------------------
import javax.ejb.*;
import javax.rmi.*;
import java.rmi.*;
import java.util.*;
import javax.swing.*;
import javax.naming.*;
public class StudentClient{
public static void main(String args[])
{
try{
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, "t3://localhost:7001");
Context initial=new InitialContext( properties);
Object obj=initial.lookup("StudentObject");
StudentHome studentHome=(StudentHome) PortableRemoteObject.narrow(obj,StudentHome.class);
Student student=null;
if(student!=null)
{
System.out.println("user already existed");
student.remove();
}
student=studentHome.create(new Integer("1"),"kevin","Wu");
student=studentHome.create(new Integer("2"),"john","smith");
System.out.println("create user");
//try{
//student=studentHome.findByPrimaryKey(new Integer("1"));
//}catch(FinderException e){
//System.out.println("Did not find");
//}
//System.out.println("Found:"+student.getLast()+","+student.getFirst());
}catch(Exception e){
System.out.println(e);
JOptionPane.showMessageDialog(null,"Exception:"+e);
}
}
}
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you dont have StudentClient in the classpath.
Perhaps you need to reset the classpath like this
set CLASSPATH=%CLASSPTH%;.;
This will search the current folder for the class files
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic