>From My earlier post you can see that I got castor JDO to work with JBosss 3.0.3
with MSSQLServer

Here is the method:

Before implementing this method. Please note that there is an error returned by the 
connection
manager on the second invocation of a method. There is some kind of connection sharing
violation that I will discuss at the bottom.

Step 0 install the JDBC Driver from Microsoft on the host machine.
        Don't forget to run the script that creates the stored procedures.

Step 1: Establish a XATxConectionManager mbean in Jboss by copying the 
mssql-xa-service.xml
file from the jboss examples to the deploy directory. 
1.a Change the XADataSourceProperties to your host and database.
1.b uncomment the following line to use the the MSSQLXaDbRealm:
        <attribute name="SecurityDomainJndiName">MSSQLXaDbRealm</attribute>
1.c Include the following section in conf/login-conf.xml:
    <application-policy name = "MSSQLXaDbRealm">
       <authentication>
          <login-module code = 
"org.jboss.resource.security.ConfiguredIdentityLoginModule" flag ="required">
             <module-option name = "principal">yourprincipal</module-option>
             <module-option name = "userName">yourusername</module-option>
             <module-option name = "password">yourpassword</module-option>
             <module-option name = 
"managedConnectionFactoryName">jboss.jca:service=XATxCM,name=MSSQLXaDS</module-option>
          </login-module>
       </authentication>
    </application-policy>

Step2 add the following mbean at the bottom of xssql-xa-service.xml
  <mbean code="org.jboss.jdo.castor.CastorJDOImpl"  
name="jboss:service=CastorJDO,name=castorModel">
    <attribute name="Configuration">file:../server/sms3/conf/database.xml</attribute>
    <attribute name="JndiName">castorModel</attribute>
    <attribute name="LockTimeout">10000</attribute>
    <attribute name="LoggingEnabled">true</attribute>
    <attribute name="CommonClassPath">false</attribute>
    <attribute name="AutoStore">false</attribute>
  </mbean>  

Step3: add the following entries to the ejbBean and use XDoclet to create the ejb-jar 
and jboss.xml files
 * @ejb:resource-ref res-name="jdo/modelJDO"
 *                   res-type="org.exolab.castor.jdo.DataObjects"
 *                   res-auth="Container"
 *
 * @jboss:resource-ref  res-ref-name="jdo/modelJDO"
 *                      resource-name="CastorModelJDO"
 *
 * @jboss:resource-manager res-man-class="org.jboss.ejb.deployment.CastorJDOResource"
 *                         res-man-name="CastorModelJDO"
 *                         res-man-jndi-name="java:/castorModel"

Step4: use the following lookup in the database.xml
<database name="mssql" engine="sql-server" >
    <jndi name="java:/MSSQLXaDS"/>
    <mapping href="mapping.xml" />
</database>
Don'f forget to copy the mapping.xml and database.xml file to the conf directory.
Note that the new structure for 3.0 in Jboss is that the default or new or minimal 
directory
should be coppied to a new "yourname" directory. The conf and deploy directories for 
your
domain are located within that directory.

The Problem:
The problem is that I am getting an exception on the second call to a function in 
CastorHelper
the exception is Caused by: javax.resource.ResourceException: associateConnection not 
supported
        at 
org.jboss.resource.adapter.jdbc.BaseManagedConnection.associateConnection(BaseManagedConnection.java:91)
        at 
org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnect(BaseConnectionManager2.java:594)
        at 
org.jboss.resource.connectionmanager.CachedConnectionManager.reconnect(CachedConnectionManager.java:344)
        at 
org.jboss.resource.connectionmanager.CachedConnectionManager.pushMetaAwareObject(CachedConnectionManager.java:140)
        at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:183)
        at 
org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:266)
        at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)
        at 
org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java:380)
        at org.jboss.ejb.Container.invoke(Container.java:712)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
        at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
        at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
        at 
org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
        at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
        at 
org.jboss.proxy.ejb.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:117)
        at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)

There is some discussion at JBoss about this and it is not clear if there is a JBoss 
bug or
if there is some kind of usage problem involving holding onto a handle between 
invocations to
the ejb.

Please help.

Ron

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to