Can't Find Data Source
browne Aug 6, 2002 11:02 PMMy 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?