File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes despair with import and package (again) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "despair with import and package (again)" Watch "despair with import and package (again)" New topic

despair with import and package (again)

achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
My problem starts when I rewrite from a client program to a servlet class for Tomcat so that I can invoke it from a browser.
CLASSPATH= /usr/local/jakarta-tomcat-4.0.4/webapps/ROOT/WEB-INF/classes/com/developer/DataSource
The TOMCAT directory tree is as follows :
.../connections/ // this is the client java program which calls on the other classes
.../connections/ gets a free db connection from pool and gets the result set from SQL statement
.../pooling/ .......// creates a pool of db connections and keep track of them
.../datasource/ create on single physical db connection using the jndi .binding parameters
.../datasource/ created the JNDI .bindings file in the jndi subdirectory
.../profiler/ ..// profiles the connection time
The JNDI properties files are as follow:
Problems :
Works find from the command line level using "java connections.TestEmpDS".
When I rewrite the client application program into a servlet "" for the webbrowser and use Tomcat on it, it gets confused with finding the other classes.
(Issue) Instead of "package connections" , it now requires "package com.developer.DataSource.connections" in order to find the class file.
(Problem) WebTestEmpDS cannot compile now because of following error : resolve symbol
symbol class : webAllEmpDS
location: class com.developer.DataSource.connections.webTestEmpDS
webAllEmpDS showAll = new webAllEmpDS();
The original code for the client java application "" which works at cmd-line :

The revised code to create a java servlet in TOMCAT for the browser

humanum errare est.
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
Put webAllEmpDS.class in usr/local/jakarta-tomcat-4.0.4/webapps/ROOT/WEB-INF/classes/com/developer/DataSource/connections folder. Make sure you have
package com.developer.DataSource.connections;
declared for
achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Hi !
Thanks all, problem resolved.
I agree. Here's the link:
subject: despair with import and package (again)
jQuery in Action, 3rd edition