3 Replies Latest reply on Apr 18, 2005 7:46 AM by Jerry Stephen

    Help: Deploying CMP Entity Bean on Jboss (DB2)

    Henrik Troeng Newbie

      Hi, I have a problem which I have tried to solve for a couple of days now with now success.

      I have deployed an ordinary Entity CMP Bean which name is Customer.
      This bean has 2 fields, an id field and a customername field.

      I use DB2 where the table is named customer and the fields are named as the fields in the bean, id and customername.

      I have configured the db2-ds.xml file as follows, and put it in %jboss%\server\default\deploy:


      <local-tx-datasource>
      <jndi-name>DB2DS</jndi-name>
      <connection-url>jdbc:db2://192.168.10.220:6789/business</connection-url>
      <driver-class>COM.ibm.db2.jdbc.net.DB2Driver</driver-class>
      <user-name>db2admin</user-name>
      fuck4future
      <min-pool-size>5</min-pool-size>
      <max-pool-size>25</max-pool-size>
      <!-- sql to call when connection is created
      <new-connection-sql>some arbitrary sql</new-connection-sql>
      -->

      <!-- sql to call on an existing pooled connection when it is obtained from pool
      <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
      -->

      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->

      <type-mapping>DB2</type-mapping>

      </local-tx-datasource>


      I have created the jbosscmp-jdbc.xml file and put it in the META-INF directory in my ejb-application:

      <jbosscmp-jdbc>

      DB2DS
      <!--<datasource-mapping>DB2</datasource-mapping>-->
      <create-table>false</create-table>

      <enterprise-beans>

      <ejb-name>Customer</ejb-name>
      <table-name>customers</table-name>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>id</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>companyname</field-name>
      <column-name>companyname</column-name>
      </cmp-field>

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

      I have created the standardjaws.xml also in my META-INF directory of the ejb application. This file contains a lot of information (type-mappings), and starts with:


      java:/DB2DS
      <type-mapping>DB2</type-mapping>
      false


      I have the ejb-jar.xml file automaticly generated for me in my developer tool (WSAD).


      When I try to start my server I get the following error:

      ObjectName: jboss.j2ee:jndiName=Customer,service=EJB
      state: FAILED
      Depends On Me: org.jboss.deployment.DeploymentException: type-mapping is not initialized: DB2DS was not deployed or type-mapping was not configured.
      ObjectName: jboss.j2ee:service=EJB,plugin=pool,jndiName=Customer
      etc.......


      Please can someone help me and give me a clue, what am I doing wrong??

      Rgds,
      Henrik