After I bind the hibernate sessionFactory object into Weblogic succuessfully, I cannot use the JNDI to get the sessionFactory, Why????
I have test with MSSQLServer and MySQL, the problem is still, so I think it does not have something with database system, and I saw the reference address of the sessionFactory instance in the View of Weblogic JNDI. Now the problem is I cannot get the sessionFactory object with JNDI.
Following is the code of get sessionFactory object:
Code:
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL, "t3://yulin:7001");
Object o = null;
try {
Context ctx = new InitialContext(props);
o = ctx.lookup("hibernate/session_factory");
}
catch (NamingException ex) {
}
System.out.println(o);