0 Replies Latest reply on Jul 11, 2013 7:37 PM by shyamr

    JBoss 7.1.1 JNDI Names look up from properties file - issue

    shyamr

      Good Morning,

       

      I am migrating a J2EE application from JBoss 4.0.5 to JBoss 7.1.1. The application uses Spring 1 and Spring-WS with Oracle as backend.

      So far I was able to configure the oracle datasource in standalone.xml. When I have build and deployed the ear file, I am getting the following error in server log.

       

      13:56:23,214 INFO  [au.gov.nsw.osr.edr.persistence.ECUtilitiesImpl] (MSC service thread 1-4) Loaded 277 DataCheckRules

      13:56:23,394 INFO  [au.gov.nsw.osr.edr.persistence.ECUtilitiesImpl] (MSC service thread 1-4) Loaded 1174 MandatoryRules

      13:56:23,453 INFO  [au.gov.nsw.osr.edr.persistence.ECUtilitiesImpl] (MSC service thread 1-4) Loaded 353 ResponseTypeRules

       

      13:56:23,495 INFO  [au.gov.nsw.osr.edr.util.JndiParameterCacheImpl] (MSC service thread 1-4) afterPropertiesSet: jndiName=edr-properties

      13:56:23,495 INFO  [au.gov.nsw.osr.edr.util.JndiParameterCacheImpl] (MSC service thread 1-4) Context Lookup Starts: jndiName=edr-properties

      13:56:23,499 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-4) Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor,parameterCacheImpl,ecUtilities,parameterCacheProvider,jndiParameterCache,userManager,authenticationHandler,authenticationManager,initialDirContextFactory,ldapAuthenticationProvider,payloadMapping,messageSchemas,messageContextPopulatingInterceptor,validatingInterceptor,loggingInterceptor,edr,edrEndpoint,metaEndpoint,endpointExceptionResolver,edrGenericService,requestMessageValidator,requestECPersister,requestRecoupsPersister,responseRecoupsRetriever,wsSecurityInterceptor,doscsrReportIText,rpsReportIText,responseAttachmentTransformer]; root of BeanFactory hierarchy}

      13:56:23,501 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-4) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jndiParameterCache' defined in ServletContext resource [/WEB-INF/dataSourceContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: edr-properties -- service jboss.naming.context.java.edr-properties

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1088) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:429) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:250) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:247) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:161) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273) [spring.jar:2.0.2]

                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346) [spring.jar:2.0.2]

                at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) [spring.jar:2.0.2]

                at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) [spring.jar:2.0.2]

                at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) [spring.jar:2.0.2]

                at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) [spring.jar:2.0.2]

                at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

                at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_09-icedtea]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_09-icedtea]

                at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]

      Caused by: javax.naming.NameNotFoundException: edr-properties -- service jboss.naming.context.java.edr-properties

                at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)

                at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)

                at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:113)

                at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)

                at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_09-icedtea]

                at au.gov.nsw.osr.edr.util.JndiParameterCacheImpl.afterPropertiesSet(JndiParameterCacheImpl.java:53) [classes:]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1118) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1085) [spring.jar:2.0.2]

                ... 19 more

       

       

      13:56:23,514 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/edr]] (MSC service thread 1-4) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jndiParameterCache' defined in ServletContext resource [/WEB-INF/dataSourceContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: edr-properties -- service jboss.naming.context.java.edr-properties

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1088) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:429) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:250) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:247) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:161) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273) [spring.jar:2.0.2]

                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346) [spring.jar:2.0.2]

                at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) [spring.jar:2.0.2]

                at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) [spring.jar:2.0.2]

                at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) [spring.jar:2.0.2]

                at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) [spring.jar:2.0.2]

                at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

                at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_09-icedtea]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_09-icedtea]

                at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]

      Caused by: javax.naming.NameNotFoundException: edr-properties -- service jboss.naming.context.java.edr-properties

                at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)

                at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)

                at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:113)

                at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)

                at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_09-icedtea]

                at au.gov.nsw.osr.edr.util.JndiParameterCacheImpl.afterPropertiesSet(JndiParameterCacheImpl.java:53) [classes:]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1118) [spring.jar:2.0.2]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1085) [spring.jar:2.0.2]

                ... 19 more

       

       

      13:56:23,531 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Error listenerStart

      13:56:23,531 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Context [/edr] startup failed due to previous errors

      13:56:23,531 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/edr]] (MSC service thread 1-4) Closing Spring root WebApplicationContext

      13:56:23,533 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.web.deployment.default-host./edr: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./edr: JBAS018040: Failed to start context

                at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:95)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_09-icedtea]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_09-icedtea]

                at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]

       

       

      13:56:23,737 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "edr.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./edr" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./edr: JBAS018040: Failed to start context"}}

      13:56:23,741 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

      JBAS014777:   Services which failed to start:      service jboss.web.deployment.default-host./edr: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./edr: JBAS018040: Failed to start context

       

       

      13:56:23,748 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./edr" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./edr: JBAS018040: Failed to start context"}}}}

      13:56:23,814 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment edr.war in 74ms

      13:56:23,821 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment edr.ear in 80ms

       

       

      I am using an service xml file that contains jndi properties and bindings. I am placing this xml file under /standalone/deployments. The contents of the file are:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE server PUBLIC "-//JBoss//DTD MBean Service 4.0//EN"

                "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd">

      <server>

      <mbean

        code="org.jboss.naming.JNDIBindingServiceMgr"

        name="jboss.tests:service=JNDIBindingServiceMgr">

        <attribute

         name="BindingsConfig"

         serialDataType="jbxb">

         <jndi:bindings

          xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"

          xmlns:jndi="urn:jboss:jndi-binding-service:1.0"

          xs:schemaLocation="urn:jboss:jndi-binding-service:1.0 resource:jndi-binding-service_1_0.xsd">

          <jndi:binding name="edr_properties">

           <java:properties

            xmlns:java="urn:jboss:java-properties"

            xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"

            xs:schemaLocation="urn:jboss:java-properties resource:java-properties_1_0.xsd">

               

            <!-- TRIM upload directory is a mounted drive on the target linux application server or a remote host on windows -->

            <java:property>

             <java:key>CHECK-SOMETHING</java:key>

             <java:value>/flower/template/kdlc</java:value>

            </java:property>

            <java:property>

             <java:key>CHECK-SOMETHING-ELSE</java:key>

             <java:value>false</java:value>

            </java:property>

           </java:properties>

          </jndi:binding>

         </jndi:bindings>

        </attribute>

        <depends>jboss:service=Naming</depends>

      </mbean>

      </server>

       

       

       

      The class that implements jndi look up has the following code snippet:

       

          public void afterPropertiesSet() throws Exception {

              log.info("afterPropertiesSet: jndiName=" + jndiName);

              InitialContext ctx = new InitialContext();

               log.info("Context Lookup Starts: jndiName=" + jndiName);

              Object obj = ctx.lookup(jndiName);

                       log.info("Context Lookup Stops: jndiName=" + jndiName);

              jndiValueCache = (Properties) obj;

              if (jndiValueCache != null) {

                  log.info("afterPropertiesSet: jndiMapCache: " + jndiValueCache.toString());

              }

          }

       

      I have noticed the code is failing at the following line:

       

      Object obj = ctx.lookup(jndiName);

       

       

      Can you please let me know how to configure JNDI look up for properties, bindings defined in a jboss-service.xml ?

       

       

      Many thanks and I can provide more info if required.

       

      Shyam