1 2 Previous Next 29 Replies Latest reply on Feb 14, 2013 6:15 AM by Hercules Zeus

    JBoss 7: how to deploy with JCA?

    Maxym Pendyshchuk Newbie

      I try to deploy JAckRabbit to JBoss 7, previously (for JBoss 4 or 6) I use jcr-ds.xml, like it was described here, I'm not sure I understand what should I do now, should such configuration file still work under JBoss7? On 'console' page I see connectors/datasource. I tried to use XA Datasources, I see here parameters for config properties (3rd step of wizard), but no fields for

       


      <rar-name>jackrabbit-jca.rar</rar-name>

      <connection-definition>javax.jcr.Repository</connection-definition>

       

      I suppose they are generated automatically, right? Is it right direction I move to?

       

      Template definition of jcr-ds.xml looks like:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!--
         Licensed to the Apache Software Foundation (ASF) under one or more
         contributor license agreements.  See the NOTICE file distributed with
         this work for additional information regarding copyright ownership.
         The ASF licenses this file to You under the Apache License, Version 2.0
         (the "License"); you may not use this file except in compliance with
         the License.  You may obtain a copy of the License at
      
             http://www.apache.org/licenses/LICENSE-2.0
      
         Unless required by applicable law or agreed to in writing, software
         distributed under the License is distributed on an "AS IS" BASIS,
         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         See the License for the specific language governing permissions and
         limitations under the License.
        -->
      <connection-factories> 
        <tx-connection-factory>
          <jndi-name>jcr/local</jndi-name> 
          <xa-transaction/>
          <rar-name>jackrabbit-jca.rar</rar-name>
          <connection-definition>javax.jcr.Repository</connection-definition>
          <config-property name="repositoryURI" type="java.lang.String">jcr-jackrabbit://jackrabbit</config-property>
          <config-property name="bindSessionToTransaction" type="java.lang.Boolean">true</config-property>
        </tx-connection-factory>
      </connection-factories>
      

       

      and one more issue: 4th step of wizard ask me for user name/password, which I don't see in this template... And that step can't be skipped...

        • 1. Re: JBoss 7: how to deploy with JCA?
          Maxym Pendyshchuk Newbie

          Am right that current documentation lacks for this information?

           

          at least "Subsystems configuration" show only how to configurate JMS connection factories, "How do I migrate from my application from AS5 or AS6 to AS7" also keeps silence, at least now. do I miss something?

           

          for me this is first step migrating to JBoss7, if I can't do it I can't move forward...

          • 2. Re: JBoss 7: how to deploy with JCA?
            Jesper Pedersen Master

            AS 7 features the IronJacamar container - see http://docs.jboss.org/ironjacamar/userguide/1.0/en-US/html/deployment.html#deployingra_descriptor for the new deployment format.

             

            You will need to use the "resourceadapers" subsystem for configuration.

             

            The schemas are here: http://docs.jboss.org/ironjacamar/schema/

            • 3. Re: JBoss 7: how to deploy with JCA?
              yudong Newbie

              I also tried to deploy jackrabbit(1.4) on JBoss 7.

              • I created a JBoss module for the jcr api
              • I repackaged the jackrabbit-jca-1.4.rar by adding Dependencies: javax.jcr.api export to MANIFEST.MF. javax.jcr.api is the module name created in step above.
              • I deployed jackrabbit-jca-1.4.rar by copying it to standalone\deployments directory, no error, so far so good.
              • I added a resource-adapter(according to jboss-resource-adapters.xsd) node to standalone-preview.xml:
              Header 1

                              <resource-adapter>

                                  <archive>

                                      jackrabbit-jca-1.4.rar

                                  </archive>

                                  <transaction-support>

                                      XATransaction

                                  </transaction-support>

                                  <connection-definitions>

                                      <connection-definition class-name="javax.jcr.Repository" jndi-name="java:/jcr/local" enabled="true" use-java-context="true" use-ccm="true">

                                  <config-property name="homeDir" >c:/tmp/defacto/jcr/</config-property>

                                  <config-property name="configFile" >file:c:/tmp/repository.xml</config-property>

                                  <config-property name="bindSessionToTransaction" >false</config-property>

                                      </connection-definition>

                                  </connection-definitions>

                              </resource-adapter>

               

              After restart I get this error:

              08:45:16,699 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-10) MSC00001: Failed to start service jboss.raxml."jackrabbit-jca-1.4": org.jboss.msc.service.StartException in service jboss.raxml."jackrabbit-jca-1.4": org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: jackrabbit-jca-1.4 isn't registered

                        at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:106)

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

                        at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_26]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_26]

                        at java.lang.Thread.run(Unknown Source) [:1.6.0_26]

              Caused by: org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: jackrabbit-jca-1.4 isn't registered

                        at org.jboss.jca.core.mdr.SimpleMetadataRepository.getResourceAdapter(SimpleMetadataRepository.java:150)

                        at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:80)

                        ... 5 more

               

              Anyone succeeded with jackrabbit on JBoss 7? Any help is appreciated.

              • 4. Re: JBoss 7: how to deploy with JCA?
                Ciro Cavani Novice

                Take a look the other thread:

                 

                http://community.jboss.org/thread/169517

                 

                and the JIRA:

                 

                https://issues.jboss.org/browse/AS7-1304

                 

                (I think there is no way to deploy Jackrabbit - 1.6.4 in my case - in 7.0.0.Final)

                 

                Thanks,

                • 5. Re: JBoss 7: how to deploy with JCA?
                  Brian Wallis Master

                  I have successfully deployed jackrabbit 2.2.7 into jboss as7 (7.1.0.Alpha, a nightly build from early this week) but it is not yet perfect.

                   

                  I still have an issue with the config-property definitions in the resource-adapter definition in standalone.xml. Simply, it doesn't work and I have had to configure the repository path into the rar file instead.

                   

                  When defined in standalone.xml

                   

                  {code}

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

                     <resource-adapters>

                         <resource-adapter>

                             <archive>

                                 jackrabbit-jca-2.2.7.rar

                             </archive>

                             <connection-definitions>

                                 <connection-definition

                                   class-name="org.apache.jackrabbit.jca.JCAManagedConnectionFactory"

                                   jndi-name="java:/jca/DocumentStore" enabled="true" use-java-context="true"

                                   pool-name="jackrabbit-jca-2_2_7_rar-Pool" use-ccm="true">

                                     <config-property name="HomeDir">

                                         /Users/bwallis/InfoMedix/JBoss/jboss-as-7.1.0.Alpha1-SNAPSHOT/repository

                                     </config-property>

                                     <config-property name="ConfigFile">

                                         /Users/bwallis/InfoMedix/JBoss/jboss-as-7.1.0.Alpha1-SNAPSHOT/repository/repository.xml

                                     </config-property>

                  ....

                  {code}

                   

                  I get errors like so:

                   

                   

                  {code}

                  17:21:28,273 INFO  [org.apache.jackrabbit.core.config.RepositoryConfig] (http--127.0.0.1-8080-1)

                     Copying configuration from vfs:/content/jackrabbit-jca-2.2.7.rar/jackrabbit-core-2.2.7.jar/org/apache/jackrabbit/core/repository.xml to

                     ("ConfigFile" => "/Users/bwallis/InfoMedix/JBoss/jboss-as-7.1.0.Alpha1-SNAPSHOT/repository/repository.xml")

                  {code}

                   

                  ie: the property value is being passed to jackrabbit as the string

                   

                  {code}("ConfigFile" => "/Users/bwallis/InfoMedix/JBoss/jboss-as-7.1.0.Alpha1-SNAPSHOT/repository/repository.xml"){code}

                   

                  I even get a directory created in the jboss home direcory with the unlikely name

                   

                   

                  {code}drwxr-xr-x   3 bwallis  bwallis     102  2 Aug 13:43 ("HomeDir" => "{code}

                   

                  So in short, it can work but there is still something wrong that maybe related to the fix for  AS7-1304

                  • 6. Re: JBoss 7: how to deploy with JCA?
                    Brian Wallis Master

                    How I got it to work...

                     

                    To get the rar deployed and working I had to do the following 5 steps:

                     

                    1) add a dependencies line to the MANIFEST.MF file in the rar

                     

                    {code}

                    Dependencies: javax.jcr export,org.slf4j

                    {code}

                     

                    2) create a javax.jcr module in jboss with the jcr 2.0 jar file in it.

                     

                    3) delete the two logback jar files from the rar so logging goes directly to jboss logging (otherwise it goes to stdout which jboss picks up but you can't control the logging levels)

                     

                    4) Add my repository paths to the ra.xml file (my repository is a bundleDB repo)

                     

                    {code}

                    <resourceadapter>

                    ...

                       <outbound-resourceadapter>

                         <connection-definition>

                    ...

                           <config-property>

                             <config-property-name>HomeDir</config-property-name>

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

                             <config-property-value>/Users/bwallis/InfoMedix/JBoss/jboss-as-7.1.0.Alpha1-SNAPSHOT/repository</config-property-value>

                           </config-property>

                           <config-property>

                             <config-property-name>ConfigFile</config-property-name>

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

                             <config-property-value>/Users/bwallis/InfoMedix/JBoss/jboss-as-7.1.0.Alpha1-SNAPSHOT/repository/repository.xml</config-property-value>

                           </config-property>

                    {code}

                     

                    5) configure the rar in the jboss standalone.xml file

                     

                     

                    {code}

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

                       <resource-adapters>

                           <resource-adapter>

                               <archive>

                                   jackrabbit-jca-2.2.7.rar

                               </archive>

                               <transaction-support>

                                   XATransaction

                               </transaction-support>

                               <connection-definitions>

                                   <connection-definition

                                     class-name="org.apache.jackrabbit.jca.JCAManagedConnectionFactory"

                                     jndi-name="java:/jca/DocumentStore" enabled="true" use-java-context="true"

                                     pool-name="jackrabbit-jca-2_2_7_rar-Pool" use-ccm="true">

                                   </connection-definition>

                               </connection-definitions>

                           </resource-adapter>

                       </resource-adapters>

                    </subsystem>

                    {code}

                     

                    With these changes it all works OK in JBoss, I can access the repository and store and retrieve nodes. (I've only played with a transient one so far, from a simple jsp test page)

                    • 7. Re: JBoss 7: how to deploy with JCA?
                      jaikiran pai Master

                      Brian Wallis wrote:

                       

                       

                       

                      ie: the property value is being passed to jackrabbit as the string

                       

                      ("ConfigFile" => "/Users/bwallis/InfoMedix/JBoss/jboss-as-7.1.0.Alpha1-SNAPSHOT/repository/repository.xml")

                       

                       

                      I even get a directory created in the jboss home direcory with the unlikely name

                       

                       

                      drwxr-xr-x   3 bwallis  bwallis     102  2 Aug 13:43 ("HomeDir" => "

                       

                       

                      So in short, it can work but there is still something wrong that maybe related to the fix for  AS7-1304

                      Can you try this against latest AS7 nightly build and see if it is fixed? If it's not, please file a JIRA for this.

                      • 8. Re: JBoss 7: how to deploy with JCA?
                        Brian Wallis Master

                        Grabbed the build from 1st August and it still fails. I will create a ticket and add a link here.

                         

                        https://issues.jboss.org/browse/AS7-1452

                         

                        jira link added

                        • 9. Re: JBoss 7: how to deploy with JCA?
                          Jeff Zhang Newbie

                          Hi Brian,

                           

                          I tried to reproduce the issue but it seems no fail on my enviornment. My step is:

                           

                          1. use lastest built kit.

                          2. download jackrabbit-jca-2.2.7.rar and jcr-2.0.jar

                          3. create a javax.jcr.api module and contain jce-2.0.jar

                          4. un-package rar file and change MANIFEST.MF (add dependency), remove 2 logback jars like you. Not touch ra.xml.

                          5. staat as7, put the rar file into standalone deployment directory, let hot deployment.

                          6. stop as7, and add resourceadapter into standalone.xml:

                           

                           

                          <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
                              <resource-adapters>
                                  <resource-adapter>
                                      <archive>
                                          jackrabbit-jca-2.2.7.rar
                                      </archive>
                                      <transaction-support>
                                          XATransaction
                                      </transaction-support>
                                      <connection-definitions>
                                          <connection-definition class-name="org.apache.jackrabbit.jca.JCAManagedConnectionFactory" jndi-name="java:/jca/DocumentStore" enabled="true" use-java-context="true" pool-name="jackrabbit-jca-2_2_7_rar-Pool" use-ccm="true">
                                              <config-property name="configFile">
                                                  /tmp/repository/repository.xml
                                              </config-property>
                                              <config-property name="bindSessionToTransaction">
                                                  false
                                              </config-property>
                                              <config-property name="homeDir">
                                                  /tmp/repository
                                              </config-property>
                                          </connection-definition>
                                      </connection-definitions>
                                  </resource-adapter>
                              </resource-adapters>
                          </subsystem>
                          

                           

                          then restart:

                           

                          7. everything looks ok? No fail log out

                          And manament information:

                           

                          [standalone@localhost:9999 resource-adapter=jackrabbit-jca-2.2.7.rar] :read-resource         
                          
                          
                          {
                          "outcome" => "success",
                          "result" => {
                          "archive" => "jackrabbit-jca-2.2.7.rar",
                          "background-validation" => undefined,
                          "background-validation-minutes" => undefined,
                          "blocking-timeout-wait-millis" => undefined,
                          "connection-definitions" => [{
                          
                          "config-properties" => {
                              
                          "configFile" => "/tmp/repository/repository.xml",
                              
                          "bindSessionToTransaction" => "false",
                              
                          "homeDir" => "/tmp/repository"
                          
                          },
                          
                          "class-name" => "org.apache.jackrabbit.jca.JCAManagedConnectionFactory",
                          
                          "jndi-name" => "java:/jca/DocumentStore",
                          
                          "pool-name" => "jackrabbit-jca-2_2_7_rar-Pool",
                          
                          "enabled" => true,
                          
                          "use-java-context" => true,
                          
                          "use-ccm" => true
                          
                          }],
                          "idle-timeout-minutes" => undefined,
                          "max-pool-size" => undefined,
                          "min-pool-size" => undefined,
                          "pool-prefill" => undefined,
                          "pool-use-strict-min" => undefined,
                          "transaction-support" => "XATransaction",
                          "use-fast-fail" => undefined
                          }
                          }
                          

                           

                          Did I miss something?

                          Could you give me more infomation about the issue?

                          • 10. Re: JBoss 7: how to deploy with JCA?
                            Brian Wallis Master

                            I just downloaded the August 5th nightly build and it is working now as it should. So thanks to whoever fixed it since the last build I downloaded (2nd I think).

                             

                            Now that is what I call service :-)

                            • 11. Re: JBoss 7: how to deploy with JCA?
                              Jeff Zhang Newbie

                              That's greate news.

                              I will close 1452 JIRA, any issues, please let's know.

                              Cheers

                              • 12. Re: JBoss 7: how to deploy with JCA?
                                yudong Newbie

                                Thanx everyone for sharing.

                                 

                                Where can I download 7.1.0.Alpha?

                                • 14. Re: JBoss 7: how to deploy with JCA?
                                  slawek t Novice

                                  Hi,

                                  I followed the instructions described here, and my jackrabbit-jca-2.2.7.rar was successfully deployed in jboss as7 (7.0.1), but I don't know how to connect to that from my webapp.

                                  The snippet of my code looks like this:

                                   

                                  InitialContext nameCtx;

                                          repository = null;

                                          try {

                                              nameCtx = new InitialContext( );

                                              repository = ( JCARepositoryHandle ) nameCtx.lookup( "java:/jboss/jcr/Documents" );

                                          }

                                          catch ( NamingException e1 ) {

                                                      ...

                                          }

                                   

                                  The problem is with instantiating JCARepositoryHandle class, and I tested 2 scenarious:

                                   

                                  1. Library jackrabbit-jca-2.2.7.jar is located in WEB-INF/lib folder in my webapp  -> two classloaders load the library what causes the issue with casting

                                   

                                  stacktrace

                                  ...

                                  Caused by: java.lang.ClassCastException: org.apache.jackrabbit.jca.JCARepositoryHandle cannot be cast to org.apache.jackrabbit.jca.JCARepositoryHandle

                                          at pl.squap.dmslight.server.misc.JackrabbitManager.<init>(JackrabbitManager.java:29) [classes:]

                                          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0_23]

                                          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [:1.6.0_23]

                                          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [:1.6.0_23]

                                          at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [:1.6.0_23]

                                          at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126) [spring-beans-3.0.5.RELEASE.jar:]

                                          ... 23 more

                                   

                                  2. Folder WEB-INF/lib has no jackrabbit-jca-2.2.7.jar -> No library in webapp scope

                                   

                                  stacktrace

                                  ...

                                  Caused by: java.lang.NoClassDefFoundError: org/apache/jackrabbit/jca/JCARepositoryHandle

                                          at pl.squap.dmslight.server.misc.JackrabbitManager.<init>(JackrabbitManager.java:29) [classes:]

                                          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0_23]

                                          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [:1.6.0_23]

                                          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [:1.6.0_23]

                                          at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [:1.6.0_23]

                                          at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126) [spring-beans-3.0.5.RELEASE.jar:]

                                          ... 23 more

                                   

                                  I understand I need to share jackrabbit-jca-2.2.7.jar for all webapp (including mine) but I don't know how to do that.

                                  How can I do that?

                                   

                                  Slawek

                                  1 2 Previous Next