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

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to