Hello,

I'm trying to port this J2EE module to Geronimo1.2, but I'm not familiar 
with EJB's, so I might be missing something obvious. 

[...]

I managed to deploy both our resource adapter to a connection factory (as 
a RAR file), and our sample session (JAR+EJB). 

I can start running the sample, but from it I can't get a connection to 
the ConnectionFactory.

From "12.3.6 Resolving References from EJBs" at  
<http://www.chariotsolutions.com/geronimo/geronimo-1.1/ejb-structure.html> 
I gather that on Geronimo (differently from JBoss) after deploying the 
RAR, in order to be able to find it from my sample app, I need to declare 
it as a resource-ref at the sample's "openejb-jar.xml" and "ejb-jar.xml".  
Is this correct? 

If so, how should I do this? I managed to declare a resource-ref on 
openejb-jar.xml, but not on the ejb-jar.xml.

On the openejb-jar.xml, I have:

""""
      <session>
         <ejb-name>XhiveSampleSessionBean</ejb-name>
         <jndi-name>com.xhive.ejb.XhiveSampleSessionEJB</jndi-name>
         <ejb-ref>
            <ref-name>ejb/XhiveDS</ref-name>
            <ejb-link>XhiveDS</ejb-link>
         </ejb-ref>
      </session>
""""

What should I add to ejb-jar.xml?

I've tried adding something like
"""
    <session>
      <ejb-name>XhiveSampleSessionBean</ejb-name>
        [....]      
      <resource-ref>
              <res-ref-name>ejb/XhiveDS</res-ref-name>
             <res-type>
                        
com.xhive.j2ee.connector.interfaces.XhiveCCIConnectionFactoryIf
            </res-type>
     </resource-ref>
     </session>
"""
 
But with this last change the Sample EJB won't deploy. For clarity, I'm 
attaching the 4 xml files I'm using for RAR and EJB+JAR deployment.

Any hints, or tips are heartily appreciated,

Cheers,
-- 
Francisco Borges


<?xml version="1.0" encoding="UTF-8"?>
<!--websphere-->
<!DOCTYPE connector PUBLIC "-//Sun Microsystems, Inc.//DTD Connector 1.0//EN" "http://java.sun.com/dtd/connector_1_0.dtd";>
<!--others-->
<!--<!DOCTYPE connector PUBLIC '-//Sun Microsystems, Inc.//DTD Connector 1.0//EN' 'http://java.sun.com/j2ee/dtds/connector_1_0.dtd'>-->

<connector>  
  <display-name>XhiveConnector</display-name>
  <description>XHive/DB Connector</description>
  <vendor-name>X-Hive Corporation</vendor-name>  
  <spec-version>1.0</spec-version>
  <eis-type>XHive/DB</eis-type> 
  <version>3.0</version>   
  <resourceadapter>
    <managedconnectionfactory-class>com.xhive.j2ee.connector.XhiveManagedConnectionFactory</managedconnectionfactory-class>    
    <connectionfactory-interface>com.xhive.j2ee.connector.interfaces.XhiveCCIConnectionFactoryIf</connectionfactory-interface>
    <connectionfactory-impl-class>com.xhive.j2ee.connector.XhiveCCIConnectionFactory</connectionfactory-impl-class>
    <connection-interface>com.xhive.j2ee.connector.interfaces.XhiveCCIConnectionIf</connection-interface>
    <connection-impl-class>com.xhive.j2ee.connector.XhiveCCIConnection</connection-impl-class>
    <transaction-support>XATransaction</transaction-support>
<!--    <transaction-support>LocalTransaction</transaction-support> -->
    <config-property>
      <config-property-name>DatabaseName</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>MyDatabase</config-property-value>
    </config-property>
    <config-property>
      <config-property-name>UserName</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>Administrator</config-property-value>
    </config-property>
    <config-property>
      <config-property-name>Password</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>secret</config-property-value>
    </config-property>
    <config-property>
      <config-property-name>BootstrapLocation</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>/home/borges/workspace/xhive_0/data/XhiveDatabase.bootstrap</config-property-value>
    </config-property>
    <config-property>
      <config-property-name>LogLevel</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>1</config-property-value>
    </config-property>
    <config-property>
      <config-property-name>WaitOption</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>WAIT</config-property-value>
    </config-property>
    <config-property>
      <config-property-name>CachePages</config-property-name>
      <config-property-type>java.lang.String</config-property-type> 
      <config-property-value>1024</config-property-value> 
    </config-property>            
    <config-property>
      <config-property-name>ReadOnlyMode</config-property-name>
      <config-property-type>java.lang.String</config-property-type> 
      <config-property-value>false</config-property-value> 
    </config-property>            
    <authentication-mechanism>
      <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
      <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
    </authentication-mechanism>
    <reauthentication-support>false</reauthentication-support>
  </resourceadapter>
