Soefara, I do not have your same setup, but I have seen that error when all was set up correctly and as per the JNDI How-To. Something else you will notice is if you completely remove (or comment out) your entire JNDI section (I think just in server.xml), you will get the exact same error. It is as if there are some combination of settings or circumstances under which Tomcat loses the setting.
I dug around a lot with this and the differences between the 4.0 and 4.1 methods of setting up a JNDI datasource and when I thought I had the thing figured out, the error mysteriously stopped occuring. Please post if you fix this problem or it happens to stop being a problem as I am still leary of using JNDI due to this odd behavior. I know this doesn't make sense, but when I was getting this error (even though my server.xml settings and web.xml settings exactly matched the examples in the HOW-TO and I had no problems with 4.0) I noticed that there was one parameter name changed between the 4.0 and 4.1 docs. "driverName" became "url". So I added (to my 4.1 configuration) "driverName" with the same value as "url" and I stopped getting the error and the JNDI datasource was working. I thought I had found the problem, but when I commented out "driverName" to make sure that was the problem, it still worked and has worked since. I'm still not sure what happened. ?? Good luck and I'd appreciate any reports on your findings. Colin > -----Original Message----- > From: Soefara Redzuan [SMTP:[EMAIL PROTECTED] > Sent: Sunday, March 23, 2003 8:22 PM > To: [EMAIL PROTECTED] > Subject: Re: JDBC Driver disappears when using Mod_WEBAPP > > > Sorry, just realized the title should have read > "JDBC driver disappears when using mod_webapp". > > > >From: "Soefara Redzuan" <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: JDBC Driver disappears when using Mod_jk ! > > > >Dear Sirs, > > > >This is truly bizarre. I've been runing Apache+mod_webapp in front > >of one of our websites for quite a time now and it has worked fine > >for serving up JSP pages. So, the Apache->mod_webapp->Tomcat > >communication seems to be working OK. > > > >I recently added a JNDI datasource to the Tomcat web application. > >The datasource is configured perfectly, as proven with the > >useful servlet (below) which we always use to test JNDI datasource > >connections. > >ie. http://www.oursite.com:8080/ourapp/TestDb?jndi=jdbc/dbname > > > >reports that we successfully created a database connection from > >the JNDI datasource. > > > >However, when we now try to access via mod_webapp > >ie. http://www.oursite.com/ourapp/TestDb?jndi=jdbc/dbname > > > >it reports an error message "Cannot load JDBC driver class 'null'" > > > >How can this be ??? Apache+mod_webapp has been proven to be > >configured properly since we've been serving up JSP from this > >webapp for months. When connecting directly to Tomcat on > >port 8080, the JNDI resource does indeed exist and we can > >create the connection so the JDBC driver must exist too (and > >it does) ! > > > >Why does the JDBC driver seem to disappear when using mod_webapp??? > > > >I hope somebody can shed some light on this. > > > >Thank you in advance, > > > >Soefara. > > > >ps. here's the servlet we use for testing JNDI datasource > > connections, maybe some of you will find it useful. > > > > > >------------------------------------------------------------------ > > > >import javax.servlet.*; > >import javax.servlet.http.*; > >import java.io.*; > >import java.util.*; > >import java.sql.*; > >import javax.sql.*; > >import javax.naming.*; > > > >public class DbHandlerDebug extends HttpServlet { > > > > public void doGet (HttpServletRequest request, HttpServletResponse > >response) throws ServletException, IOException { > > Connection conn = null; > > String jndiName = request.getParameter("jndi"); > > response.setContentType("text/html"); > > PrintWriter out = new PrintWriter(response.getOutputStream() ); > > out.println("<html><body><h3>Test JNDI</h3>"); > > Context ctx = null; > > DataSource ds = null; > > if (jndiName == null) { > > out.println("<font color=#0000ff><p>Usage : send argument > >'jndi'. <br> eg. /servlet/TestDB?jndi=jdbc/ourdb"); > > } > > try { > > ctx = new InitialContext(); > > Context envCtx = (Context) ctx.lookup("java:/comp/env/"); > > out.println("<li>Retrieved Context"); > > ds = (DataSource) envCtx.lookup(jndiName); > > out.println("<li>Obtained Datasource"); > > conn = ds.getConnection(); > > out.println("<li>Got Connection"); > > out.println("<h3>OK :-)</h3>"); > > } > > catch (NamingException e) { > > out.println("Failed to get datasource from context : " + > >e.getMessage()); > > } > > catch (SQLException e) { > > out.println("Failed to get DB connection : " + > e.getMessage()); > > } > > catch (Exception e) { > > out.println("Unexpected error : " + e.getMessage()); > > } > > out.flush(); > > } > > > >} > >---------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > >_________________________________________________________________ > >Download ringtones, logos and picture messages from MSN Malaysia > >http://www.msn.com.my/mobile/ringtones/default.asp > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > _________________________________________________________________ > Are you in love? Find a date on MSN Personals http://match.msn.com.my/ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
