1 Reply Latest reply on Sep 23, 2011 1:24 AM by Daniel Bevenius

    Error in initializing datasource in AS7.

    Sam W Expert

      I added mysql datasource in standalone-preview.xml file in AS7, as shown below:

       

      <datasource jndi-name="java:jboss/datasources/Houseware" pool-name="Houseware">

            <connection-url>jdbc:mysql://localhost:3306/Houseware</connection-url>

               <driver>com.mysql.jdbc.Driver</driver>

            <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

            <pool>

              <min-pool-size>10</min-pool-size>

              <max-pool-size>100</max-pool-size>

              <prefill>true</prefill>

            </pool>

            <security>

              <user-name>root</user-name>

              <password>admin</password>

            </security>

            <statement>

              <prepared-statement-cache-size>32</prepared-statement-cache-size>

              <share-prepared-statement/>

            </statement>

          </datasource>

                      <drivers>

                          <driver name="h2" module="com.h2database.h2">

                              <xa-datasource-class>

                                  org.h2.jdbcx.JdbcDataSource

                              </xa-datasource-class>

                          </driver>

                          <driver name="mysql" module="com.mysql.jdbc">

                              <xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>

                          </driver>

                      </drivers>

                  </datasources>

       

       

      But Jboss throws error exception during the start up process:

      12:30:15,915 �Ϣ    [org.jboss.modules] JBoss Modules version 1.0.2.GA

      12:30:18,384 INFO  [org.jboss.msc] JBoss MSC version 1.0.1.GA

      12:30:18,575 INFO  [org.jboss.as] JBoss AS 7.1.0.Alpha1-SNAPSHOT "Lightning" starting

      12:30:29,321 ERROR [stderr] Exception in thread "Controller Boot Thread" java.lang.RuntimeException: org.jboss.as.controller.persistence.ConfigurationPersistenceException: Failed to parse configuration

      12:30:29,322 ERROR [stderr]     at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:89)

      12:30:29,322 ERROR [stderr]     at java.lang.Thread.run(Thread.java:662)

      12:30:29,322 ERROR [stderr] Caused by: org.jboss.as.controller.persistence.ConfigurationPersistenceException: Failed to parse configuration

      12:30:29,322 ERROR [stderr]     at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:115)

      12:30:29,322 ERROR [stderr]     at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:104)

      12:30:29,323 ERROR [stderr]     at org.jboss.as.server.ServerService.boot(ServerService.java:195)

      12:30:29,323 ERROR [stderr]     at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:83)

      12:30:29,323 ERROR [stderr]     ... 1 more

      12:30:29,323 ERROR [stderr] Caused by: javax.xml.stream.XMLStreamException: org.jboss.jca.common.metadata.ParserException: IJ010061: Unexpected element: share-prepared-statement

      12:30:29,323 ERROR [stderr]     at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$NewDataSourceSubsystemParser.readElement(DataSourcesExtension.java:708)

      12:30:29,323 ERROR [stderr]     at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$NewDataSourceSubsystemParser.readElement(DataSourcesExtension.java:277)

      12:30:29,324 ERROR [stderr]     at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:100)

      12:30:29,324 ERROR [stderr]     at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69)

      12:30:29,324 ERROR [stderr]     at org.jboss.as.controller.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:311)

      12:30:29,324 ERROR [stderr]     at org.jboss.as.controller.parsing.StandaloneXml.readServerElement(StandaloneXml.java:163)

      12:30:29,324 ERROR [stderr]     at org.jboss.as.controller.parsing.StandaloneXml.readElement(StandaloneXml.java:91)

      12:30:29,324 ERROR [stderr]     at org.jboss.as.controller.parsing.StandaloneXml.readElement(StandaloneXml.java:79)

      12:30:29,324 ERROR [stderr]     at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:100)

      12:30:29,325 ERROR [stderr]     at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:59)

      12:30:29,325 ERROR [stderr]     at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:107)

      12:30:29,325 ERROR [stderr]     ... 4 more

      12:30:29,325 ERROR [stderr] Caused by: org.jboss.jca.common.metadata.ParserException: IJ010061: Unexpected element: share-prepared-statement

      12:30:29,325 ERROR [stderr]     at org.jboss.jca.common.metadata.ds.DsParser.parseStatementSettings(DsParser.java:858)

      12:30:29,325 ERROR [stderr]     at org.jboss.jca.common.metadata.ds.DsParser.parseDataSource(DsParser.java:620)

      12:30:29,326 ERROR [stderr]     at org.jboss.jca.common.metadata.ds.DsParser.parseDataSources(DsParser.java:165)

      12:30:29,326 ERROR [stderr]     at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:118)

      12:30:29,326 ERROR [stderr]     at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$NewDataSourceSubsystemParser.readElement(DataSourcesExtension.java:700)

      12:30:29,326 ERROR [stderr]     ... 14 more

       

       

      I followed the instruction described in http://community.jboss.org/wiki/DataSourceConfigurationInAS7

      Can anyone tell me how to change the this configuration in the standalone-preview.xml file?

      Thanks

      Sam

        • 1. Re: Error in initializing datasource in AS7.
          Daniel Bevenius Master

          Can anyone tell me how to change the this configuration in the standalone-preview.xml file?

           

          The schemas can be found in the 'jboss-as-7.0.1.Final/docs/schema'. Looking at the jboss-as-datasources_1_0.xsd the definition for 'share-prepared-statements' looks like this:

           

          <xs:element name="share-prepared-statements" type="boolean-presenceType" minOccurs="0">
                  <xs:annotation>
                    <xs:documentation>
                      <![CDATA[[
                        Whether to share prepare statements, i.e. whether asking for same 
                        statement twice without closing uses the same underlying prepared statement. 
                        The default is false. e.g. <share-prepared-statements/>
                      ]]>
                    </xs:documentation>
                  </xs:annotation>
                </xs:element>
          
          

          So it looks like it should be 'share-prepared-statements' and not 'share-prepared-statement' :

           

           <share-prepared-statements/>
          
          

           

          Regards,

           

          /Daniel