This week's book giveaways are in the Cloud/Virtualization and Go forums. We're giving away four copies each of Cloud Native Transformation: Practical Patterns for Innovation and The Go Workshop and have the authors on-line! See this thread and this one for details.
I'm testing a JSP MVC application on Netbeans 731. This is an admin application which simply queries a mySql DB and returns a list of users. The application starts with index.jsp where the user clicks the 'display' hyperlink. This then calls a displayUsers GET action which uses the DisplayUsersServlet. The DBUser class is used as a DAO that talks to the DB.
The application compiles and runs without any problems. I even tested the Connection pooling and manually queried the DB to make sure the values are there. But when I run the application I just see the columns displayed without the values. I'm thinking that I made some mistakes in coding either the UserDB class and/or the DisplayUsersServlet.
Yes I did a manual SELECT query using the mySql command line and successfully got all 4 records in the DB.
Following Bear's advice I also added a few System.out.println statements. Adding System.out.println(rs.getString("FirstName")); in the UserDB class I was able to see a print out of the DB records in the console. When restarting the application I noticed the following error in the Tomcat log. Does this suggest my application is corrupted (seeing as I opened this project in Netbeans didn't build it from scratch)?
java.lang.IllegalArgumentException: Document base C:\murach\extract\servlet_jsp\netbeans\ex_starts\ch07email\build\web does not exist or is not a readable directory
Any ideas if this error is a corruption of Netbeans, Tomcat or my JDK? I'd like to be on the safe side and re-install all but would appreciate any suggestions if anybody has come across this error before. I searched through the forum but didn't really find anything definitive on this error.
I also followed Bear's advice and added log4j, which doesn't output any errors so it looks like the database objects are working fine??
I re-instaled Netbeans, JDK and Tomcat, so the prior error referring to the build/web directoy is gone. The following output from log4j suggests that the DAO is talking to the DB and the ArrayList objects are being correctly set. The only mistake is that the HTTP request object produces a NULL QueryString (line 23). Also I'm stiilll figuring out how to add loggers to the users.jsp file.