• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

failure to activate a Web application with database

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to activate an example Web application with database but failed.
This example is done by:
1. Developing a servlet context listener to initialize connection pool and place it in a global naming context
2. Configuring the deployment descriptor to declare the servlet context listener and set the servlet context initialization parameters
3. Deploying the Web application
4. Activating the Web application
This is an example of a Web application for playing word games.
The servlet allows the user to play a "word scramble" game.
Next, the user is presented with a list of "word categories" to choose from. The user selects a category and clicks the Choose button, which presents her with the next view.
The next view is the main part of the scramble game. The user is presented with a scrambled word and is asked to enter the word in the text field. The user can also ask for a hint by selecting the checkbox. She then clicks the Guess button to process the request. The hint text appears in blue. The game is keeping track of how many "guesses" (including hints)she has made.

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
Below is the code for ScrambleGameService.java:

Below is the code for Word.java:

Below is the code for WordCategory.java:

Below is the code for WordCategoryDAO.java:

Below is the code for WordCategoryService.java:

Below is the code for WordDAO.java:

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
Below is the code for NamingService.java:

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
Below is the code for InitializeConnectionPool.java:

Below is the code for ScrambleGameServlet.java:

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:

Can anybody there help? What do errors above mean? How will I correct those errors? Any suggestions would be greatly appreciated. Thanks in advance.
Cathy
[ February 22, 2004: Message edited by: Cathy Valdez ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sometimes providing more information is just... confusing.
root cause java.lang.NullPointerExceptionat sl314.domain.WordCategoryDAO.selectAllCategories(WordCategoryDAO.java:38)
This is where you error is. Despite the reams of sample code you've provided, I'm not able to work out wicj is line 38 of WordCategoryDAO.java. (The code tag removes empty lines)
It's probably just a config error.
 
I can't renounce my name. It's on all my stationery! And hinted in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic