1 Reply Latest reply on Dec 9, 2013 4:34 AM by Monish Sen

    parse exception while configuring data source

    Monish Sen Newbie

      Hi

       

      I'm attempting to configure an oracle in EAP 6.2 with the below comfiguration

       

      Module : com/oracle/ojdbc6/main

      module.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbc6">
        <resources>
        <resource-root path="ojdbc6-11.2.0.2.0.jar"/>
        </resources>
        <dependencies>
          <module name="javax.api"/>
        </dependencies>
      </module>
      

       

      and the datasource configuration in standalone.xml

       

       <subsystem xmlns="urn:jboss:domain:datasources:1.1">
                  <datasources>
                      <datasource jndi-name="jdbc/MyAppDatasource" pool-name="MyAppDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
        <connection-url>jdbc:oracle:thin:@10.156.140.222:1521:XE</connection-url>
        <driver>oracle</driver>
        <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
        <pool>
          <prefill>true</prefill>
          <use-strict-min>false</use-strict-min>
          <flush-strategy>FailingConnectionOnly</flush-strategy>
        </pool>
        <security>
          <user-name>whatever</user-name>
          <password>whatever</password>
        </security>
          </datasource>
                     <drivers>
                     
                          <driver name="h2" module="com.h2database.h2">
                              <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                          </driver>
                          <driver name="oracle" module="com.oracle.ojdbc6">
                              <xa-datasource-class>oracle.jdbc.driver.OracleDriver</xa-datasource-class>
                          </driver>
                      </drivers>
                  </datasources>
              </subsystem>
      

       

       

      the server fails to start with below exception stack

       

      12:00:50,132 ERROR [org.jboss.as.server] (Controller Boot Thread) JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration
        at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:141) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at org.jboss.as.server.ServerService.boot(ServerService.java:324) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:253) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at java.lang.Thread.run(Thread.java:695) [classes.jar:1.6.0_65]
      Caused by: javax.xml.stream.XMLStreamException
        at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$DataSourceSubsystemParser.readElement(DataSourcesExtension.java:582)
        at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$DataSourceSubsystemParser.readElement(DataSourcesExtension.java:182)
        at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final-redhat-2.jar:1.1.0.Final-redhat-2]
        at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.1.0.Final-redhat-2.jar:1.1.0.Final-redhat-2]
        at org.jboss.as.server.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:1024) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_4(StandaloneXml.java:458) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:145) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:107) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final-redhat-2.jar:1.1.0.Final-redhat-2]
        at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final-redhat-2.jar:1.1.0.Final-redhat-2]
        at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:133) [jboss-as-controller-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        ... 3 more
      
      
      12:00:50,134 FATAL [org.jboss.as.server] (Controller Boot Thread) JBAS015957: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
      

       

       

      Someone please guide me in the right direction. Thanks

        • 1. Re: parse exception while configuring data source
          Monish Sen Newbie

          The above issue was related to incorrect jndi namespace. Jboss seems to require 'java:/' or 'java:jboss/'  prefix.

           

          This piece of information maybe useful in the documentation


          Also, the parser(org.jboss.as.connector.subsystems.datasources.DataSourcesExtension) seems to have limited intelligence in the way of handling exceptions.

           

           

          @Override
            public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> list) throws XMLStreamException {
          
            final ModelNode address = new ModelNode();
            address.add(ModelDescriptionConstants.SUBSYSTEM, DATASOURCES);
            address.protect();
          
            final ModelNode subsystem = new ModelNode();
            subsystem.get(OP).set(ADD);
            subsystem.get(OP_ADDR).set(address);
          
            list.add(subsystem);
          
            try {
            String localName = null;
            switch (Namespace.forUri(reader.getNamespaceURI())) {
            case DATASOURCES_1_0: {
            localName = reader.getLocalName();
            Element element = Element.forName(reader.getLocalName());
            SUBSYSTEM_DATASOURCES_LOGGER.tracef("%s -> %s", localName, element);
            switch (element) {
            case SUBSYSTEM: {
          
            final DsParser parser = new DsParser();
            parser.parse(reader, list, address);
            requireNoContent(reader);
            break;
            }
            }
            }
            }
            } catch (Exception e) {
            throw new XMLStreamException(e);
            }
          
            }
          
            }