aspose file tools*
The moose likes Beginning Java and the fly likes class not found error!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class not found error!!" Watch "class not found error!!" New topic
Author

class not found error!!

ramakrishna pydipati
Greenhorn

Joined: Oct 13, 2003
Posts: 23
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
You need to have ClientConverter in your classpath.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
ramakrishna pydipati
Greenhorn

Joined: Oct 13, 2003
Posts: 23
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
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

Joined: Aug 26, 2001
Posts: 7610
I'm moving this topic to the Java in General (Beginner) forum. Please continue the discussion there. Thank you


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: class not found error!!