4 Replies Latest reply on Jul 10, 2007 6:13 AM by vickyk

    Resource adapter deployment problem

    xaleyba

      Hi All

      I've created a jca resource adapter that will allow clients connect to IBM host applications through telnet3270.

      I defined my ra as follows:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE connector PUBLIC '-//Sun Microsystems, Inc.//DTD Connector
      1.0//EN' 'http://java.sun.com/dtd/connector_1_0.dtd'>
      
      <connector>
       <display-name>CometResourceAdapter</display-name>
       <vendor-name>BancSabadell</vendor-name>
       <spec-version>1.5</spec-version>
       <eis-type>CicsSocket</eis-type>
       <version>1.0</version>
       <resourceadapter>
       <managedconnectionfactory-
      class>com.bs.cds.jca.CdsManagedConnectionFactoryImpl</
      managedconnectionfactory-class>
       <connectionfactory-interface>javax.resource.cci.ConnectionFactory</
      connectionfactory-interface>
       <connectionfactory-impl-
      class>com.bs.cds.jca.CdsConnectionFactoryImpl</connectionfactory-impl-
      class>
       <connection-interface>javax.resource.cci.Connection</connection-
      interface>
       <connection-impl-class>com.bs.cds.jca.CdsConnection</connection-impl-
      class>
       <transaction-support>NoTransaction</transaction-support>
       </resourceadapter>
      </connector>
      
      



      But when I deployed it in my JBoss I receive the error:


      org.jboss.deployment.DeploymentException: Error parsing meta data
      jar:file:/D:/j
      boss/server/jcara/tmp/deploy/tmp34080com.bs.cds.jca.ra-0.0.1.rar!/META-
      INF/ra.xm
      l; - nested throwable: (org.jboss.xb.binding.JBossXBException: Failed
      to parse s
      ource.)
       at
      org.jboss.deployment.DeploymentException.rethrowAsDeploymentException
      (DeploymentException.java:39)
       at
      org.jboss.deployment.ObjectModelFactorySimpleSubDeployerSupport.parse
      MetaData(ObjectModelFactorySimpleSubDeployerSupport.java:41)
       at
      org.jboss.deployment.SimpleSubDeployerSupport.init(SimpleSubDeployerS
      upport.java:73)
       at org.jboss.deployment.MainDeployer.init(MainDeployer.java:
      843)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:
      780)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:
      753)
       at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown
      Source)
       at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at
      org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at
      org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at
      org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at
      org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:245)
       at
      org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:
      176)
       at $Proxy9.deploy(Unknown Source)
       at
      org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
      tScanner.java:319)
       at
      org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
      canner.java:507)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner
      $ScannerThread.
      doScan(AbstractDeploymentScanner.java:192)
       at
      org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(A
      bstractDeploymentScanner.java:265)
       at
      org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
      upport.java:274)
       at
      org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
      eanSupport.java:230)
       at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
       at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at
      org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java: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.
      java:245)
       at
      org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController
      $ServiceProxy.invoke(ServiceControl
      ler.java:943)
       at $Proxy0.start(Unknown Source)
       at
      org.jboss.system.ServiceController.start(ServiceController.java:428)
       at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
       at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at
      org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java: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.
      java: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 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 org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:
      737)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
       at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at
      org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at
      org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at
      org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at
      org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:245)
       at
      org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:
      176)
       at $Proxy5.deploy(Unknown Source)
       at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:
      453)
       at org.jboss.system.server.ServerImpl.start(ServerImpl.java:
      330)
       at org.jboss.Main.boot(Main.java:187)
       at org.jboss.Main$1.run(Main.java:438)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse
      source.
       at
      org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBPars
      er.java:125)
       at
      org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java
      :150)
       at
      org.jboss.deployment.ObjectModelFactorySimpleSubDeployerSupport.parse
      MetaData(ObjectModelFactorySimpleSubDeployerSupport.java:37)
       ... 68 more
      Caused by: java.lang.IllegalArgumentException: Unknown connector
      newChild: nuri=
       localName=managedconnectionfactory-class
      attrs=org.apache.xerces.parsers.Abstra
      ctSAXParser$AttributesProxy@cc9d70
       at
      org.jboss.resource.deployment.ResourceAdapterObjectModelFactory.newCh
      ild(ResourceAdapterObjectModelFactory.java:162)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
       at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at
      org.jboss.xb.binding.ObjectModelBuilder.invokeFactory(ObjectModelBuil
      der.java:421)
       at
      org.jboss.xb.binding.DelegatingObjectModelFactory.newChild(Delegating
      ObjectModelFactory.java:78)
       at
      org.jboss.xb.binding.ObjectModelBuilder.startElement(ObjectModelBuild
      er.java:323)
       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser
      $DelegatingContentHan
      dler.startElement(SaxJBossXBParser.java:217)
       at
      org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
      ce)
       at
      org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Sourc
      e)
       at
      org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
      own Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
      $FragmentContent
      Dispatcher.dispatch(Unknown Source)
       at
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
      known Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
      Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
      Source)
       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
      Source)
       at org.apache.xerces.jaxp.SAXParserImpl
      $JAXPSAXParser.parse(Unknown Sour
      ce)
       at
      org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBPars
      er.java:121)
       ... 70 more
      
      


      I wonder if someone could give me a clue about the origin of the
      problem. I think my ra.xml is well defined and my
      managedconnectionfactory-class too.

      Thanks in advance

      J



        • 1. Re: Resource adapter deployment problem

          You've using the 1.0 xml, but spec-version="1.5". Why?

          Choose which one you want (probably spec-version="1.0")
          the xml is different according to the spec version.

          For 1.5, you would need to add "outbound-resourceadapter"
          and "connection-definition" elements.

          e.g. From one of the jboss rars

          <connector xmlns="http://java.sun.com/xml/ns/j2ee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
           http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
           version="1.5">
          
           <description>JBoss Resource Adapter for JDBC 3 XA drivers</description>
           <display-name>JBoss JDBC XATransaction ResourceAdapter</display-name>
          
           <vendor-name>JBoss, Inc</vendor-name>
           <eis-type>JDBC 3.0 XA Relational Database</eis-type>
           <resourceadapter-version>5.0</resourceadapter-version>
          
           <license>
           <description>
           JBoss, Home of Professional Open Source
           Copyright 2005, JBoss Inc., and individual contributors as indicated
           by the @authors tag. See the copyright.txt in the distribution for a
           full listing of individual contributors.
          
           This is free software; you can redistribute it and/or modify it
           under the terms of the GNU Lesser General Public License as
           published by the Free Software Foundation; either version 2.1 of
           the License, or (at your option) any later version.
          
           This software is distributed in the hope that it will be useful,
           but WITHOUT ANY WARRANTY; without even the implied warranty of
           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
           Lesser General Public License for more details.
          
           You should have received a copy of the GNU Lesser General Public
           License along with this software; if not, write to the Free
           Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
           02110-1301 USA, or see the FSF site: http://www.fsf.org.
           </description>
           <license-required>true</license-required>
           </license>
          
           <resourceadapter>
           <resourceadapter-class>org.jboss.resource.deployment.DummyResourceAdapter</resourceadapter-class>
          
           <outbound-resourceadapter>
           <connection-definition>
           <managedconnectionfactory-class>org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory</managedconnectionfactory-class>
          etc.
          


          From the parsing code (where it is failing):
           else if (localName.equals("connection-definition") ||
           (localName.equals("resourceadapter") && cmd.getVersion().equals("1.0")))
           {
           ConnectionDefinitionMetaData cdmd = new ConnectionDefinitionMetaData(cmd);
           cmd.addConnectionDefinition(cdmd);
           return cdmd;
           }
          


          cmd.getVersion() is the spec-version in your xml.

          • 2. Re: Resource adapter deployment problem
            xaleyba

            It work !


            Thank you !

            J

            • 3. Re: Resource adapter deployment problem
              xaleyba

              Hi

              I've just one more doubt.

              I've seen many examples about how to offer my JCA resource adapter via JNDI.

              I saw that with JBoss, database datasources are offered via a configured datasource xml file, but as my ra is not sql related, I wonder how could I offer it via jndi in JBoss.

              Thanks in advance

              J

              • 4. Re: Resource adapter deployment problem
                vickyk

                Look at sample application explained here
                http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch7.chapt.html#d0e15145
                You would notice the binding done by using the <connection-factories> tag as

                <!DOCTYPE connection-factories PUBLIC
                 "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
                 "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
                <!--
                 The non-transaction FileSystem resource adaptor service configuration
                -->
                <connection-factories>
                 <no-tx-connection-factory>
                 <jndi-name>NoTransFS</jndi-name>
                 <rar-name>chap7-ex1.rar</rar-name>
                 <connection-definition>
                 org.jboss.chap7.ex1.ra.DirContextFactory
                 </connection-definition>
                 <config-property name="FileSystemRootDir"
                 type="java.lang.String">/tmp/db/fs_store</config-property>
                 </no-tx-connection-factory>
                </connection-factories>

                Look at the jndi-name at the above contents .