1 Reply Latest reply on Apr 23, 2007 1:42 AM by jaikiran pai

    JNDI Lookup issue

    Wally Spiteri Newbie

      I have deployed a new EAR application to both Jboss AS version 5.0.0 Beta2 and 4.0.GA and I am getting a Connection Exception thrown (see below) when the web application is starting up.

      2007-04-23 11:10:31,592 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientAccountMgmtEJBLocal' defined in ServletContext resource [/WEB-INF/applicationContext-xfire.xml]: Invocation of init method failed; nested exception is javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
      Caused by:
      javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
      at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1302)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1417)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:124)
      at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:86)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:122)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:147)
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:90)
      at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:101)
      at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.refreshHome(AbstractSlsbInvokerInterceptor.java:104)
      at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.afterPropertiesSet(AbstractSlsbInvokerInterceptor.java:91)
      at org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean.afterPropertiesSet(LocalStatelessSessionProxyFactoryBean.java:84)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)
      at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)


      The actual EJB itself is starting up fine, and have performed a remote call to confirm this. It seems that when Spring is doing a JNDI lookup of the EJB it is getting the connection time out issue. Below is the spring configuration that I am using.

      <bean id="clientAccountMgmtEJBLocal"
       class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
       <property name="jndiName" value="ClientAccountManagement-EAR-0.0.1/ClientAccountMgmtEJB/local" />
       <property name="businessInterface"
       value="com.xxx.clientaccountmgmt.bs.iface.ClientAccountMgmt" />
      </bean>


      Any help would be appreciated.

      Thanks


        • 1. Re: JNDI Lookup issue
          jaikiran pai Master

          Try adding the jndi environment details to the configuration file:


          <bean>
          ......
          <property name="jndiEnvironment">
           <props>
           <!-- JBoss JNDI environment entries -->
           <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
           <prop key="java.naming.provider.url">jnp://localhost:1099</prop>
           </props>
          </property>
          
          ...
          </bean>