1 Reply Latest reply on Oct 16, 2006 10:36 AM by Ales Justin

    javax.naming.NameNotFoundException: jndi not bound

    tvan Newbie

      Hi,
      I got an exception when deploying my application to Jboss:


      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: jndi not bound

      I defined <jndi-name>jndi/myAppliDS</jndi-name>in myappli-ds.xml.
      I called it in the bean:
      <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
       <property name="jndiName">
       <value>jndi/myAppliDS</value>
       </property>
       </bean>
       <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" singleton="true" >
       <property name="dataSource">
       <ref bean="dataSource"></ref>
       </property>
       <property name="mappingResources">
       <list>
       <value>Address.hbm.xml</value>
      
       </list>
       </property>
       <property name="hibernateProperties">
       <props>
       <prop key="hibernate.dialect">xxx.yyy.zzz.hibernate.RdbDialect</prop>
       <prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
       <prop key="hibernate.show_sql">true</prop>
       <prop key="hibernate.default_batch_fetch_size">16</prop>
       <prop key="hibernate.max_fetch_depth">1</prop>
       <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
       <prop key="jta.UserTransaction">java:comp/UserTransaction</prop>
       <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
       <!-- prop key="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.OC4JTransactionManagerLookup</prop-->
       <prop key="hibernate.connection.release_mode">auto</prop>
       </props>
       </property>
       </bean>
      
      


      What is wrong with that? With the server oc4j, it has no problem. But here I have a headache: Jndi is not bound. I even added
      <prop key="hibernate.connection.datasource">java:/comp/env/jndi/myAppliDS</prop>
      
      in the hibernateProperties, but the problem still remains! If anyone has a tip.
      Thank you very much.
      Tvan