Hi all,

I'm evaluating jBoss 2.0-FINAL. Basic session and entity EJBs are working fine.
I like the feel of the system a lot and am really rooting for it. However, I've
run into something I can't figure out:

I have a session EJB ("PersonClient") and an entity EJB ("Person"). Both are
deployed with transactions = required. PersonClient has a single method which,
by way of demonstrating and testing EJB-to-EJB transaction propagation, creates
a Person, saves its primary key information, discards its reference to it and
looks it up again with findByPrimaryKey. All of the methods on the EJB
implementations write a line to the log so I can see when a method is called
and on which instance. I see instance 1 created and ejbCreate called on it,
then instance 2 created and findByPrimaryKey called on it. After the
implementation of findByPrimaryKey runs, but before control returns to
PersonClient, ejbStore is called on instance 1. I'm not clear on why that
happens -- by that point instance 1 has already been persisted in ejbCreate,
and everybody ought to be in a single transaction, so there's no need to
ejbStore. Anyway, ejbStore runs an SQL update and checks the return value of
PreparedStatement.executeUpdate to see if one and only one row has been updated
as I'd expect. Instead no rows are updated; apparently there are no rows in the
table with the right ID. Help! Where did my row go?

I'm using Oracle (8.1.7), so I set sql_trace=true and looked at that log. The
insert, select and update statements from ejbCreate, findByPrimaryKey and
ejbStore respectively are there, in that order. As a bonus, each is
preceded by a JAVA_XA.xa_start_new and followed by a JAVA_XA.xa_end_new. I
don't really know what those are, but if they're transaction boundaries I'd
have expected only one of each.

Final data points: These EJBs worked as I expected in a couple of other EJB
servers (Voyager and Oracle) -- same Java, different deployment goop. The same
sequence of calls to Person works as I expect when I do it in a main() on the
client side -- in fact, it's in a single static method (with a PersonHome as a
parameter) which I call from the plain client and from the PersonClient EJB.
When done on the client side each call to Person is in its own transaction,
but at least they work.

Any insight would be appreciated. Cheers!

Now for all of the configuration stuff. Oracle's classes12.zip is in lib/ext.

=== the possibly relevant bit of jboss.conf ===
<MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
    <ARG TYPE="java.lang.String" VALUE="datasource">
    <ARG TYPE="java.lang.String" VALUE="oracle.jdbc.xa.client.OracleXADataSource">
</MLET>
=== ditto of jboss.properties ===
jboss.xa.xidclass=oracle.jdbc.xa.OracleXid
jdbc.drivers=org.hsql.jdbcDriver,org.enhydra.instantdb.jdbc.idbDriver,oracle.jdbc.driver.OracleDriver
=== ditto of jboss.jcml ===
     <mbean name="DefaultDomain:service=XADataSource,name=datasource">
       <attribute name="Properties"></attribute>
       <attribute name="URL">jdbc:oracle:thin:@funes:1521:funes</attribute>
       <attribute name="GCMinIdleTime">1200000</attribute>
       <attribute name="JDBCUser">schweidc</attribute>
       <attribute name="MaxSize">0</attribute>
       <attribute name="Password">schweidc</attribute>
       <attribute name="GCEnabled">false</attribute>
       <attribute name="InvalidateOnError">false</attribute>
       <attribute name="TimestampUsed">false</attribute>
       <attribute name="Blocking">true</attribute>
       <attribute name="GCInterval">120000</attribute>
       <attribute name="IdleTimeout">1800000</attribute>
       <attribute name="IdleTimeoutEnabled">false</attribute>
       <attribute name="LoggingEnabled">false</attribute>
       <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
       <attribute name="MinSize">0</attribute>
     </mbean>
=== ejb-jar.xml ===
<?xml version="1.0"?>
<ejb-jar>
   <enterprise-beans>
      <entity>
         <ejb-name>com.apldbio.core.ejb.example.IPersonHome</ejb-name>
         <home>com.apldbio.core.ejb.example.IPersonHome</home>
         <remote>com.apldbio.core.ejb.example.IPerson</remote>
         <ejb-class>com.apldbio.core.ejb.example.LoggingFastPersonEJB</ejb-class>
         <persistence-type>Bean</persistence-type>
         <prim-key-class>com.apldbio.core.ejb.example.PersonPK</prim-key-class>
         <reentrant>False</reentrant>
         <env-entry>
            <env-entry-name>datasourcename</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>datasource</env-entry-value>
         </env-entry>
         <resource-ref>
           <res-ref-name>jdbc/datasource</res-ref-name>
           <res-type>javax.sql.DataSource</res-type>
           <res-auth>Container</res-auth>
         </resource-ref>
      </entity>
      <session>
         <ejb-name>com.apldbio.core.ejb.example.IPersonClientHome</ejb-name>
         <home>com.apldbio.core.ejb.example.IPersonClientHome</home>
         <remote>com.apldbio.core.ejb.example.IPersonClient</remote>
         <ejb-class>com.apldbio.core.ejb.example.PersonClientEJB</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>
         <env-entry>
            <env-entry-name>datasourcename</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>datasource</env-entry-value>
         </env-entry>
         <resource-ref>
           <res-ref-name>jdbc/datasource</res-ref-name>
           <res-type>javax.sql.DataSource</res-type>
           <res-auth>Container</res-auth>
         </resource-ref>
         <ejb-ref>
            <ejb-ref-name>ejb/com.apldbio.core.ejb.example.IPersonHome</ejb-ref-name>
            <ejb-ref-type>Entity</ejb-ref-type>
            <home>com.apldbio.core.ejb.example.IPersonHome</home>
            <remote>com.apldbio.core.ejb.example.IPerson</remote>
            <ejb-link>com.apldbio.core.ejb.example.IPersonHome</ejb-link>
         </ejb-ref>
      </session>
   </enterprise-beans>
   <assembly-descriptor>
      <container-transaction>
         <method>
            <ejb-name>com.apldbio.core.ejb.example.IPersonHome</ejb-name>
            <method-name>*</method-name>
         </method>
         <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>
         <method>
            <ejb-name>com.apldbio.core.ejb.example.IPersonClientHome</ejb-name>
            <method-name>*</method-name>
         </method>
         <trans-attribute>Required</trans-attribute>
      </container-transaction>
   </assembly-descriptor>
</ejb-jar>
=== jboss.xml ===
<?xml version="1.0"?>                                                 
<jboss>
  <enterprise-beans>
    <entity>
      <ejb-name>com.apldbio.core.ejb.example.IPersonHome</ejb-name>
      <jndi-name>com.apldbio.core.ejb.example.IPersonHome</jndi-name>
      <resource-ref>
         <res-ref-name>jdbc/datasource</res-ref-name>
         <resource-name>datasource</resource-name>
      </resource-ref>
    </entity>
    <session>
      <ejb-name>com.apldbio.core.ejb.example.IPersonClientHome</ejb-name>
      <jndi-name>com.apldbio.core.ejb.example.IPersonClientHome</jndi-name>
      <resource-ref>
         <res-ref-name>jdbc/datasource</res-ref-name>
         <resource-name>datasource</resource-name>
      </resource-ref>
    </session>
  </enterprise-beans>
  <resource-managers>
    <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
       <res-name>datasource</res-name>
       <res-jndi-name>datasource</res-jndi-name>
    </resource-manager>
  </resource-managers>
</jboss>
======

-- 
| Dave Schweisguth                       http://www.schweisguth.org/~dave/ |
| Home: [EMAIL PROTECTED]          Work: [EMAIL PROTECTED] |
| For compliance with the NJ Right to Know Act: Contents partially unknown |


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to