hi.
I have written a Session EJB by jbuilder7.0 and deloyed it into the weblogic6.1.but when I test the EJB at client,the test program throwed a error,how can I do it?
the source:
import java.util.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
public class testejb
{
public static void main(String args[])
{
try
{
Properties p=System.getProperties();
p.setProperty(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.setProperty(Context.PROVIDER_URL,"t3://127.0.0.1:7001");
Context ctx=new InitialContext(p);
Object ref=ctx.lookup("TestBean");
TestHome data=(TestHome) PortableRemoteObject.narrow(ref, TestHome.class);
if(data instanceof TestHome)
{
System.out.println("yes.");
}else{
System.out.println("no.");
}
}catch(Exception ex){
ex.printStackTrace();
}
}
}
error:
E:\java>java testejb
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Unkno
wn Source)
at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at testejb.main(testejb.java:20)