aspose file tools
The moose likes Beginning Java and the fly likes despair with import and package (again) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "despair with import and package (again)" Watch "despair with import and package (again)" New topic
Author

despair with import and package (again)

achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
My problem starts when I rewrite TestEmpDS.java 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 :
$SERVLET_HOME/com/developer/DataSource...
.../connections/TestEmpDS.java... // this is the client java program which calls on the other classes
.../connections/AllEmpDS.java.....// gets a free db connection from pool and gets the result set from SQL statement
.../pooling/OraDSPool.java .......// creates a pool of db connections and keep track of them
.../datasource/OraDSClient.java...// create on single physical db connection using the jndi .binding parameters
.../datasource/OraDSServer.java...// created the JNDI .bindings file in the jndi subdirectory
.../profiler/profiler.java..... ..// profiles the connection time
The JNDI properties files are as follow:
$SERVLET_HOME/com.developer/DataSource...
.../OraSource.properties
.../oraDemo.properties
Problems :
Works find from the command line level using "java connections.TestEmpDS".
When I rewrite the client application program into a servlet "webTestEmpDS.java" 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 :
webTestEmpDS.java:17:cannot resolve symbol
symbol class : webAllEmpDS
location: class com.developer.DataSource.connections.webTestEmpDS
webAllEmpDS showAll = new webAllEmpDS();
^
...
The original code for the client java application "TestEmpDS.java" 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 webAllEmpDS.java
achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Hi !
Thanks all, problem resolved.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: despair with import and package (again)
 
Similar Threads
Shopping cart help
Rollback not working with @Transactional
Tomcat Datasource problem
Help? Compliation Errors
connecting to Data Base