Problem with MYSQL OR JNDI ??
nitz_tech Oct 4, 2003 7:10 AMHello friends,
I am new to JBOSS environment. I have put all my efforts trying to configure MYSQL4.x with JBOSS 3.x. I can very well get my ejb's from the Naming Server but when I try to get any other object such as String, Datasource objects I get a exception javax.naming.NameNotFoundException.
According to me there are two possibilities :
1. Problem with JNDI : Can be. But I can get my ejbs back from JNDI. But not Datasource or any other say String object.
2. Problem with MYSQL Configuration : - no comments -
When I cut and paste the mysql-service.xml file I get the message :
======================================
JBOSS Console :
14:09:45,312 INFO [MainDeployer] Starting deployment of package: file:/E:/jboss/jboss-tomcat/server/default/deploy/mysql-service.xml
14:09:45,328 INFO [JBossManagedConnectionPool] Creating
14:09:45,328 INFO [JBossManagedConnectionPool] Created
14:09:45,328 INFO [LocalTxConnectionManager] Creating
14:09:45,328 INFO [LocalTxConnectionManager] Created
14:09:45,328 INFO [JBossManagedConnectionPool] Starting
14:09:45,328 INFO [JBossManagedConnectionPool] Started
14:09:45,343 INFO [LocalTxConnectionManager] Starting
14:09:45,359 INFO [MySqlDS] Bound connection factory for resource adapter 'JBoss LocalTransaction JDBC Wrapper' to JNDI name 'java:/MySqlDS'
14:09:45,359 INFO [LocalTxConnectionManager] Started
14:09:45,359 INFO [MainDeployer] Deployed package: file:/E:/jboss/jboss-tomcat/server/default/deploy/mysql-service.xml
======================================
Client Code :
Hashtable hashTable = new Hashtable();
hashTable.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
hashTable.put(Context.PROVIDER_URL,"jnp://happy:1099");
Context context = new InitialContext(hashTable);
DataSource dataSource = (DataSource) context.lookup("java:/MySqlDS");
======================================
login-config.xml
<!-- Testing for MYSQL Database Starts here -->
<application-policy name = "MySQLDbRealm">
<login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
<module-option name = "principal">root</module-option>
<module-option name = "userName">root</module-option>
<module-option name = "password"></module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MySqlDS</module-option>
</login-module>
</application-policy>
<!-- Testing for MYSQL Database Ends here -->
======================================
mysql-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->
<!-- ==================================================================== -->
<!-- New ConnectionManager setup for mysql using 2.0.11 driver -->
<!-- Build jmx-api (build/build.sh all) and view for config documentation -->
<!-- ==================================================================== -->
<!-- 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">yourprincipal</module-option>
<module-option name = "userName">yourusername</module-option>
<module-option name = "password">yourpassword</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://happy:3306/test</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">root</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
======================================