1 Reply Latest reply on Aug 29, 2002 5:10 AM by Dominique Plante

    Can't Find Data Source

    Ed Brown Newbie

      My CMP entity bean uses MySQL. When it is deployed, I get an error stating that MySQL is not bound. I see instances of the MySQL service.


      I got the following mysql-service.xml from sourceforge:






      <!-- Include a login module configuration named MySqlDbRealm.
      Update your login-conf.xml, here is an example for a
      ConfiguredIdentityLoginModule:

      <application-policy name = "MySqlDbRealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
      <module-option name = "principal"></module-option>
      <module-option name = "userName"></module-option>
      <module-option name = "password"></module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MySqlDS</module-option>
      </login-module>

      </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 out this line if you are using the MySqlDbRealm above
      MySqlDbRealm
      -->

      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->


      MySqlDS



      <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost/EDS_DB</config-property>
      <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
      <!--set these only if you want only default logins, not through JAAS -->
      <config-property name="UserName" type="java.lang.String"></config-property>
      <config-property name="Password" type="java.lang.String"></config-property>




      <!--Below here are advanced properties -->
      <!--hack-->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper




      <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->


      0
      50
      5000
      15
      <!--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)-->
      ByContainer



      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

      <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager

      java:/TransactionManager
      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer






      ================

      jbosscmp-jdbc.xml is as follows:



      <jbosscmp-jdbc>

      java:/MySqlDS
      <datasource-mapping>mySQL</datasource-mapping>

      <enterprise-beans>

      <ejb-name>User</ejb-name>
      <table-name>user_table</table-name>
      <cmp-field>
      <field-name>user</field-name>
      <column-name>user</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>passwd</field-name>
      <column-name>passwd</column-name>
      </cmp-field>

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

      ============

      The exception is as follows:


      org.jboss.deployment.DeploymentException: Error: can't find data source: java:/MySqlDS; - nested throwable: (javax.naming.NameNotFoundException: MySqlDS not bou
      nd) at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.(JDBCEntityBridge.java:99)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.create(JDBCStoreManag
      er.java:332)

      ...

      javax.naming.NameNotFoundException: MySqlDS not bound

      ====================

      Since I'm using EJBs, it's all in the same VM. Does anyone have any idea what is going wrong?


        • 1. Re: Can't Find Data Source
          Dominique Plante Newbie

          Ed:
          Not sure if you have solved the problem or not, but here's my suggestion from a little bit of experimenting....

          It looks like the version of mysql-service.xml you are showing is for JBoss v 3.0.2. I compared a MySQL data source service that worked in v3.0.0 and the main diference was with this line:

          <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager

          towards the bottom. In a v3.0.0 things work well when it reads:
          <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager

          Hope this helps!