I am trying to connecto to mysql database using RedHat 9 but always get a wonderful error message when I try to compile this code:

Context ctx = new InitialContext( ); //Error is thrown here

if(ctx == null )
throw new Exception("Boom - No Context");

DataSource ds = (DataSource)ctx.lookup( "java:comp/env/jdbc/xsmsDB" );

if (ds != null)
m_dbConn = ds.getConnection();

Error message is:

javax.naming.NoInitialContextException: Cannot instantiate class: fr.dyade.aaa.jndi.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: fr.dyade.aaa.jndi.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:175)
at ruv.chat.getDatabaseConnection(chat.java:54)
at ruv.chat.<init>(chat.java:30)
at ruv.tester.main(tester.java:16)

It would be great to get rid of this error

Please clarify which java packages are you using? You most certainly are not connecting to the databases using RedHat 9! It looks like you are using the Spring Framework. Is this true?