2 Replies Latest reply on Jul 1, 2002 6:55 AM by Kail

    JBoss 3.0 and CMP datasource problem.

    Kail Newbie

      Hello,
      I have a problems with deploy my CMP (EJB1.1) entity.
      Ploblem for me is that i have bound in my JBoss my datasource as java:/MSSQLDS and when i try to use my CMP which should use this datasource it use java:/DefaultDS. But if i call a method from my session which lookup("java:/MSSQLDS") and create connection i execute a statement to database.. i got right result, the statement
      is executed into my MS SQL 2000 database. Please check my descriptors, for any answer i'll be grateful, cause i sped last few days with searching for an error what can be wrong. I am wondering that when i use jaws.xml (inlcuded in META-INF in jar) everything is okay, my CMP is proper map to datasource.


      META-INF\ejb-jar.xml
      <?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>

      <ejb-name>TestSession</ejb-name>
      my.jboss.ejb.TestSessionHome
      my.jboss.ejb.TestSession
      <ejb-class>my.jboss.ejb.TestSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <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-name>TAge</ejb-name>
      my.jboss.ejb.TAgeHome
      my.jboss.ejb.TAge
      <ejb-class>my.jboss.ejb.TAgeBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>nameDe</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>nameEn</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>nameEs</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>nameFr</field-name>
      </cmp-field>
      <primkey-field>id</primkey-field>
      <resource-ref>

      <res-ref-name>jdbc/DataSource</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      </enterprise-beans>
      <assembly-descriptor>
      <container-transaction>

      <ejb-name>TestSession</ejb-name>
      <method-name>*</method-name>


      <ejb-name>TAge</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>


      META-INF\jboss.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC '-//JBoss//DTD JBOSS 3.0//EN' 'http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd'>

      <enterprise-beans>

      <ejb-name>TestSession</ejb-name>
      <jndi-name>TestSession</jndi-name>
      <resource-ref>
      <res-ref-name>jdbc/DataSource</res-ref-name>
      <jndi-name>java:/MSSQLDS</jndi-name>
      </resource-ref>


      <ejb-name>TAge</ejb-name>
      <jndi-name>TAge</jndi-name>
      <resource-ref>
      <res-ref-name>jdbc/DataSource</res-ref-name>
      <jndi-name>java:/MSSQLDS</jndi-name>
      </resource-ref>

      </enterprise-beans>



      META-INF\jbosscmp-jdbc.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC '-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN' 'http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd'>
      <jbosscmp-jdbc>
      java:/MSSQLDS
      <type-mapping>MS SQLSERVER2000</type-mapping>

      <create-table>false</create-table>
      <remove-table>false</remove-table>

      <enterprise-beans>

      <ejb-name>TAge</ejb-name>
      java:/MSSQLDS
      <type-mapping>MS SQLSERVER2000</type-mapping>
      <table-name>T_AGE</table-name>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>ID</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>nameDe</field-name>
      <column-name>NAME_DE</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>nameEn</field-name>
      <column-name>NAME_EN</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>nameEs</field-name>
      <column-name>NAME_ES</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>nameFr</field-name>
      <column-name>NAME_FR</column-name>
      </cmp-field>

      findAll




      </enterprise-beans>
      </jbosscmp-jdbc>


      mssql-service.xml (placed into deploy directory)


      Regards,
      Kail