9 Replies Latest reply on Feb 20, 2009 1:23 AM by Sunil Basena

    Problem in data source binding while server start

    Sunil Basena Newbie

      Hi All,

      I am facing a problem in jboss deployment order while starting server. I am trying to deploy a .jar file which connects to mssql data source. While deploying I am getting the below exception:


      14:36:48,795 ERROR [Alerter] Exception occurred in com.soa.alerter.Alerter : MSSQLDSA not bound

      javax.naming.NameNotFoundException: MSSQLDSA not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
      at java.lang.Thread.run(Thread.java:595)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)

      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at com.nyco.soa.alerter.Alerter.getConnection(Unknown Source)
      at com.nyco.soa.alerter.Alerter.getQueueList(Unknown Source)
      at com.nyco.soa.alerter.Alerter.execute(Unknown Source)
      at com.nyco.soa.alerter.Alerter.perform(Unknown Source)
      at org.jboss.varia.scheduler.Scheduler$Listener.handleNotification(Scheduler.java:1251)
      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.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java
      :153)
      at $Proxy11.handleNotification(Unknown Source)
      at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcaste
      rSupport.java:221)
      at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterS
      upport.java:184)
      at javax.management.timer.Timer.sendNotification(Timer.java:1295)
      at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1264)
      at javax.management.timer.TimerAlarmClock.run(Timer.java:1347)
      at java.util.TimerThread.mainLoop(Timer.java:512)
      at java.util.TimerThread.run(Timer.java:462)




      I have configured two data sources in mssql-ds.xml which point to the same database. Following is the data source configuration:



      <local-tx-datasource>
      <jndi-name>DefaultDS</jndi-name>
      <connection-url>jdbc:sqlserver://102.602.19.163:1433;DatabaseName=myDB</connection-url>
      <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
      <user-name>sa</user-name>
      sa
      <!-- sql to call when connection is created
      <new-connection-sql>some arbitrary sql</new-connection-sql>
      -->

      <!-- sql to call on an existing pooled connection when it is obtained from pool
      <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
      -->

      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->

      <type-mapping>MS SQLSERVER2000</type-mapping>

      </local-tx-datasource>

      <local-tx-datasource>
      <jndi-name>MSSQLDSA</jndi-name>
      <use-java-context>false</use-java-context>
      <connection-url>jdbc:sqlserver://102.602.19.163:1433;DatabaseName=myDB</connection-url>
      <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
      <user-name>sa</user-name>
      sa
      <!-- sql to call when connection is created
      <new-connection-sql>some arbitrary sql</new-connection-sql>
      -->

      <!-- sql to call on an existing pooled connection when it is obtained from pool
      <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
      -->

      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->

      <type-mapping>MS SQLSERVER2000</type-mapping>

      </local-tx-datasource>




      Thanks in Advance for the help :)

        • 1. Re: Problem in data source binding while server start
          Vicky Kak Master

          jars will be deployer before the datasource(-ds.xml), so if there are some classes that are getting initialized and require the datasource it will fail because the -ds.xml are not deployed untill the .jar's are deployed.
          You should look for the strict deployment as explained over here
          https://jira.jboss.org/jira/browse/JBAS-2904

          Also make sure that the jboss jca MBeans are getting created after the server booting is over, you should look at the jboss.jca:* MBeans through the jmx-console.
          You should be able to see the set of Mbeans related to the the configured datasource, I don't see any issue with the data source files.

          • 2. Re: Problem in data source binding while server start
            Sunil Basena Newbie


            Hi Vicky,

            Thnx for the reply.

            I am changing the deployment order in org.jboss.deployment.MainDeployer-xmbean.xml for -ds.xml and .jar files as below:


            Allows the override of the suffix order declared by subdeployers, using the syntax [order:]suffix

            EnhancedSuffixOrder
            [Ljava.lang.String;
            <!--
            Statically set one or more enhanced suffix orders, independent of the value proposed by subdeployers.
            Some deployers may also allow the suffixes/orders to be set locally, so that's preferable too.
            For reference, this is the list of enhanced suffixes likely to be set by deployers (it may not
            be completely up-to-date, or there can be user-defined deployers).

            050:.deployer,050:-deployer.xml,100:.aop,100:-aop.xml,150:.sar,150:-service.xml,200:.beans,250:.rar,300:-ds.xml,350:.har,400:.jar,400:.ejb3,400:.par,500:.war,600:.wsr,650:.ear,700:.jar,750:.zip,800:.bsh,900:.last

            Until we resolve some startup issues, we'll setup some static enhanced suffix orders bellow
            and leave the rest of the suffixes contributed dynamically by registering deployers.
            -->






            Please let me know if the above configuration is ok.

            • 3. Re: Problem in data source binding while server start
              Sunil Basena Newbie

              Following is the org.jboss.deployment.MainDeployer-xmbean.xml configuration to make sure the deployment order:

              attribute access='read-write' setMethod='setEnhancedSuffixOrder' getMethod='getEnhancedSuffixOrder'>

              description>Allows the override of the suffix order declared by subdeployers, using the syntax [order:]suffix


              name>EnhancedSuffixOrder</name
              type>[Ljava.lang.String;</type

              descriptors>
              value value="140:-ds.xml,142:.jar,250:.rar,400:.jar,500:.war,550:.jse,650:.ear,800:.bsh"/>
              </descriptors
              </attribute

              • 4. Re: Problem in data source binding while server start
                Vicky Kak Master

                Hello Sunil,

                "vickyk" wrote:
                jars will be deployer before the datasource(-ds.xml)

                I am wrong here ;(
                The default setting are like this
                <descriptors>
                 <value value="250:.rar,300:-ds.xml,400:.jar,500:.war,550:.jse,650:.ear,800:.bsh"/>
                 </descriptors>

                Let us perform some of the troubleshooting activities.
                Let us deploy the -ds.xml file only first and test if you are able to get this deployed properly, you should verify the deployment of the -ds.xml file through a simple jsp page.
                This test will confirm if the -ds.xml file is getting deployed properly without deploying the jar.
                Also let me know what this jar is doing, is this jar an EJB application?

                • 5. Re: Problem in data source binding while server start
                  Sunil Basena Newbie

                  Hi,

                  When I use the default deployment ordering it works fine. But I want to deploy the jar files before deploying the scheduler-service.xml.

                  Alerter.jar is a java project for sending email alerts in specified time interval which is configured in scheduler-service.xml.

                  scheduler-service.xml looks for the Alerter class.


                  Sunil

                  • 6. Re: Problem in data source binding while server start
                    Vicky Kak Master

                     

                    "sunil@jboss.org" wrote:

                    scheduler-service.xml looks for the Alerter class.

                    Can I see the contents of the scheduler-service.xml file?
                    I don't understand how this issue is related to the jca forums now ;(

                    • 7. Re: Problem in data source binding while server start
                      Sunil Basena Newbie

                      When I use the default deployment order for JBoss it works fine. We want to deploy Alerter.jar before deploying scheduler-service.xml.
                      Here, scheduler-service.xml looks for the Alerter class in Alerter.jar. So I changed the deployment order for .jar and -service.xml.

                      Alerter.jar points to 'MSSQLDSA' data source. So while deploying Alerter.jar it looks for it and throws the above error.

                      I tried to change the deployment order for -ds.xml also but it throws the same error.


                      Following is the scheculer-service.xml configuration:

                      <server>
                      
                       <mbean code="org.jboss.varia.scheduler.Scheduler"
                       name="jboss:service=Scheduler">
                       <attribute name="StartAtStartup">true</attribute>
                       <attribute name="SchedulableClass">com.soa.alerter.Alerter</attribute>
                       <attribute name="SchedulableArguments">true</attribute>
                       <attribute name="SchedulableArgumentTypes">boolean</attribute>
                      
                       <attribute name="InitialStartDate">NOW</attribute>
                       <attribute name="SchedulePeriod">60000</attribute>
                       <attribute name="InitialRepetitions">-1</attribute>
                       </mbean>
                      
                      </server>
                      


                      Sunil

                      • 8. Re: Problem in data source binding while server start
                        Vicky Kak Master

                        Since the -ds.xml file gets converted into set of MBeans and it seems that the deployment of those generated MBeans and scheculer-service.xml are clashing.
                        why to make things complex?
                        You can encapsulate the scheduler service in the sar and later add this sar with the -ds.xml inside the EAR and use the strict deployment.
                        Another option I can think of defining the tag with dependeny on the jboss.jca MBean in the schedular-services.xml.
                        To confirm the accurate working of things enable the trace logs for the deployers and verify the stuff ;)
                        I am sure the options that I have mentioned will work.

                        • 9. Re: Problem in data source binding while server start
                          Sunil Basena Newbie

                          Hi,

                          It works fine. I changed the deployment order in org.jboss.deployment.MainDeployer-xmbean.xml as below:

                          <descriptors>
                           <value value="250:.rar,300:-ds.xml,400:.jar,412:-service.xml,500:.war,550:.jse,650:.ear,800:.bsh"/>
                           </descriptors>



                          Thnx :)
                          Sunil