9 Replies Latest reply on Jul 30, 2011 10:59 AM by kiran.kumar M

    JCA config-property causes corruption to standalone.xml

    Andrew Wheeler Newbie

      If I configure a resource adapter for jackrabbit (jcr) and add the following as config properties (within connection-definition) the server corrupts the standalone.xml file.

       

      {code:xml}<config-property name="HomeDir">${jboss.server.data.dir}/jackrabbit</config-property>{code}

       

      becomes

       

      {code:xml}<config-property>("HomeDir" => "/opt/jboss7/standalone/data/jackrabbit")</config-property>{code}

       

      this causes the server to fail to parse standalone.xml and subsequently does not start on the next restart with the following error

       

      22:32:57,061 ERROR [stderr] Exception in thread "Controller Boot Thread" java.lang.RuntimeException: org.jboss.as.controller.persistence.ConfigurationPersistenceException: Failed to parse configuration

       

      Whats more, the JCA connector is not getting the correct parameters, so the resource throws an exception:

       

      22:29:32,494 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.PoolByCri] (http--127.0.0.1-8080-6) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Failed to create session: Unable to access a repository with the following settings:

          org.apache.jackrabbit.repository.conf: ("ConfigFile" => "/opt/jboss7/standalone/data/jackrabbit/jackrabbit.xml")

          org.apache.jackrabbit.repository.home: ("HomeDir" => "/opt/jboss7/standalone/data/jackrabbit")

      The following RepositoryFactory classes were consulted:

      Perhaps the repository you are trying to access is not available at the moment.

        • 3. Re: JCA config-property causes corruption to standalone.xml
          kiran.kumar M Newbie

          Jai Kiran ! I have downloaded theJBoss-AS-7.0.x   Build #1448 (Jul 27, 2011 2:42:03 AM) the above issue did not find its way into this build.

          This issue still exists.

          Can u please confirm if this fix is part of todays build ?

          • 4. Re: JCA config-property causes corruption to standalone.xml
            jaikiran pai Master

            The commit log shows that it's available in AS7 upstream https://source.jboss.org/changelog/JBossAS?cs=604ea95b0a1340bf920b695b2644ef94dbfe6c08. But if you are still running into this issue with the nightly build, then please add more details and the steps that you followed to reproduce this.

            • 5. Re: JCA config-property causes corruption to standalone.xml
              kiran.kumar M Newbie

              I have configired datanucleus-jca as below inside standalone.xml

               

              <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">

                          <resource-adapters>

                              <resource-adapter>

                                  <archive>

                                      datanucleus-jca-3.0.0-m6.rar

                                  </archive>

                                  <config-property name="PersistenceUnitName">

                                      pu

                                  </config-property>

                                  <connection-definitions>

                                      <connection-definition class-name="org.datanucleus.jdo.connector.ManagedConnectionFactoryImpl" jndi-name="java:/TraderDB-PU" enabled="true" use-java-context="true" pool-name="DNConnectionFactory" use-ccm="true"/>

                                  </connection-definitions>

                              </resource-adapter>

                          </resource-adapters>

                      </subsystem>

               

              The PersistanceUnitName above is pu , the ManagedConnectionFactoryImpl tries to locate pu inside ra.xml and jdoconfig.xml. The pu never matches with the one defined inside ra.xml. As a workaround i am using <config-property-value>(&quot;PersistenceUnitName&quot; =&gt; &quot;pu&quot;)</config-property-value> inside ra.xml and jdoconfig.xml.

               

              When I change the (&quot;PersistenceUnitName&quot; =&gt; &quot;pu&quot;) to pu datanucleus fails to load.

              • 6. Re: JCA config-property causes corruption to standalone.xml
                Jesper Pedersen Master

                Please, attach your ra.xml file -- also if the config-property is on the MCF you need to move the <config-property> tag under the <connection-definition>.

                 

                Currently it looks for "PersistenceUnitName" on the ResourceAdapter instance.

                • 7. Re: JCA config-property causes corruption to standalone.xml
                  kiran.kumar M Newbie

                  plz give me a hint how to attach a file in this forum. Nevertheless here are the relavent sections in respective files

                   

                  ra.xml


                  <config-property>

                              <config-property-name>PersistenceUnitName</config-property-name>

                              <config-property-type>java.lang.String</config-property-type>

                              <config-property-value>(&quot;PersistenceUnitName&quot; =&gt; &quot;pu&quot;)</config-property-value>

                          </config-property>

                   

                   

                  <config-property>

                              <config-property-name>PersistenceXmlFilename</config-property-name>

                              <config-property-type>java.lang.String</config-property-type>                                         

                              <config-property-value>file:///data1/home/kiran/jboss-as-7.1.0.Alpha1-SNAPSHOT/standalone/deployments/jdopersistence.xml</config-property-value>

                   

                  jdopersistence.xml

                   

                  <persistence-unit name="(&quot;PersistenceUnitName&quot; =&gt; &quot;pu&quot;)">

                      <properties>   

                          <property name="datanucleus.connection.resourceType" value="JTA"/>

                          <property name="datanucleus.storeManagerType" value="rdbms"/>

                          <property name="datanucleus.autoCreateSchema" value="false"/>

                          <property name="datanucleus.ConnectionFactoryName" value="java:jboss/datasources/TradeDBDSJTA"/>     

                          <property name="datanucleus.ConnectionFactory2Name" value="java:jboss/datasources/TradeDBDS"/>

                          <property name="datanucleus.autoStartClassNames" value="com.blogspot.jkook.daytrader.jdo.JDOOrderData"/>

                          <property name="datanucleus.autoStartMechanism" value="Classes"/>

                          <property name="datanucleus.autoStartMechanismMode" value="Ignored"/>

                          <property name="datanucleus.jtaLocator" value="custom_jndi"/>

                          <property name="datanucleus.jtaJndiLocation" value="java:jboss/TransactionManager"/>

                      </properties>

                    </persistence-unit>

                   

                  standalone.xml

                   

                  <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">

                              <resource-adapters>

                                  <resource-adapter>

                                      <archive>

                                          datanucleus-jca-3.0.0-m6.rar

                                      </archive>

                                      <config-property name="PersistenceUnitName">

                                          pu

                                      </config-property>

                                      <connection-definitions>

                  aderDB-PU" enabled="true" use-java-context="true" pool-name="DNConnectionFactory" use-ccm="true"/>

                                      </connection-definitions>

                                  </resource-adapter>

                              </resource-adapters>

                          </subsystem>

                  • 8. Re: JCA config-property causes corruption to standalone.xml
                    Jesper Pedersen Master

                    Move <config-property> in standalone.xml under the <connection-definition> element, like

                     

                    <connection-definition ....>

                         <config-property ...>

                    </connection-definiton>

                    • 9. Re: JCA config-property causes corruption to standalone.xml
                      kiran.kumar M Newbie

                      Thanks Jesper , It works with the changes you suggested the altered section in standalone.xml looks as below. I am happy with instant responses from you and your team. Your commitment to even a very small issue like this proves again  that Jboss is a real server for real people. I will continue to promote jboss as where ever possible.

                       

                      <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">

                                  <resource-adapters>

                                      <resource-adapter>

                                          <archive>

                                              datanucleus-jca-3.0.0-m6.rar

                                          </archive>

                                          <connection-definitions>

                                              <connection-definition class-name="org.datanucleus.jdo.connector.ManagedConnectionFactoryImpl" jndi-name="java:/TraderDB-PU" enabled="true" use-java-context="true" pool-name="DNConnectionFactory" use-ccm="true">

                      <config-property name="PersistenceUnitName">

                                              pu

                                          </config-property>

                      </connection-definitions>

                                          </connection-definitions>

                                      </resource-adapter>

                                  </resource-adapters>

                              </subsystem>