• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class not found error!!

 
ramakrishna pydipati
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried this code named ConverterClient
it's compiling but it's not running.
"error is: Exception in thread "main" java.lang.NoClassDefFoundError: ConverterClient"
code is:
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
import java.io.Serializable;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
interface Converter extends EJBObject
{
public double dollarToYen(double dollars)
throws RemoteException;
public double yenToEuro(double yen)
throws RemoteException;
}
interface ConverterHome extends EJBHome
{
Converter create() throws RemoteException,CreateException;
}
class ConverterClient
{
public static void main(String[] args)
{
try{
Context initial = new InitialContext();
Object objref = initial.lookup("MyConverter");
ConverterHome home = (ConverterHome)PortableRemoteObject.narrow(objref,ConverterHome.class);
Converter currencyConverter = home.create();
double amount = currencyConverter.dollarToYen(100.00);
System.out.println(String.valueOf(amount));
amount = currencyConverter.yenToEuro(100.00);
System.out.println(String.valueOf(amount));
currencyConverter.remove();
}
catch(Exception ex)
{
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}
}
}
I appreciate u r help guys.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to have ClientConverter in your classpath.
 
ramakrishna pydipati
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you.
but when included it in the classpath
I got this error:Caught an unexpected exception!
javax.naming.NameNotFoundException: MyConverter not found
MyConvereter is the JNDI name
so I got a doubt and checked server it is giving errors
:J2EE server reported the following error: Unable to create ORB. Possible causes
include TCP/IP ports in use by another process
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you running the ConverterClient from a command-line? If so, you need to provide some properties for the InitialContext in order to lookup resources located on a server.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving this topic to the Java in General (Beginner) forum. Please continue the discussion there. Thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic