Announcement Announcement Module
Collapse
No announcement yet.
JNDI Lookup Broken Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JNDI Lookup Broken

    Hi there,

    I had deployed HAR using JBoss MBean approach and it works properly. The problem now is when I uses WEB-IND\applicationContext.xml to point the JNDI registered, then error bounced.

    Here is the applicationContext.xml snipplet:

    Code:
    <!-- JCA connector configuration -->
    <bean id="sessionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiName" value="java:/hibernate/SessionFactory"/>
            <!--<property name="lookupOnStartup" value="false"/>
            <property name="cache" value="true"/>
            <property name="proxyInterface" value="javax.sql.DataSource"/>-->
    </bean>
    This is the stack trade that shows JNDI being registered and being destroyed once Spring lookup thru web container:

    Code:
    2006-05-04 16:54:03,109 INFO  [org.jboss.hibernate.jmx.Hibernate] SessionFactory successfully built and bound into JNDI [java:/hibernate/SessionFactory]
    2006-05-04 16:54:03,109 DEBUG [org.jboss.hibernate.jmx.Hibernate] Started jboss.har:service=Hibernate
    ...
    2006-05-04 16:54:07,234 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Eagerly caching bean with name 'sessionFactory' to allow for resolving potential circular references
    2006-05-04 16:54:07,234 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Not autowiring property 'jndiEnvironment' of bean 'sessionFactory' by name: no matching bean found
    2006-05-04 16:54:07,234 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Not autowiring property 'jndiTemplate' of bean 'sessionFactory' by name: no matching bean found
    2006-05-04 16:54:07,234 DEBUG [org.springframework.beans.BeanWrapperImpl] About to invoke write method [public void org.springframework.jndi.JndiObjectLocator.setJndiName(java.lang.String)] on object of class [org.springframework.jndi.JndiObjectFactoryBean]
    2006-05-04 16:54:07,234 DEBUG [org.springframework.beans.BeanWrapperImpl] Invoked write method [public void org.springframework.jndi.JndiObjectLocator.setJndiName(java.lang.String)] with value of type [java.lang.String]
    2006-05-04 16:54:07,234 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Invoking BeanPostProcessors before initialization of bean 'sessionFactory'
    2006-05-04 16:54:07,234 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Invoking afterPropertiesSet() on bean with name 'sessionFactory'
    2006-05-04 16:54:07,234 DEBUG [org.springframework.jndi.JndiTemplate] Looking up JNDI object with name [java:/hibernate/SessionFactory]
    2006-05-04 16:54:07,265 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] initializing class SessionFactoryObjectFactory
    2006-05-04 16:54:07,265 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] JNDI lookup: hibernate/SessionFactory
    2006-05-04 16:54:07,265 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] lookup: uid=8a82813c0afe9a2a010afe9a90550000
    2006-05-04 16:54:07,265 WARN  [org.hibernate.impl.SessionFactoryObjectFactory] Not found: 8a82813c0afe9a2a010afe9a90550000
    2006-05-04 16:54:07,265 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] {}
    2006-05-04 16:54:07,265 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Retrieving dependent beans for bean 'sessionFactory'
    2006-05-04 16:54:07,265 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] Destroying singletons in factory {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [sessionFactory,gov.mohr.ems.core.entity.logic.DefaultQueryMethod,gov.mohr.ems.core.entity.logic.ORMEngine]; root of BeanFactory hierarchy}
    2006-05-04 16:54:07,281 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationcontext.xml]: Initialization of bean failed; nested exception is javax.naming.NamingException: JNDI object with [java:/hibernate/SessionFactory] not found: JNDI implementation returned null
    javax.naming.NamingException: JNDI object with [java:/hibernate/SessionFactory] not found: JNDI implementation returned null
    	at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:125)
    	at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
    	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:121)
    	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:146)
    Please help, me now is near due date.

  • #2
    The message can be misleading - the context is closed before the error is displayed (in a finally block). Make sure the hibernate SF is really under java:/hibernate/SessionFactory - you can verify this with the jmx console under jboss.
    Then make sure that the jndi template is looking at that address and does not append com/env to it - this has/is the source of a lot of problems when working with jndi - turn on logging to see what exactly is going on.

    Comment


    • #3
      The problem has been solved by placing the right HAR file in the application.xml of EAR file. Thanks alot.

      Comment


      • #4
        the same problem of jndi lookup

        I encountered the same problem, would you give me your detail configuration right HAR file in the application.xml of EAR file?

        Comment


        • #5
          under your EAR file META-INF\application.xml, you need to have the entry of:

          Code:
          ...
          <module>
              <java>entity.har</java>
            </module>
          ...

          Comment

          Working...
          X