4 Replies Latest reply on Jun 26, 2012 10:23 AM by slowdive

    NameNotFoundException for a RAR in an EAR

    slowdive

      Hello,

       

      I have an application that deploys to Weblogic, and I am trying to port it over to JBoss as well.

       

      I am using AS 7.1.1.Final, java version 1.7.0_03

       

      The application deploys fine, but when I make a call to it, I get this error:

           12:03:46,289 ERROR [stderr] (http--127.0.0.1-8080-4) javax.naming.NameNotFoundException: jca/exampleCon -- service jboss.naming.context.java.jca.exampleCon

       

      In my jboss-app.xml, I have

           <connection-definition class-name="com.ex.connector.ra.outbound.ExampleConnectionFactoryImpl"

                                  jndi-name="java:/jca/exampleCon" enabled="true" use-java-context="true" pool-name="exampleConPool" use-ccm="true">

       

      In my java code I have:

           Context context = new InitialContext();

           ConnectionFactory cxFactory = (ConnectionFactory) context.lookup("jca/exampleCon");

       

      Any help is greatly appreciated!

        • 1. Re: NameNotFoundException for a RAR in an EAR
          jaikiran

          Welcome to the forums!

          slowdive wrote:

           

          In my jboss-app.xml, I have

               <connection-definition class-name="com.ex.connector.ra.outbound.ExampleConnectionFactoryImpl"

                                      jndi-name="java:/jca/exampleCon" enabled="true" use-java-context="true" pool-name="exampleConPool" use-ccm="true">

           

          jboss-app.xml does not support that element. What exactly does that file look like?

          • 2. Re: NameNotFoundException for a RAR in an EAR
            slowdive

            Thanks for the reply jaikiran! Sorry, that should say jboss-ra.xml.

             

            jboss-ra.xml:

             

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

                      <resource-adapters>

                                <resource-adapter>

                                          <archive>example-app-7.1.0.ear#example-resource-adapter-jboss-7.1.0.rar</archive>

                                          <!-- Resource adapter level config-property -->

                                          <transaction-support>NoTransaction</transaction-support>

                                          <connection-definitions>

                                                    <connection-definition class-name="com.ex.connector.ra.outbound.ExampleConnectionFactoryImpl"

                                                                                               jndi-name="java:/jca/exampleCon" enabled="true" use-java-context="true" pool-name="exampleConPool" use-ccm="true">

                                                              <pool>

                                                                        <prefill>false</prefill>

                                                                        <use-strict-min>false</use-strict-min>

                                                                        <flush-strategy>FailingConnectionOnly</flush-strategy>

                                                              </pool>                                                                                  

                                                              <config-property name="databaseFileName">test</config-property>

                                                              <config-property name="database">test</config-property>

                                                              <config-property name="user">un</config-property>

                                                              <config-property name="password">pass</config-property>

                                                    </connection-definition>

                                          </connection-definitions>

                                </resource-adapter>

                      </resource-adapters>

            </subsystem>

             

             

            In ra.xml:

             

            <?xml version="1.0" encoding="UTF-8"?>

            <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">

              <display-name>ExampleConnector</display-name>

              <eis-type>EXAPI</eis-type>

              <resourceadapter-version>1.0</resourceadapter-version>

              <license>

                <license-required>false</license-required>

              </license>

              <resourceadapter>

               <resourceadapter-class>com.ex.connector.ra.ExampleResourceAdapterImpl</resourceadapter-class>   

                <outbound-resourceadapter>

                  <connection-definition>

                    <managedconnectionfactory-class>com.ex.connector.ra.outbound.ExampleConnectionFactoryImpl</managedconnectionfactory-class>

                     <config-property>

                            <config-property-name>databaseFileName</config-property-name>

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

                          </config-property>

                     <config-property>

                            <config-property-name>database</config-property-name>

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

                          </config-property>

                     <config-property>

                            <config-property-name>user</config-property-name>

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

                          </config-property>

                     <config-property>

                            <config-property-name>password</config-property-name>

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

                          </config-property>

                     <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>

                     <connectionfactory-impl-class>com.ex.connector.ra.outbound.ExampleConnectionFactoryImpl</connectionfactory-impl-class>

                     <connection-interface>javax.resource.cci.Connection</connection-interface>

                     <connection-impl-class>com.ex.connector.ra.outbound.ExampleConnectionImpl</connection-impl-class>

                  </connection-definition>

                  <transaction-support>NoTransaction</transaction-support>

                  <reauthentication-support>false</reauthentication-support>

                </outbound-resourceadapter>

              </resourceadapter>

            </connector>

            • 3. Re: NameNotFoundException for a RAR in an EAR
              sergiu_pienar

              Does it say in the JBoss console that is had deployed the resource adapter and bound it to the correct name ?

               

              Sergiu

              • 4. Re: NameNotFoundException for a RAR in an EAR
                slowdive

                Thanks for the reply! I cannot remember for sure, but I do not believe it was registering. I changed a bunch of things since then, and I can't remember how I had it set up to recreate . I switched to using Ironjacamar, and it is registering now. I'm experiencing different errors now. If I cannot get them resolved, I will post another thread.