Hi all,
I am working on J2ee1.3 app server, I am able to successfully deploy the bean and able to return the client jar file too, but while exectuing my client program I am facing the below mentioned problem, If any one has worked on it, please share your ideas and help me out.
Regards,
Vidya
The exception is as follows:
----------------------------
F:\>
java ejbclient
Basic Lookup is Successful....
Got the Object, Final Lookup is Successful....
Caught an unexpected exception!
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at ejbclient.main(ejbclient.java:23)
F:\>
My Client Program:
==================
import javax.rmi.*;
import javax.naming.*;
import ssrem;
import sshome;
public class ejbclient
{
public static void main(
String args[])
{
try
{
Context initial = new InitialContext();
Object objref = initial.lookup("shiva");
System.out.println("Basic Lookup is Successful....");
if(objref==null)
{
System.out.println("Couldn't get the Object");
}
else
{
System.out.println("Got the Object, Final Lookup is Successful....");
}
sshome home = (sshome)PortableRemoteObject.narrow(objref,sshome.class);
ssrem ob= home.create();
ob.setString("Hello World");
ob.setIntegers(20,20);
ob.setDoubles(20.2,40.3);
double dd=ob.getDoubles();
int ee=ob.getIntegers();
String str=ob.getString();
System.out.println("The Double Value returned is : "+dd);
System.out.println("The Integer Value returned is : "+ee);
System.out.println("The String Value returned is : "+str);
}
catch (Exception ex)
{
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}
}
}
My Doubts:
==========
1. At the time of deploying, it is asking for Local home,Local
rem, remote home, remote rem. I am unable to understand what is the difference between local and remote.
FOR MY CURRENT PROGRAM GIVEN ABOVE, I HAVE USED REMOTE REM AND REMOTE CLASS,
I am new to
j2ee, Please help me.
Regards,
Vidya