客户端有问题,give you a example:
public class NoteClient 
{
public static void main(String[] args) 
{
       try
       {
           Properties prop = System.getProperties();
           
           prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
           prop.put(Context.PROVIDER_URL, "t3://192.168.4.104:7001");
           Context ctx = new InitialContext(prop);
           NoteHome home =(NoteHome)
javax.rmi.PortableRemoteObject.narrow(ctx.lookup("noteHome"),NoteHome.class);           NotePK primaryKey = new NotePK("abc-2");
           Note note2 = home.findByPrimaryKey(primaryKey);
           String name = note2.getnoteName();
           String email = note2.getnoteEmail();
           System.out.println("noteId   : abc-2");
           System.out.println("noteName :" + name);
           System.out.println("noteEmail:" + email);
           Note note1 = home.create("abc-1","renxd","[email protected]");
           String a = note1.getnoteName();
           System.out.println("noteName :" + a);
           
           
       }
       catch(Exception e)
       {
        System.out.println("client...");
       }
    }
}

解决方案 »

  1.   

    我是用JBUILD的EJB Test client来生成的测试代码,现在报这个错.
    现在不知道该如何来改这个错,请大家请教.E:\JBuilder6\jdk1.3.1\bin\javaw -classpath "F:\myJavaProject\MyFirstEjb\classes;C:\bea\wlserver6.1\lib\weblogic_sp.jar;C:\bea\wlserver6.1\lib\weblogic.jar;E:\JBuilder6\jdk1.3.1\demo\jfc\Java2D\Java2Demo.jar;E:\JBuilder6\jdk1.3.1\jre\lib\i18n.jar;E:\JBuilder6\jdk1.3.1\jre\lib\jaws.jar;E:\JBuilder6\jdk1.3.1\jre\lib\rt.jar;E:\JBuilder6\jdk1.3.1\jre\lib\sunrsasign.jar;E:\JBuilder6\jdk1.3.1\lib\dt.jar;E:\JBuilder6\jdk1.3.1\lib\htmlconverter.jar;E:\JBuilder6\jdk1.3.1\lib\tools.jar"  myfirstejb.studentTestClient 
    -- Initializing bean access.
    javax.naming.NameNotFoundException: Unable to resolve student. Resolved: '' Unresolved:'student' ; remaining name ''
    at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:85)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:253)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:220)-- Failed initializing bean access. at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
    at $Proxy0.lookup(Unknown Source)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    at myfirstejb.studentTestClient.<init>(studentTestClient.java:27)
    at myfirstejb.studentTestClient.main(studentTestClient.java:163)