Jboss 3.0 Tomcat 4.03 Naming Context problem
matn1 Aug 21, 2002 1:15 PMDoes anybody know why I'm getting the following run error
when trying to connect to MySql database.
run.clientDBTest:
[java] Start of TestDBMySqlClient
[java] Here
[java] javax.naming.NameNotFoundException: MySqlDS not bound
[java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.jav
[java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
[java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
[java] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:445)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:350)
[java] at test.client.TestDBMySqlClient.main(TestDBMySqlClient.java:23)
----------------------------------------------------------
Please see below simple client
Connection con = null;
try {
System.out.println("Start of TestDBMySqlClient");
System.out.println("Here");
DataSource ds = (DataSource) new InitialContext().lookup("java:/MySqlDS");
System.out.println("Here2");
con = ds.getConnection();
Statement stmt = con.createStatement();
StringBuffer sb = new StringBuffer();
sb.append("Select * from Employee");
ResultSet rs = stmt.executeQuery(sb.toString());
while (rs.next())
{
String lname = rs.getString("LastName");
String fname = rs.getString("FirstName");
System.out.println("Record retieved " + fname + " " + lname);
}
} catch( Exception e ){
e.printStackTrace();
}
finally {
try {
con.close();
}
catch(Exception ex) {}
}
------------------------------------------------------
below is console message starting MySql and hsql
08:34:42,141 WARN [ServiceController] jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper does not implement any Servi
ce methods
08:34:42,141 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=hsqldbDS does not implement any Service methods
08:34:42,141 INFO [LocalTxConnectionManager] Creating
08:34:42,361 INFO [LocalTxConnectionManager] Created
08:34:42,361 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=MySqlDS does not implement any Service methods
08:34:42,361 INFO [LocalTxConnectionManager] Creating
08:34:42,381 INFO [LocalTxConnectionManager] Created
08:34:42,581 INFO [LocalTxConnectionManager] Starting
08:34:43,302 INFO [DefaultDS] Bound connection factory for resource adapter 'JBoss LocalTransaction JDBC Wrapper' to JNDI name 'java:/Defau
ltDS'
08:34:43,533 INFO [LocalTxConnectionManager] Started
08:34:43,533 INFO [LocalTxConnectionManager] Starting
08:34:43,583 INFO [JaasSecurityManagerService] Created securityMgr=org.jboss.security.plugins.JaasSecurityManager@1ba94d
08:34:43,583 INFO [JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedCachePolicy@82751
08:34:43,583 INFO [JaasSecurityManagerService] Added MySqlDbRealm, org.jboss.security.plugins.SecurityDomainContext@4d5bc9 to map
08:34:44,093 INFO [MySqlDS] Bound connection factory for resource adapter 'JBoss LocalTransaction JDBC Wrapper' to JNDI name 'java:/MySqlDS
'
08:34:44,093 INFO [LocalTxConnectionManager] Started
----------------------
Thanks,
Unfortunately I'm having a hard time attaching mysql-service.xml file
But, I'll do it a next thread if needed.