4 Replies Latest reply on Jun 12, 2007 3:08 AM by paoletto

    Jboss 4.0.1 does not seem to read the jbosscmp-jdbc.xml file

    preprabha

      Hi,

      I have a simple EAR file deployed to JBoss using "all" configuration. I want to use mysql database for this ear. I have mysql-ds.xml configured correctly and jbosscmp-jdbc.xml is in META-INF in the ear. The defaults section of jbosscmp-jdbc.xml is configured to use the mysql ds. The problem is jboss does not seem to override the defaults (specified in standardjbosscmp-jdbc.xml ) with the settings in josscmp-jdbc.xml. Its creating the table in the hypesonic database which is the default for jboss. When I change the ds in standardjbosscmp-jdbc.xml to use mysql, I see that the tables are created in mysql. According to jboss doc, the jbosscmp-jdbc.xml should override the default for a deployment unit. Am I missing something here?

      thanks for your time

        • 1. Re: Jboss 4.0.1 does not seem to read the jbosscmp-jdbc.xml
          sharma_arun_se

          HI
          SEND YOUR mysql-ds.xml ,jbosscmp-jdbc.xml ALONG WITH DIRECTORY STRUCTURE OF YOUR APPLICATION.

          BYE

          • 2. Re: Jboss 4.0.1 does not seem to read the jbosscmp-jdbc.xml
            preprabha

            mysql-ds.xml is (Someone the node is being striped off when I paste the file here but its there rt after the user-name) :

            <local-tx-datasource>
            <jndi-name>MySqlDS</jndi-name>
            <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
            <driver-class>com.mysql.jdbc.Driver</driver-class>
            <user-name>root</user-name>

            <type-mapping>mySQL</type-mapping>

            </local-tx-datasource>


            JBOSSCMP-JDBC.xml is (the datasource node is being stripped off but the JNDO name is within the datasource node) :
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN"
            "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">
            <jbosscmp-jdbc>

            java:/MySqlDS
            <datasource-mapping>mysql</datasource-mapping>
            <create-table>true</create-table>
            <pk-constraint>true</pk-constraint>
            <fk-constraint>false</fk-constraint>
            <preferred-relation-mapping>foreign-key</preferred-relation-mapping>

            <enterprise-beans>

            <ejb-name>MovieBean</ejb-name>
            <table-name>movie</table-name>
            <cmp-field>
            <field-name>name</field-name>
            <column-name>name</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>leadActor</field-name>
            <column-name>lead_actor</column-name>
            <not-null/>
            </cmp-field>
            <cmp-field>
            <field-name>id</field-name>
            <column-name>id</column-name>
            <not-null/>
            <auto-increment/>
            </cmp-field>

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


            The EAR structure is like this:
            File : Manifest.mf, Path = meta-inf\
            jbosscmp.jdbc.xml, Path = meta-inf\
            jboss.xml, Path = meta-inf\
            application.xml, Path = meta-inf\
            test.jar

            The Jboss.xml is file contains :
            <?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>MovieServiceHome</ejb-name>


            <ejb-name>MovieBean</ejb-name>

            </enterprise-beans>


            • 3. Re: Jboss 4.0.1 does not seem to read the jbosscmp-jdbc.xml
              sharma_arun_se

              Hi My suggestion , if you want to implement it .

              Make all necessary changes in standardXXX.xml instead of overidding them and find out if this trick works .
              If so then , there must be some error while creating these overridding files .

              SEnd me your answer soon.

              I am Arun Sharma
              from chandigarh

              • 4. Re: Jboss 4.0.1 does not seem to read the jbosscmp-jdbc.xml
                paoletto

                i have the same problem. jbosscmp-jdbc seems not to be read.

                where's the mistake?