[jboss-user] [JNDI/Naming/Network] - JBOSS4.2 with spring hibernate JNDI
paul_lmc
do-not-reply at jboss.com
Sun Jun 22 01:50:30 EDT 2008
I USE THE SPRING,HIBERNATE WITH JNDI ,the problems follows:
IN THE APPLICATION.XML deploy like this:
com/moreflurish/domain/article/InfoArticle.hbm.xml
net.sf.hibernate.dialect.MySQLDialect
true
hibernateJNDI
<!--prop key="hibernate.connection.datasource">jdbc/moreflurish</prop-->
java:/moreflurish
client application :
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Properties prop = new Properties();
prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
prop.setProperty("java.naming.provider.url", "jnp://localhost:1099");
prop.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
InitialContext ctx = new InitialContext(prop);
System.out.println("111111111111");
//IMyBean bean = ( IMyBean) ctx.lookup("MyBean/remote");
//bean.dosomething();
//Object obj = bean.getHibernateJndI();
//System.out.println(obj);
//SessionFactory sf = (SessionFactory)obj;
Object obj = ctx.lookup("hibernateJNDI");
System.out.println(obj);
} catch (NamingException e) {
e.printStackTrace();
}
}
results ::::
2008-6-22 13:32:13 net.sf.hibernate.impl.SessionFactoryObjectFactory getInstance
è¦å‘Š: Not found: 402880521aae7fa0011aae7fad740000
null
the jboss JNDI VIEW LIKE THIS:
Global JNDI Namespace
+- hibernateJNDI (class: net.sf.hibernate.impl.SessionFactoryImpl)
+- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
+- jmx (class: org.jnp.interfaces.NamingContext)
| +- invoker (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor (proxy: $Proxy47 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
| +- rmi (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
WHY THE SESSIONFACTORY IS NULL!!!
THANK YOU!!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159757#4159757
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159757
More information about the jboss-user
mailing list