Words of Experience from Sue Peters

Here are some pointers for the project, based on the work my team did last week and this weekend, and working with Hazem.

  1. We created a TestDB with nothing in it, in order to test our setup of the different Tomcat files that Hazem instructed us to change in the email from Professor McCracken, 1.5 weeks ago.

 We created our own music database for use with our actual final project, but did not start using this until we were successful with Hazem’s configuration instructions up an running using his TestDB reference.

 If you want a GUI for creating the database, download the MYSQL Aministrator  GUI from the MYSQL website.

  1. We edited the context.xml and server.xml files as instructed by Hazem, and saved them in the tomcat/conf folder. I’ve attached my edited files for you.
  2. We created the JNDITestServlet.java that Hazem also sent via Mcracken in an email.  One problem we had was that we needed to remove the package structure from our servlet, so it would match our web.xml file.(see next)
  3. Also of note, is that our textbook uses a different web.xml file configuration, than Hazem says is required.  Hazem’s configuration also matches much of the web.xml files included with the different sample webapps in your Tomcat structure.  See attached web.xml.
  4. Be sure to start Tomcat and MYSQL server, before testing the new JNDITestServlet.  Also, don’t forget to put the JNDITestServlet file into your tomcat/webapps/<projectname>/web-inf/classes folder. (Assuming it is not in any type of package structure).
  5. At this point, my setup still did not work.  Therefore, Hazem hard-coded the database connection into my servlet file, for me, to make it work.  In general, this is very bad and should never be done, he says. I have attached the JNDITestServlet.java file that was successful – however I have removed my username and password. You should insert yours here -  either username:root, password:? , or the username and password you assigned to the specific database if you assigned one.
  6. you should then open your browser, type in localhost/<projectname>  and here you should see your directory of files.  Then type in localhost/<projectname>/JNDIServletTest   and you should see the result of Hazem’s SQL statement in the browser window (the version of the TestDB database)

 ****Don’t forget to:  1. put your JDBC Jar file in the right place (as per Hazem’s instructions via email from Prof), 2. try restarting Tomcat and MySQL after making changes, 3. Check that you have the correct names for all four refereneces in your web.xml file….if your servlet is named anything other than JNDITestServlet than it won’t work with the one I have attached.

 I hope this helps. 

 Files attached:  [[[DDM note: I didn't get these. Will ask Sue.]]]

  1. server.xml
  2. content.xml
  3. web.xml
  4. JNDITestServlet with JDBC connection hardcoded in with DB username and password removed.

 

Back to Dan McCracken's  Home Page