import java.util.Properties;
import javax.naming.*;public class Jndi {
public static void main(String ar[]) {
Context ctx = null;
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://localhost:7001");
try { ctx = new InitialContext(p);
String test = "JNDI Test example";
ctx.bind("name", test);
String s = (String) ctx.lookup("name");
System.out.println(s);
String str = "welcome to you";
ctx.rebind("name", str);
s = (String) ctx.lookup("name");
System.out.println(s);
} catch (NamingException e) {
System.out.println(e.toString());
}
}
}Exception in thread "main" java.lang.IllegalArgumentException: Context: object to bind must be Remote, Reference, or Referenceable
at weblogic.jrmp.Context.encodeObject(Context.java:375)
at weblogic.jrmp.Context.bind(Context.java:83)
at weblogic.jrmp.Context.bind(Context.java:94)
at javax.naming.InitialContext.bind(Unknown Source)
请问有人知道为什么吗????