File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes ejb hanging 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 » EJB and other Java EE Technologies
Bookmark "ejb hanging" Watch "ejb hanging" New topic
Author

ejb hanging

Pradyut Bhattacharya
Ranch Hand

Joined: Aug 12, 2004
Posts: 63
hi frirends,
i have created a ejb and calling it through client program

which is deployed with the ejb application. on running it on

j2ee Application Server 8

i get errors on the home interface

the details: -

the remote interface


the home interface

the EJB class


the client program

[CODE}
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.math.BigDecimal;
public class ConverterClient {
public static void main(String [] args)){
try {
Context myEnv =
(Context)initial.lookup("java:comp/env");
Object objref =myEnv.lookup("ejb/SimpleConverter");
ConverterHome home =
(ConverterHome)PortableRemoteObject.narrow(objref,
ConverterHome.class);
Converter currencyConverter =home.create();
BigDecimal param =new BigDecimal ("100.00");
BigDecimal amount =
currencyConverter.dollarToYen(param);
System.out.println(amount);
amount =currencyConverter.yenToEuro(param);
System.out.println(amount);
System.exit(0);
}catch (Exception ex){
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}
}
}
[/CODE]
in the ejb reference tab in the deploytool

Coded Name field -> ejb/SimpleConverter
EJB Type field -> Session
Interfaces field -> Remote
Home Interface field -> converter.ConverterHome
Local/Remote Interface field ->converter.Converter
JNDI Name field -> ConverterBean


on running the program
Appclient �client ConverterAppClient.jar

i get the error on the command line

any help
thanks
Pradyut


Pradyut
http://pradyut.tk/
Gabriel Buheler
Ranch Hand

Joined: Apr 21, 2004
Posts: 39
Hi,

Did you define the package "converter" in your code?
Pradyut Bhattacharya
Ranch Hand

Joined: Aug 12, 2004
Posts: 63
on defining the package
converter.ConverterHome
still it's not working
the code

[CODE]
import converter.Converter;
import converter.ConverterHome;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.math.BigDecimal;


public class ConverterClient {
public static void main(String[] args) {
try {
Context initial = new InitialContext();
Context myEnv = (Context) initial.lookup("java:comp/env");
Object objref = myEnv.lookup("ejb/SimpleConverter");

ConverterHome home =
(ConverterHome) PortableRemoteObject.narrow(objref,
ConverterHome.class);

Converter currencyConverter = home.create();

BigDecimal param = new BigDecimal("100.00");
BigDecimal amount = currencyConverter.dollarToYen(param);

System.out.println(amount);
amount = currencyConverter.yenToEuro(param);
System.out.println(amount);

System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}
}
}
[CODE]
Siplin Ayishoto
Greenhorn

Joined: Nov 25, 2002
Posts: 9
As Gabriel said, did you put "package converter;" in your Coverter classes?
What is the error you are getting now?
Your posting is titled "EJB hanging". What is that?

-Siplin
Pradyut Bhattacharya
Ranch Hand

Joined: Aug 12, 2004
Posts: 63
hi all,
this is in context to my problem

i have jdk5 installed in win xp sp2
when i do java <filename>
i get the error on my machine
Exception in thread "main" java.lang.NoClassDefFoundError: <filename>
i correct it by doing
java -cp . <filename>
then it runs fine.

but on running a client ejb program on the command line
AppClient -client <filename>
i again get the error
WARNING: ACC003: Application threw an exception.
java.lang.NoClassDefFoundError: converter.ConverterHome
where converter.ConverterHome is contained in the jar file

i do not get a solution to this problem
how can i correct the above problem or the overall problem such that
when i give the command
java <filename>
i get the output simply
any helps
Pradyut
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ejb hanging