</connector>
<connector version="1.5" xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1";>
   <environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1";>
      <moduleId>
         <groupId>X-Hive</groupId>
         <artifactId>xhive-ra</artifactId>
         <version>1.0</version>
         <type>rar</type>
      </moduleId>
      <dependencies>
         <dependency>
            <groupId>X-Hive</groupId>
            <artifactId>xhivedb</artifactId>
            <version>8.0</version>
            <type>jar</type>
         </dependency>
      </dependencies>
      <dep:hidden-classes/>
      <dep:non-overridable-classes/>
   </environment>
   
   <resourceadapter>

      <outbound-resourceadapter>
         <connection-definition>
            
            <connectionfactory-interface>
               com.xhive.j2ee.connector.interfaces.XhiveCCIConnectionFactoryIf
            </connectionfactory-interface>

            <connectiondefinition-instance>
               <name>XhiveDS</name>
               <implemented-interface>
                  com.xhive.j2ee.connector.XhiveCCIConnection
               </implemented-interface>

<config-property-setting name="DatabaseName">MyDatabase</config-property-setting>
<config-property-setting name="UserName">Administrator</config-property-setting>
<config-property-setting name="Password">secret</config-property-setting>
<config-property-setting name="BootstrapLocation">/home/borges/workspace/xhive_0/data/XhiveDatabase.bootstrap</config-property-setting>
<config-property-setting name="LogLevel">1</config-property-setting>
<config-property-setting name="WaitOption">1000</config-property-setting>
<config-property-setting name="CachePages">1024</config-property-setting>
<config-property-setting name="ReadOnlyMode">false</config-property-setting>

               <connectionmanager>
	        <xa-transaction>
                    <transaction-caching/>
                </xa-transaction>
                  <single-pool>
                     <max-size>10</max-size>
                     <min-size>0</min-size>
                     <blocking-timeout-milliseconds>
                        500000
                     </blocking-timeout-milliseconds>
                     <idle-timeout-minutes>30</idle-timeout-minutes>
                     <match-one/>
                  </single-pool>
               </connectionmanager>

            </connectiondefinition-instance>
         </connection-definition>
   </outbound-resourceadapter>

   </resourceadapter>
</connector>
<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1";>
   
   <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1";>
      <dep:moduleId>
         <groupId>X-Hive</groupId>
         <artifactId>SampleSession</artifactId>
         <version>1.0</version>
         <type>rar</type>
      </dep:moduleId>
      
      <dep:dependencies>
         <dep:dependency>
            <dep:groupId>X-Hive</dep:groupId>
            <dep:artifactId>xhive-ra</dep:artifactId>
         </dep:dependency>
      </dep:dependencies>
      
      <dep:hidden-classes/>
      <dep:non-overridable-classes/>
      
   </dep:environment>
   <enterprise-beans>
      <session>
         <ejb-name>XhiveSampleSessionBean</ejb-name>
         <jndi-name>com.xhive.ejb.XhiveSampleSessionEJB</jndi-name>
         
<!--         <ejb-ref>
            <ref-name>ejb/XhiveSampleSessionBean</ref-name>
            <ejb-link>XhiveSampleSessionBean</ejb-link>
         </ejb-ref>
-->
         
         <ejb-ref>
            <ref-name>ejb/XhiveDS</ref-name>
            <ejb-link>XhiveDS</ejb-link>
         </ejb-ref>

      </session>
   </enterprise-beans>
   
</openejb-jar>
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>

<ejb-jar>
   <enterprise-beans>
    <session>
      <ejb-name>XhiveSampleSessionBean</ejb-name>
      <home>com.xhive.ejb.XhiveSampleSessionHome</home>
      <remote>com.xhive.ejb.XhiveSampleSession</remote>
      <ejb-class>com.xhive.ejb.XhiveSampleSessionEJB</ejb-class>
      <session-type>Stateful</session-type>
      <transaction-type>Container</transaction-type>
      <resource-ref>
      <res-ref-name>ejb/XhiveDS</res-ref-name>
      <res-type>com.xhive.j2ee.connector.interfaces.XhiveCCIConnectionFactoryIf</res-type>
     </resource-ref>
     </session>
  </enterprise-beans>

  <assembly-descriptor>
    <container-transaction>
      <method>
        <ejb-name>XhiveSampleSessionBean</ejb-name>
        <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
    </container-transaction>
  </assembly-descriptor>
</ejb-jar>

Reply via email to