10 Replies Latest reply on Jul 15, 2008 2:58 AM by jaikiran

    ServletContextListener -DataSource File

    alexpandiyan

      Hi All,
      I m working on struts application.I can able to lookup the datasource file, when my server fully deployed everything.
      But i want to lookup the datasource file in
      ServletContextListener

      see i tryied to lookup..but its saying particular (datasource)ds.xml file is not bound.
      this is my problem. i need to lookup the DataSource file in ServletContextListener.

      In contextinitialized method i need to fetch some information from database.

      Hope i ll get a solution from here,

      Thanks
      -----------
      Alex

        • 1. Re: ServletContextListener -DataSource File
          jaikiran

          Which version of JBoss?

          • 2. Re: ServletContextListener -DataSource File
            jaikiran

            Also post the console logs, when you start JBoss with the datasource and your application in the deploy folder.

            • 3. Re: ServletContextListener -DataSource File
              alexpandiyan

              Console logs
              ----------------------------------------------------------------------------------------
              09:38:36,140 INFO [STDOUT] at org.jboss.Main$1.run(Main.java:438)
              09:38:36,140 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
              09:38:36,203 INFO [STDOUT] 1111111111111111111111111222222222222222222222223333
              3333333333333333444444444444444444444444
              09:38:36,218 INFO [[/]] Couldn't create addressesDB sttribute: MyDataSourceMct1DS not
              bound
              -------------------------------------------------------------------------------------
              MyDataSourceMct1DS not bound This information i got in Catch blog, in my contextListener i trying to connecting DataBase...so its throwing error...
              that message returning "MyDataSourceMct1DS not bound"..

              Version of My Jboss 4.0.3SP1.

              Location of my Datasource file.
              C:\Java\jboss-4.0.3SP1\server\default\deploy

              • 4. Re: ServletContextListener -DataSource File
                peterj

                Please post the following information:

                1) Your *-ds.xml file for the data source (make sure you enclose it in code brackets - select the text and click the Code button located above the text window)

                2) The code you are using to look up the data source.

                3) If your web.xml file references the data source, provide that also (once again enclosed in code brackets)

                4) If your jboss-web.xml file references the data source, provide that also (once again enclosed in code brackets)

                And use the Preview button to make sure the formatting is correct before you submit your reply.

                • 5. Re: ServletContextListener -DataSource File
                  alexpandiyan

                   

                  1:18,968 INFO [ValidatorPlugIn] Loading validation rules file from '/WEB-IN
                  lidator-rules.xml'
                  1:18,968 INFO [ValidatorPlugIn] Loading validation rules file from '/WEB-IN
                  lidation.xml'
                  1:19,390 INFO [STDOUT] 1111111111111111111111111222222222222222222222223333
                  333333333333444444444444444444444444
                  1:19,843 INFO [STDOUT] 1111111111111111111111111222222222222222222222223333
                  333333333333444444444444444444444444
                  1:19,890 INFO [STDOUT] 1111111111111111111111111222222222222222222222223333
                  333333333333444444444444444444444444
                  1:20,156 INFO [Catalina] Server startup in 5719 ms
                  1:21,296 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/
                  -invoker.sar/invoker.war/
                  1:21,968 INFO [TomcatDeployer] deploy, ctxPath=/ws4ee, warUrl=.../tmp/deplo
                  p63490jboss-ws4ee-exp.war/
                  1:22,343 INFO [TomcatDeployer] deploy, ctxPath=/ROOT_Tomcat, warUrl=.../dep
                  jbossweb-tomcat55.sar/ROOT_Tomcat.war/
                  1:22,578 INFO [TomcatDeployer] deploy, ctxPath=/wizard, warUrl=.../deploy/j
                  web-tomcat55.sar/wizard.war/
                  1:23,531 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../
                  oy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
                  1:23,796 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../dep
                  management/console-mgr.sar/web-console.war/
                  1:25,578 INFO [RARDeployment] Required license terms exist, view META-INF/r
                  l in .../deploy/jboss-ha-local-jdbc.rar
                  1:25,843 INFO [RARDeployment] Required license terms exist, view META-INF/r
                  l in .../deploy/jboss-ha-xa-jdbc.rar
                  1:26,078 INFO [RARDeployment] Required license terms exist, view META-INF/r
                  l in .../deploy/jboss-local-jdbc.rar
                  1:26,312 INFO [RARDeployment] Required license terms exist, view META-INF/r
                  l in .../deploy/jboss-xa-jdbc.rar
                  1:26,531 INFO [RARDeployment] Required license terms exist, view META-INF/r
                  l in .../deploy/jms/jms-ra.rar
                  1:26,750 INFO [RARDeployment] Required license terms exist, view META-INF/r
                  l in .../deploy/mail-ra.rar
                  1:27,578 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
                  jca:service=DataSourceBinding,name=TeceraMct1DS' to JNDI name 'java:TerraMct1
                  
                  1:27,921 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
                  jca:service=DataSourceBinding,name=MyDataSourceMct1DS' to JNDI name 'java:MyDataSourceMct1DS
                  
                  1:28,906 WARN [ServiceController] Problem starting service jboss:service=Hy
                  onic,database=localDB
                  .sql.SQLException: User not found: SA
                   at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
                   at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
                   at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
                   at org.hsqldb.jdbcDriver.connect(Unknown Source)
                   at java.sql.DriverManager.getConnection(DriverManager.java:525)
                   at java.sql.DriverManager.getConnection(DriverManager.java:171)
                   at org.jboss.jdbc.HypersonicDatabase.getConnection(HypersonicDatabase.ja
                  06)
                   at org.jboss.jdbc.HypersonicDatabase.startStandaloneDatabase(HypersonicD
                  ase.java:617)
                   at org.jboss.jdbc.HypersonicDatabase.startService(HypersonicDatabase.jav
                  7)
                   at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
                  rt.java:274)
                   at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
                  upport.java:230)
                   at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                  mpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:585)
                   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                  ava: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.
                  :245)
                   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                   at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
                  java:943)
                   at $Proxy0.start(Unknown Source)
                   at org.jboss.system.ServiceController.start(ServiceController.java:428)
                   at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                  mpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:585)
                   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                  ava: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.
                  :245)
                   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                   at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
                   at $Proxy4.start(Unknown Source)
                   at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
                  :39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                  mpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:585)
                   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                  ava:141)
                   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                   at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
                  ava:118)
                   at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                   at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
                  OperationInterceptor.java:127)
                   at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                   at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
                  :245)
                   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                   at org.jboss.mx.util.JMXInvocationHandler.invoke(JMXInvocationHandler.ja
                  73)
                   at $Proxy21.start(Unknown Source)
                   at org.jboss.deployment.XSLSubDeployer.start(XSLSubDeployer.java:185)
                   at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
                   at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
                   at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
                   at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                  mpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:585)
                   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                  ava:141)
                   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                   at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
                  ava:118)
                   at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                   at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
                  OperationInterceptor.java:127)
                   at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                   at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.

                  Above Console logs.

                  DataSource File

                  <?xml version="1.0" encoding="UTF-8"?>
                  
                  <!-- The Hypersonic embedded database JCA connection factory config
                  $Id: hsqldb-ds.xml,v 1.15 2004/09/15 14:37:40 loubyansky Exp $ -->
                  
                  
                  <datasources>
                   <local-tx-datasource>
                  
                   <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
                   <!-- Datasources are not available outside the virtual machine -->
                   <jndi-name>MyDataSourceMct1DS</jndi-name>
                  
                   <!-- for tcp connection, allowing other processes to use the hsqldb
                   database. This requires the org.jboss.jdbc.HypersonicDatabase mbean.
                   <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
                  -->
                   <!-- for totally in-memory db, not saved when jboss stops.
                   The org.jboss.jdbc.HypersonicDatabase mbean necessary
                   <connection-url>jdbc:hsqldb:.</connection-url>
                  -->
                   <!-- for in-process persistent db, saved when jboss stops. The
                   org.jboss.jdbc.HypersonicDatabase mbean is necessary for properly db shutdown
                  -->
                   <!-- connection-url>jdbc:mysql://localhost/example</connection-url -->
                  
                   <connection-url>jdbc:microsoft:sqlserver://192.168.10.19:1733;DatabaseName=Test;SelectMethod=cursor
                   </connection-url>
                  
                   <!-- The driver class -->
                   <driver-class>com.p6spy.engine.spy.P6SpyDriver</driver-class>
                  
                  
                  
                   <!-- The login and password -->
                   <user-name>sa</user-name>
                   <password>sa</password>
                  
                   <!--example of how to specify class that determines if exception means connection should be destroyed-->
                   <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
                  
                   <!-- this will be run before a managed connection is removed from the pool for use by a client-->
                   <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
                  
                   <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
                   <min-pool-size>5</min-pool-size>
                  
                   <!-- The maximum connections in a pool/sub-pool -->
                   <max-pool-size>20</max-pool-size>
                  
                   <!-- The time before an unused connection is destroyed -->
                   <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
                   <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
                   <idle-timeout-minutes>0</idle-timeout-minutes>
                  
                   <!-- 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>
                   -->
                  
                   <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
                   <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
                   -->
                  
                   <!-- Whether to check all statements are closed when the connection is returned to the pool,
                   this is a debugging feature that should be turned off in production -->
                   <track-statements/>
                  
                   <!-- Use the getConnection(user, pw) for logins
                   <application-managed-security/>
                   -->
                  
                   <!-- Use the security domain defined in conf/login-config.xml -->
                  <!-- <security-domain>HsqlDbRealm</security-domain>
                   -->
                   <!-- Use the security domain defined in conf/login-config.xml or the
                   getConnection(user, pw) for logins. The security domain takes precedence.
                   <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
                   -->
                  
                   <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
                  <!-- <metadata>
                   <type-mapping>Hypersonic SQL</type-mapping>
                   </metadata>
                   -->
                   <!-- This mbean can be used when using in process persistent hypersonic -->
                  <!-- <depends>jboss:service=Hypersonic,database=localDB</depends>
                   --> </local-tx-datasource>
                  
                   <!-- This mbean should be used only when using tcp connections. Uncomment
                   when the tcp based connection-url is used.
                   <mbean code="org.jboss.jdbc.HypersonicDatabase"
                   name="jboss:service=Hypersonic">
                   <attribute name="Port">1701</attribute>
                   <attribute name="Silent">true</attribute>
                   <attribute name="Database">default</attribute>
                   <attribute name="Trace">false</attribute>
                   <attribute name="No_system_exit">true</attribute>
                   </mbean>
                   -->
                  
                   <!-- This mbean can be used when using in process persistent db -->
                  <!-- <mbean code="org.jboss.jdbc.JdbcProvider"
                   name="jboss:service=JdbcProvider,database=localDB">
                   <attribute name="Database">localDB</attribute>
                   <attribute name="InProcessMode">true</attribute>
                   </mbean> -->
                  <!-- <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
                   <attribute name="Drivers">com.microsoft.jdbc.sqlserver.SQLServerDriver</attribute>
                   </mbean>
                   --></datasources>
                  


                  No more configuration in my project web.xml.
                  In Jboos-web.xml-nothing in that.only tag started and ended.

                  For your reference, jbossjca-service.xml contain the following code.

                  <mbean code="org.jboss.deployment.XSLSubDeployer" name="jboss.jca:service=ConnectionFactoryDeployer">
                   <attribute name="DdSuffix">-ds.xml</attribute>
                   <attribute name="EnhancedSuffixes">300:-ds.xml</attribute>
                   <attribute name="XslUrl">stylesheets/ConnectionFactoryTemplate.xsl</attribute>
                   <attribute name="ValidateDTDs">false</attribute>
                   </mbean>


                  in start position of console log... before that only my context Listener Initializing..but my datasource file initializing after that...u can see in log...

                  I m confused , even i dont know that much about configuration. help me

                  • 6. Re: ServletContextListener -DataSource File
                    alexpandiyan

                    One more refering Datasource file
                    code belows....in project folder/ build.xml file

                    <jboss Version="4.0"
                     datasource="java:/MyDataSourceMct1DS"
                     datasourceMapping="MS SQLSERVER2000"
                     preferredRelationMapping="foreign-key"
                     createTable="false"
                     removeTable="false"
                     destDir="EJB/META-INF" >
                     </jboss>
                     <valueobject></valueobject>
                    
                    
                     </ejbdoclet>
                     </target>
                    
                    <!-- Xdoclet Generation Ends -->
                    


                    • 7. Re: ServletContextListener -DataSource File
                      peterj

                      I think the issue is that you provided a password for the sa account:

                      <password>sa</password>


                      That account, in hsqldb, usually does not have a password:

                      <password></password>


                      Because the login information was incorrect, the data source was never deployed, hence the later datasource not bound message (which you first posted).

                      • 8. Re: ServletContextListener -DataSource File
                        alexpandiyan

                        Hi peter,
                        first of all i would like to say thank you,
                        your saying hsqldb usuallly dont have password, ya i agree,default file only like that, my datasource having username and password as well.
                        normally my application working well.inserting, updating, through EJB,DAO everything fine and still normal.

                        So my concern is i want to use that file in contextListener. ok even i try your way that mean without password i try and tell you...
                        and also u try for me.

                        Thank you
                        Alex

                        • 9. Re: ServletContextListener -DataSource File
                          alexpandiyan

                           

                          "AlexPandiyan" wrote:
                          1:18,968 INFO [ValidatorPlugIn] Loading validation rules file from '/WEB-IN
                          lidator-rules.xml'
                          1:18,968 INFO [ValidatorPlugIn] Loading validation rules file from '/WEB-IN
                          lidation.xml'
                          1:19,390 INFO [STDOUT] 1111111111111111111111111222222222222222222222223333
                          333333333333444444444444444444444444
                          1:19,843 INFO [STDOUT] 1111111111111111111111111222222222222222222222223333
                          333333333333444444444444444444444444
                          1:19,890 INFO [STDOUT] 1111111111111111111111111222222222222222222222223333
                          333333333333444444444444444444444444
                          1:20,156 INFO [Catalina] Server startup in 5719 ms
                          1:21,296 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/
                          -invoker.sar/invoker.war/
                          1:21,968 INFO [TomcatDeployer] deploy, ctxPath=/ws4ee, warUrl=.../tmp/deplo
                          p63490jboss-ws4ee-exp.war/
                          1:22,343 INFO [TomcatDeployer] deploy, ctxPath=/ROOT_Tomcat, warUrl=.../dep
                          jbossweb-tomcat55.sar/ROOT_Tomcat.war/
                          1:22,578 INFO [TomcatDeployer] deploy, ctxPath=/wizard, warUrl=.../deploy/j
                          web-tomcat55.sar/wizard.war/
                          1:23,531 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../
                          oy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
                          1:23,796 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../dep
                          management/console-mgr.sar/web-console.war/
                          1:25,578 INFO [RARDeployment] Required license terms exist, view META-INF/r
                          l in .../deploy/jboss-ha-local-jdbc.rar
                          1:25,843 INFO [RARDeployment] Required license terms exist, view META-INF/r
                          l in .../deploy/jboss-ha-xa-jdbc.rar
                          1:26,078 INFO [RARDeployment] Required license terms exist, view META-INF/r
                          l in .../deploy/jboss-local-jdbc.rar
                          1:26,312 INFO [RARDeployment] Required license terms exist, view META-INF/r
                          l in .../deploy/jboss-xa-jdbc.rar
                          1:26,531 INFO [RARDeployment] Required license terms exist, view META-INF/r
                          l in .../deploy/jms/jms-ra.rar
                          1:26,750 INFO [RARDeployment] Required license terms exist, view META-INF/r
                          l in .../deploy/mail-ra.rar
                          1:27,921 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
                          jca:service=DataSourceBinding,name=MyDataSourceMct1DS' to JNDI name 'java:MyDataSourceMct1DS
                          
                          1:28,906 WARN [ServiceController] Problem starting service jboss:service=Hy
                          onic,database=localDB
                          .sql.SQLException: User not found: SA
                           at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
                           at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
                           at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
                           at org.hsqldb.jdbcDriver.connect(Unknown Source)
                           at java.sql.DriverManager.getConnection(DriverManager.java:525)
                           at java.sql.DriverManager.getConnection(DriverManager.java:171)
                           at org.jboss.jdbc.HypersonicDatabase.getConnection(HypersonicDatabase.ja
                          06)
                           at org.jboss.jdbc.HypersonicDatabase.startStandaloneDatabase(HypersonicD
                          ase.java:617)
                           at org.jboss.jdbc.HypersonicDatabase.startService(HypersonicDatabase.jav
                          7)
                           at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
                          rt.java:274)
                           at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
                          upport.java:230)
                           at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                          mpl.java:25)
                           at java.lang.reflect.Method.invoke(Method.java:585)
                           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                          ava: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.
                          :245)
                           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                          ava: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.
                          :245)
                           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
                           at $Proxy4.start(Unknown Source)
                           at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
                           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
                          :39)
                           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                          mpl.java:25)
                           at java.lang.reflect.Method.invoke(Method.java:585)
                           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                          ava:141)
                           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                           at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
                          ava:118)
                           at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
                          OperationInterceptor.java:127)
                           at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
                          :245)
                           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                           at org.jboss.mx.util.JMXInvocationHandler.invoke(JMXInvocationHandler.ja
                          73)
                           at $Proxy21.start(Unknown Source)
                           at org.jboss.deployment.XSLSubDeployer.start(XSLSubDeployer.java:185)
                           at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
                           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
                           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
                           at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
                           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                          mpl.java:25)
                           at java.lang.reflect.Method.invoke(Method.java:585)
                           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                          ava:141)
                           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                           at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
                          ava:118)
                           at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
                          OperationInterceptor.java:127)
                           at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.

                          Above Console logs.

                          DataSource File

                          <?xml version="1.0" encoding="UTF-8"?>
                          
                          <!-- The Hypersonic embedded database JCA connection factory config
                          $Id: hsqldb-ds.xml,v 1.15 2004/09/15 14:37:40 loubyansky Exp $ -->
                          
                          
                          <datasources>
                           <local-tx-datasource>
                          
                           <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
                           <!-- Datasources are not available outside the virtual machine -->
                           <jndi-name>MyDataSourceMct1DS</jndi-name>
                          
                           <!-- for tcp connection, allowing other processes to use the hsqldb
                           database. This requires the org.jboss.jdbc.HypersonicDatabase mbean.
                           <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
                          -->
                           <!-- for totally in-memory db, not saved when jboss stops.
                           The org.jboss.jdbc.HypersonicDatabase mbean necessary
                           <connection-url>jdbc:hsqldb:.</connection-url>
                          -->
                           <!-- for in-process persistent db, saved when jboss stops. The
                           org.jboss.jdbc.HypersonicDatabase mbean is necessary for properly db shutdown
                          -->
                           <!-- connection-url>jdbc:mysql://localhost/example</connection-url -->
                          
                           <connection-url>jdbc:microsoft:sqlserver://192.234.10.1990:17330;DatabaseName=Test;SelectMethod=cursor
                           </connection-url>
                          
                           <!-- The driver class -->
                           <driver-class>com.p6spy.engine.spy.P6SpyDriver</driver-class>
                          
                          
                          
                           <!-- The login and password -->
                           <user-name>sa</user-name>
                           <password>CVDFRE</password>
                          
                           <!--example of how to specify class that determines if exception means connection should be destroyed-->
                           <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
                          
                           <!-- this will be run before a managed connection is removed from the pool for use by a client-->
                           <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
                          
                           <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
                           <min-pool-size>5</min-pool-size>
                          
                           <!-- The maximum connections in a pool/sub-pool -->
                           <max-pool-size>20</max-pool-size>
                          
                           <!-- The time before an unused connection is destroyed -->
                           <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
                           <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
                           <idle-timeout-minutes>0</idle-timeout-minutes>
                          
                           <!-- 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>
                           -->
                          
                           <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
                           <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
                           -->
                          
                           <!-- Whether to check all statements are closed when the connection is returned to the pool,
                           this is a debugging feature that should be turned off in production -->
                           <track-statements/>
                          
                           <!-- Use the getConnection(user, pw) for logins
                           <application-managed-security/>
                           -->
                          
                           <!-- Use the security domain defined in conf/login-config.xml -->
                          <!-- <security-domain>HsqlDbRealm</security-domain>
                           -->
                           <!-- Use the security domain defined in conf/login-config.xml or the
                           getConnection(user, pw) for logins. The security domain takes precedence.
                           <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
                           -->
                          
                           <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
                          <!-- <metadata>
                           <type-mapping>Hypersonic SQL</type-mapping>
                           </metadata>
                           -->
                           <!-- This mbean can be used when using in process persistent hypersonic -->
                          <!-- <depends>jboss:service=Hypersonic,database=localDB</depends>
                           --> </local-tx-datasource>
                          
                           <!-- This mbean should be used only when using tcp connections. Uncomment
                           when the tcp based connection-url is used.
                           <mbean code="org.jboss.jdbc.HypersonicDatabase"
                           name="jboss:service=Hypersonic">
                           <attribute name="Port">189012</attribute>
                           <attribute name="Silent">true</attribute>
                           <attribute name="Database">default</attribute>
                           <attribute name="Trace">false</attribute>
                           <attribute name="No_system_exit">true</attribute>
                           </mbean>
                           -->
                          
                           <!-- This mbean can be used when using in process persistent db -->
                          <!-- <mbean code="org.jboss.jdbc.JdbcProvider"
                           name="jboss:service=JdbcProvider,database=localDB">
                           <attribute name="Database">localDB</attribute>
                           <attribute name="InProcessMode">true</attribute>
                           </mbean> -->
                          <!-- <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
                           <attribute name="Drivers">com.microsoft.jdbc.sqlserver.SQLServerDriver</attribute>
                           </mbean>
                           --></datasources>
                          


                          No more configuration in my project web.xml.
                          In Jboos-web.xml-nothing in that.only tag started and ended.

                          For your reference, jbossjca-service.xml contain the following code.

                          <mbean code="org.jboss.deployment.XSLSubDeployer" name="jboss.jca:service=ConnectionFactoryDeployer">
                           <attribute name="DdSuffix">-ds.xml</attribute>
                           <attribute name="EnhancedSuffixes">300:-ds.xml</attribute>
                           <attribute name="XslUrl">stylesheets/ConnectionFactoryTemplate.xsl</attribute>
                           <attribute name="ValidateDTDs">false</attribute>
                           </mbean>


                          in start position of console log... before that only my context Listener Initializing..but my datasource file initializing after that...u can see in log...

                          I m confused , even i dont know that much about configuration. help me


                          • 10. Re: ServletContextListener -DataSource File
                            jaikiran

                            That ordering of application deployment looks strange. Where have you placed in the WAR file in JBoss?