6 Replies Latest reply on Jun 23, 2006 3:48 PM by Ales Justin

    issue with lazy loading of springframework

    Sirajudeen Mohamed Newbie

      Hi,
      Below is the one am using in my applicationContext.xml

      <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
       <property name="jndiName" value="java:/CcpiDS"/>
       <property name="proxyInterface" value="org.springframework.beans.ITestBean"/>
       <property name="lookupOnStartup" value="false"/>
       </bean>
      


      My app gets deployed even before the Datasource being created coz of which my app is not getting deployed. So i want the springframework to be initialized when the first call is made to the DB(lazy loading). My question is what is the class name i have to give for property proxyInterface
      Kindly help me out as i have to fix this immediately.

      Thanks alot

        • 1. Re: issue with lazy loading of springframework
          Ales Justin Master

          This is not the right forum to ask this:
          - java.sys-con.com/read/180386.htm

          Ok, but here is a little tip:

           <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
           <property name="lookupOnStartup" value="false"/>
           <property name="proxyInterface">
           <value type="java.lang.Class">javax.sql.DataSource</value>
           </property>
           <property name="jndiName" value="java:/PortalDS"/>
           </bean>
          


          • 2. Re: issue with lazy loading of springframework
            Sirajudeen Mohamed Newbie

            Hi,
            Am not really sure where to post this but since its a spring issue, am posting here. Thanks

            Following is the listener am using to initialiaze the spring context in my web.xml

            <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>


            I have set the following for the dataSource in my applicationContext.xml
            <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean" lazy-init="true">

            javax.sql.DataSource


            The DataSource details are there in the oracle-ds.xml which has the following entry

            <local-tx-datasource>
            <jndi-name>CcpiDS</jndi-name>
            <connection-url>jdbcracle:thin:@cpddbs2.eng.vodafone-us.com:1530:coredev</connection-url>
            <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
            <user-name>CHANDRAS_CCPI</user-name>
            CHANDRAS_CCPI
            <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.Oracle ExceptionSorter</exception-sorter-class-name>
            <min-pool-size>2</min-pool-size>
            <max-pool-size>5</max-pool-size>
            </local-tx-datasource>


            When the JBoss Server comes up, it tries to load the listener first and the listener tries to invoke the JNDI name which is not even created by this time, coz of which my app is not getting deployed. I want to make sure that the oracle-ds.xml is read first and the DataSource is created and JNDI is available. Am not sure how to control this. I tried so many options by setting the lazy-init property in the bean etc, and also tried to control the deployment order in JBoss, still no luck. Have anybody has any clue, pls help me out.

            Thanks
            Siraj

            • 3. Re: issue with lazy loading of springframework
              Sirajudeen Mohamed Newbie

              Hi,
              Following is the listener am using to initialiaze the spring context in my web.xml

              <listener>
              <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
              </listener>
              

              I have set the following for the dataSource in my applicationContext.xml
              <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean" lazy-init="true">
              <property name="lookupOnStartup" value="false"/>
              <property name="proxyInterface"><value type="java.lang.Class">javax.sql.DataSource</value></property>
              <property name="jndiName" value="java:/CcpiDS"/>
              </bean>
              

              The DataSource details are there in the oracle-ds.xml which has the following entry
              <datasources>
              <local-tx-datasource>
              <jndi-name>CcpiDS</jndi-name>
              <connection-url>jdbcracle:thin:@cpddbs2.eng.vodafone-us.com:1530:coredev</connection-url>
              <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
              <user-name>CHANDRAS_CCPI</user-name>
              <password>CHANDRAS_CCPI</password>
              <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.Oracle ExceptionSorter</exception-sorter-class-name>
              <min-pool-size>2</min-pool-size>
              <max-pool-size>5</max-pool-size>
              </local-tx-datasource>
              </datasources>
              

              When the JBoss Server comes up, it tries to load the listener first and the listener tries to invoke the JNDI name which is not even created by this time, coz of which my app is not getting deployed. I want to make sure that the oracle-ds.xml is read first and the DataSource is created and JNDI is available. Am not sure how to control this. I tried so many options by setting the lazy-init property in the bean etc, and also tried to control the deployment order in JBoss, still no luck. Have anybody has any clue, pls help me out.

              Thanks
              Siraj


              • 4. Re: issue with lazy loading of springframework
                Ales Justin Master

                Hmmm ... -ds.xml files should by default be deployed before .war files.

                Did you change any deployment suffix settings?

                Look if there is an exception before or at -ds.xml deployment,
                Or if jndi name is wrong.

                • 5. Re: issue with lazy loading of springframework
                  Sirajudeen Mohamed Newbie

                  I didn't change any deployment suffix settings. There is no exception also when ds.xml is deployed. I just get the following exception
                  2006-06-23 12:17:58,880 WARN [org.jboss.system.ServiceController] Problem starting service jboss.web.deployment:war=ccpi.war,id=418140027
                  org.jboss.deployment.DeploymentException: URL file:/c:/cvs/us/dev/spmi_ccpi_test/appserver/spmi_ccpi-domain/applications/ccpi.sar/ccpi.war/ deployment failed
                  at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:349)
                  at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:88)
                  at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:357)
                  at org.jboss.web.WebModule.startModule(WebModule.java:68)
                  at org.jboss.web.WebModule.startService(WebModule.java:46)
                  at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
                  at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
                  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:585)
                  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                  at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
                  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                  at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
                  at $Proxy0.start(Unknown Source)
                  at org.jboss.system.ServiceController.start(ServiceController.java:428)
                  at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:585)
                  at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                  at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                  at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                  at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
                  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                  at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)