Forums Register Login

problem in web application with connection pooling

+Pie Number of slices to send: Send
Web Application with Connection Pooling problem
Below are software installed in my PC:
Windows98
Tomcat v. 4.1.27
J2SE/JDK v. 1.3.1
MySQL Server v. 4.0.17
MySQL Connector/J v. 3.0.10

Below is the content of AUTOEXEC.BAT:

From MySQL Server, I've created the database wordgames with tables (word, wordcategory & wordhint) under it.
Below is the deployment descriptor (web.xml)and is located in the deployment path, c:\Tomcat\webapps\database\WEB-INF:

Java files below are located at the development path, c:\ServletDevel\database\sl314\domain:
ScrambleGameService.java
Word.java
WordCategory.java
WordCategoryDAO.java
WordCategoryService.java
WordDAO.java
Files above were compiled successful and class files of each is copied in the deployment path, c:\Tomcat\webapps\database\WEB-INF\classes\sl314\domain
NamingService.java is located at the development path, c:\ServletDevel\database\sl314\util:
NamingService.java is compiled successful and its class file is copied in the deployment path, c:\Tomcat\webapps\database\WEB-INF\classes\sl314\util
Java files below are located at the development path, c:\ServletDevel\database\sl314\web:
InitializeConnectionPool.java
ScrambleGameServlet.java
Files above were compiled successful and class files of each is copied in the deployment path, c:\Tomcat\webapps\database\WEB-INF\classes\sl314\web
When I entered the URL,
http://localhost:8080/database/
for the message form in the Address field, the page for the URL,
http://localhost:8080/database/index.html
is displayed, looks like below:
Duke's Arcade
Select from one of the following games:

Word Scramble
Word Guess

Then I selected the Word Scramble link, but errors below is displayed:

Below are the corresponding lines of the root cause of
errors above:
1.)
sl314.domain.WordCategoryDAO.selectAllCategories(WordCategoryDAO.java:38)
Below is the code of line 38:
connection = connectionPool.getConnectionNoWait();
2.)
sl314.domain.WordCategoryService.getCategories(WordCategoryService.java:16)
Below is the code of line 16:
return wordCatDataAccess.selectAllCategories();
3.)
sl314.web.ScrambleGameServlet.showCategories(ScrambleGameServlet.java:43)
Below is the code of line 43:
List categoryList = wordCatSvc.getCategories();
4.)
sl314.web.ScrambleGameServlet.doGet(ScrambleGameServlet.java:29)
Below is the code of line 29:

showCategories(request, response);
I'm new to connection pooling, are these errors have
something to do with connection pooling?
JAR file, conn_pool.jar is located at the deployment
path: C:\Tomcat\webapps\database\WEB-INF\lib
Can anybody there please help? I really need to make run this web application. Do you think the contents of autoexec.bat and web.xml above are okay?
Cathy Valdez
[ February 25, 2004: Message edited by: Cathy Valdez ]
+Pie Number of slices to send: Send
Sorry it took me so lomg to get back to you. If anyone else wants to join in, this thread is related to the one here, which contains much more source code.

This means the connectionPool variable is null. It gets instantiated like this:

so it looks like the NamingService is returning null.
The ConnectionPool gets initailised in InitializeConnectionPool like this:

Are you sure the ConnectionPool is being initialised? ie is the above code getting called, and is it working OK or does it return an error? If it returns an error, nothing will be written to the NamingService and life will go on. If this is a critical error, it may be better to allow an Exception to propogate so that your application stops. You can hardly continue, can you?
Maybe (for now) cange it like this and see how it behaves:

...and see what happens. You may want to create your own checked Exception and throw that instead.
+Pie Number of slices to send: Send
David O' Meara,
I did your suggestions, but when I tried to compile InitializeConnectionPool.java , errors below were displayed:

Even ScrambleGameServlet.java when compiled, errors below occured:

Thank you for your time reading and making suggestions in my Post Ads.
Cathy Valdez
[ February 26, 2004: Message edited by: Cathy Valdez ]
+Pie Number of slices to send: Send
Are you still compiling from the c:\ServletDevel\database\sl314\web directory and then copying them to the c:\Tomcat\webapps\database\WEB-INF\classes\sl314\web directory?
Have you changed your classpath since last time? This is just a little bit wierd - InitializeConnectionPool can apparently see ServletContextListener but not ServletContextEvent. They are both from Servlets2.3, so you should be able to see both or neither.
From the command line, try running these:
javap javax.servlet.ServletContextListener
javap javax.servlet.ServletContextEvent
They should both return data, or your classpath is broken.
+Pie Number of slices to send: Send
David O' Meara,
Yes, I am still compiling from the c:\ServletDevel\database\sl314\web directory and then copying them to the c:\Tomcat\webapps\database\WEB-INF\classes\sl314\web directory.
Below is the content of AUTOEXEC.BAT


c:\>javap javax.servlet.ServletContextListener

c:\>javap javax.servlet.ServletContextEvent

Thanks.
Cathy Valdez
[ February 27, 2004: Message edited by: Cathy Valdez ]
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1693 times.
Similar Threads
cannot activate a web application with database
cannot activate a web application with database
cannot activate a web application with database
cannot activate servlet in the Web browser
cannot activate a web application with database
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 03:30:59.