I figured it out. :) :) :)!!!

It was a naming thing with the mbean specifying the
CastorJDO. I changed it back to match the example
on the Jboss site (i.e. using the name parameter
and using castorModel rather than java:/castorModel
in the jndi namd attribute) and it worked. Woo hoo!!!

Thanks,

Ron

>  -----Original Message-----
> From:         Ron Ridenour  
> Sent: Thursday, October 24, 2002 11:59 AM
> To:   '[EMAIL PROTECTED]'
> Subject:      FW: null _jdo DataObject using JNDI lookup on JBoss-3.0.3 from ejb 
>helper class - brief version
> 
> Hi all,
> I have tried to strip down the information to the bare essential
> information for clarity and brevity.
> 
> Again any Help is greatly appreciated.
> 
> Ron.
> 
> The basic problem is that I am getting an null DataObjects
> object back from jndi on JBoss when using a lookup from
> an ejb.
> 
> ModelService is my EJB Session Bean.
> I have a web service using apache axis that
> accesses a local Service Broker that does a 
> lookup of the ejb bean using the ModelService
> Name:
> 
> Object objRef = context.lookup("ejb/sms3/ModelService");
> 
> *** In the ejbCreate of ModelService, I create a
> ModelServiceDao object. In the ModelServiceDao
> constructor I create a CastorHelper object. In
> Castor Helper constructor I try to create a 
> DataObjects using a lookup as follows:
> 
> Context compEnv = (Context) iniCtx.lookup("java:comp/env");
> _jdo = (DataObjects) compEnv.lookup("jdo/modelJDO");
> 
> jdo/modelJDO is referenced in the ejb-jar as follows
> 
> - <resource-ref>
>   <res-ref-name>jdo/modelJDO</res-ref-name> 
>   <res-type>org.exolab.castor.jdo.DataObjects</res-type> 
>   <res-auth>Container</res-auth> 
>   </resource-ref>
> 
> *** jdo/modelJDO is mapped to a resourceManager in JBoss.xml under the name 
>CastorModelJDO.
> CastorModelJDO refers to the resource jndi name
> Java:/castorModel that is defined in an mbean.
> 
> - <resource-ref>
>   <res-ref-name>jdo/modelJDO</res-ref-name> 
>   <resource-name>CastorModelJDO</resource-name> 
>   </resource-ref>
> - <resource-manager res-class="org.jboss.ejb.deployment.CastorJDOResource"> ******* 
>is this the right class????
>   <res-name>CastorModelJDO</res-name> 
>   <res-jndi-name>java:/castorModel</res-jndi-name> 
>   </resource-manager>
> 
> *** Here is the binding information for jdo/modelJDO
> 
> 15:35:38,438 INFO  [STDOUT] modelJDO: javax.naming.LinkRef:Reference Class Name: 
>javax.naming.LinkRef
> Type: LinkAddress
> Content: java:/castorModel
> 
> *** In the MBean I define a castorJDO resource under the jndi name java:/castorModel 
>as follows:
> 
>   <mbean code="org.jboss.jdo.castor.CastorJDOImpl"  name="jboss:service=CastorJDO">
>     <attribute name="Configuration">file:../server/sms3/conf/database.xml</attribute>
>     <attribute name="JndiName">java:/castorModel</attribute>
> ...</mbean>
> 
> *** in the database.xml file I reference a MSSQL 
> DataSource as follows:
> 
> <jndi name="java:/MSSQLXaDS"/>
> 
> *** I have registered the MSSQL datasource in an
> MBean as:  
> 
> <mbean code="org.jboss.resource.connectionmanager.XATxConnectionManager"
>          name="jboss.jca:service=XATxCM,name=MSSQLXaDS">
> ...</mbean>
> 
> So what's my problem (technically speaking :)
> 
> 
> I hope this is more clear and concise.
> Thanks again,
> 
> Ron
> 
>  -----Original Message-----
> From:         Ron Ridenour  
> Sent: Wednesday, October 23, 2002 5:41 PM
> To:   '[EMAIL PROTECTED]'
> Subject:      null _jdo DataObject using JNDI lookup on JBoss-3.0.3 from ejb helper 
>class
> 
> I used the rooms example by Terry Child combined with the template example from the 
>src 
> distribution to try to get Castor working with MSSQL and Jboss-3.0.3. 
> The rooms example was for 2.x so I modified it as best I could. The problem I am 
>having
> is that I am getting a null _jdo object back from the jndi lookup. any help would be
> greatly appreciated.
> 
> 
>**************************************************************************************************>
> 
> ************ The Problem ****
> 
>**************************************************************************************************
> 
>       The problem is that things look like they are bound correctly,
>       but I get a null object back from the call to: 
>       _jdo = (DataObjects) compEnv.lookup("jdo/modelJDO"); in CastorHelper()
>               
> 
>*************************************************************************************************
> 
> 
>****************************************************************************************
> Cleint code from CastorHelper:
> 
>****************************************************************************************
> 
> import org.exolab.castor.jdo.DataObjects;
> public class CastorHelper  implements java.io.Serializable {
> 
>     public DataObjects _jdo;
> 
>     public CastorHelper() {
> 
>         Context compEnv = (Context) iniCtx.lookup("java:comp/env");          
>         _jdo = (DataObjects) compEnv.lookup("jdo/modelJDO");
>         if (_jdo = =null) {
>               //********************** here is the problem ************************
>               //_jdo is null even though I did not get any Naming exceptions or
>               //any other kind of exceptions
>               //****************************************************************     
>         
>         }
>     }
> }
> 
>****************************************************************************************
> ******** Here are the XDoclet entries that are in the ModelServiceBean ejb class 
>******
> 
>****************************************************************************************
> 
>  * @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"
>  *
>  * @jboss:resource-manager res-man-class="org.jboss.ejb.deployment.JDBCResource"
>  *                         res-man-name="jdbc/castorJDBCModel"
>  *                         res-man-jndi-name="java:/jdbc/castorJDBCModel"
> 
> 
> 
>****************************************************************************************
> ********** ejb-jar.xml resulting from the above XDoclet tags.
> 
>****************************************************************************************
> - <session>
> - <description>
> - <![CDATA[ Provides services related to the administration of Models 
>ModelServiceBean Session Bean ATTENTION: Some of the XDoclet tags are hidden from 
>XDoclet by adding a "--" between @ and the namespace.
>   ]]> 
>   </description>
>   <display-name>Model Service Bean</display-name> 
>   <ejb-name>test/ModelService</ejb-name> 
>   <home>com.myco.ejb.interfaces.ModelServiceHome</home> 
>   <remote>com.myco.ejb.interfaces.ModelService</remote> 
>   <ejb-class>com.myco.ejb.session.ModelServiceBean</ejb-class> 
>   <session-type>Stateful</session-type> 
>   <transaction-type>Container</transaction-type> 
> - <resource-ref>
>   <res-ref-name>jdo/modelJDO</res-ref-name> 
>   <res-type>org.exolab.castor.jdo.DataObjects</res-type> 
>   <res-auth>Container</res-auth> 
>   </resource-ref>
>   </session>
> 
> 
> 
>****************************************************************************************
> ********** jboss.xml resulting from the above XDoclet tags.
> 
>****************************************************************************************
> - <jboss>
> - <enterprise-beans>
> - <session>
>   <ejb-name>test/ModelService</ejb-name> 
>   <jndi-name>ejb/test/ModelService</jndi-name> 
> - <resource-ref>
>   <res-ref-name>jdo/modelJDO</res-ref-name> 
>   <resource-name>CastorModelJDO</resource-name> 
>   </resource-ref>> 
>   </session>
>   </enterprise-beans>
> - <resource-managers>
> - <resource-manager res-class="org.jboss.ejb.deployment.CastorJDOResource">
>   <res-name>CastorModelJDO</res-name> 
>   <res-jndi-name>java:/castorModel</res-jndi-name> 
>   </resource-manager>
> - <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
>   <res-name>jdbc/castorJDBCModel</res-name> 
>   <res-jndi-name>java:/jdbc/castorJDBCModel</res-jndi-name> 
>   </resource-manager>
>   </resource-managers>
>   </jboss>
> 
> 
> 
> 
>****************************************************************************************
> ********** mssql-xa-service.xml for establishing a DBConnection Pool with the Castor 
>MBean at the end
> 
>****************************************************************************************
>   <mbean code="org.jboss.resource.connectionmanager.XATxConnectionManager"
>          name="jboss.jca:service=XATxCM,name=MSSQLXaDS">
> 
> 
>     <!-- For optional container managed security, include a login module 
>          configuration named MSSQLXaDbRealm in conf/login-conf.xml. 
>          Here is an example login module configuration for a 
>ConfiguredIdentityLoginModule:
> 
>     <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>
> 
>     NOTE: the application-policy name attribute must match SecurityDomainJndiName, 
>and the 
>       module-option name = "managedConnectionFactoryName"
>     must match the object name of the ConnectionManager you are configuring here.
>     -->
>     <!--uncomment this line if you are using the MSSQLXaDbRealm above 
>     <attribute name="SecurityDomainJndiName">MSSQLXaDbRealm</attribute>
>     -->
> 
>     <depends optional-attribute-name="ManagedConnectionFactoryName">
>       <!--embedded mbean-->
>       <mbean code="org.jboss.resource.connectionmanager.RARDeployment"
>              name="jboss.jca:service=XATxDS,name=MSSQLXaDS">
> 
>         <attribute name="JndiName">MSSQLXaDS</attribute>
> 
>         <!--real attributes-->
>         <attribute name="ManagedConnectionFactoryProperties">
>           <properties>
>             <config-property name="XADataSourceProperties" 
>type="java.lang.String">ServerName=localhost;DatabaseName=testDB;SelectMethod=cursor</config-property>
> 
>             <config-property name="XADataSourceClass" 
>type="java.lang.String">com.microsoft.jdbcx.sqlserver.SQLServerDataSource</config-property>
>           </properties>
>         </attribute>
>         <!--hack-->
>         <depends 
>optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Minerva
> JDBC XATransaction ResourceAdapter</depends>
> 
>       </mbean>
>     </depends>
>     <depends optional-attribute-name="ManagedConnectionPool">
>       <!--embedded mbean-->
>       <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool"
>              name="jboss.jca:service=XATxPool,name=MSSQLXaDS">
> 
>         <attribute name="MinSize">0</attribute>
>         <attribute name="MaxSize">50</attribute>
>         <attribute name="BlockingTimeoutMillis">5000</attribute>
>         <attribute name="IdleTimeoutMinutes">15</attribute>
>         <!--criteria indicates if Subject (from security domain) or app supplied
>             parameters (such as from getConnection(user, pw)) are used to distinguish
>             connections in the pool. Choices are > 
>             ByContainerAndApplication (use both), 
>             ByContainer (use Subject),
>             ByApplication (use app supplied params only),
>             ByNothing (all connections are equivalent, usually if adapter supports
>               reauthentication)-->
>         <attribute name="Criteria">ByContainer</attribute>
>       </mbean>
>     </depends>
>     <depends 
>optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
> 
> 
>     <depends 
>optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager</depends>
> 
>     <attribute name="TransactionManager">java:/TransactionManager</attribute>
> 
>     <!--make the rar deploy! hack till better deployment-->
>     <depends>jboss.jca:service=RARDeployer</depends>
>   </mbean>
>   
>   <mbean code="org.jboss.jdo.castor.CastorJDOImpl"  name="jboss:service=CastorJDO">
>     <attribute name="Configuration">file:../server/sms3/conf/database.xml</attribute>
>     <attribute name="JndiName">java:/castorModel</attribute>
>     <attribute name="LockTimeout">10000</attribute>
>     <attribute name="LoggingEnabled">true</attribute>
>     <attribute name="CommonClassPath">false</attribute>
>     <attribute name="AutoStore">false</attribute>
>   </mbean>  
>   
>   
> 
>****************************************************************************************
> ********** database.xml specified in the MBean above references the MSSQLXaDS bound 
>above
> 
>****************************************************************************************
>   <database name="mssql" engine="sql-server" >
>       <jndi name="java:/MSSQLXaDS"/>
>       <mapping href="mapping.xml" />
>   </database>
>   
>   
> 
>****************************************************************************************
> ********** jndi bindings printed at runtime before 
> ********** I invoke _jdo = (DataObjects) compEnv.lookup("jdo/modelJDO"); in 
>CastorHelper()
> 
>****************************************************************************************
> 15:35:38,307 INFO  [STDOUT] CastorHelper(): binding for: java
> 15:35:38,307 INFO  [STDOUT] MSSQLXaDS: 
>org.jboss.resource.adapter.jdbc.JDBCDataSource:Reference Class Name: 
>org.jboss.resource.adapter.jdbc.JDBCDataSource
> 15:35:38,307 INFO  [STDOUT] CastorHelper(): name: MSSQLXaDS
> 15:35:38,307 INFO  [STDOUT] CastorHelper(): object: Reference Class Name: 
>org.jboss.resource.adapter.jdbc.JDBCDataSource
> .
> .
> .
> 15:35:38,438 INFO  [STDOUT] CastorHelper(): bindings for jdo
> 15:35:38,438 INFO  [STDOUT] CastorHelper(): binding for: jdo
> 15:35:38,438 INFO  [STDOUT] modelJDO: javax.naming.LinkRef:Reference Class Name: 
>javax.naming.LinkRef
> Type: LinkAddress
> Content: java:/castorModel
> 15:35:38,448 INFO  [STDOUT] CastorHelper(): name: modelJDO
> 15:35:38,448 INFO  [STDOUT] CastorHelper(): object: Reference Class Name: 
>javax.naming.LinkRef
> Type: LinkAddress
> Content: java:/castorModel
> 
> 
>**************************************************************************************************
> ************ The Problem ****
> 
>**************************************************************************************************
> 
> *** Notice that the objects are References to classes rather than actual objects ***
> 
> *** So the problem is that things look like they are bound correctly,
>     but I get a null object back from the call to: 
>     _jdo = (DataObjects) compEnv.lookup("jdo/modelJDO"); in CastorHelper()
>       
> 
>*************************************************************************************************
> 
> 
> 
>   

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

Reply via email to