Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes failed to compile servlet file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "failed to compile servlet file" Watch "failed to compile servlet file" New topic
Author

failed to compile servlet file

Cathy Valdez
Greenhorn

Joined: Oct 22, 2003
Posts: 23
OS=Windows98, Tomcat v. 4.1.27.exe, J2SE/JDK v. 1.3.1
contents of AUTOEXEC.BAT:
set PATH=c:\jdk1.3.1\bin;%PATH%
set CLASSPATH=%CLASSPATH%;.;c:\ServletDevel;c:\Tomcat\common\lib\servlet.jar
set JAVA_HOME=c:\jdk1.3.1
location of NamingService: class sl314.util.NamingService
development directory path of InitializeConnectionPool.java:
c:\ServletDevel\database\src\web\

development directory path of NamingService.java:
c:\ServletDevel\database\src\util\

I tried to compile InitializeConnectionPool.java, by doing this:
c:\ServletDevel\database\src\web\javac InitializeConnectionPool.java
but compilation errors below occured:
InitializeConnectionPool.java:72: cannot resolve symbol
symbol: class NamingService
location: class sl314.web.InitializeConnectionPool
NamingService nameSvc = NamingService.getInstance();
^
InitializeConnectionPool.java:72: cannot resolve symbol
symbol: variable NamingService
location: class sl314.web.InitializeConnectionPool
NamingService nameSvc = NamingService.getInstance();
^
InitializeConnectionPool.java:75: cannot resolve symbol
symbol: class ConnectionPool
location: class sl314.web.InitializeConnectionPool
ConnectionPool connectionPool
^
InitializeConnectionPool.java:76: cannot resolve symbol
symbol: class ConnectionPool
location: class sl314.web.InitializeConnectionPool
(ConnectionPool) nameSvc.getAttribute("connectionPool");
^
Actually 10 errors.

Is anybody there can help? What do errors above mean? What should I do to successfully compile InitializeConnectionPool.java?
Any suggestion would be greatly appreciated.

Regards,
Cathy
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 614
Hi,
is there some thing like below appearing in u r java file
1)import database.src.web.*;
2)import database.src.util.*; ???
if these lines r missing ,try with it
cheers
Praful


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Cathy Valdez
Greenhorn

Joined: Oct 22, 2003
Posts: 23
Praful,
Thank you for your reply.
Below is included in InitializeConnectionPool.java:
package sl314.web;
// Servlet imports
import javax.servlet.ServletContextListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContext;
// SQL Utility Imports
import sl314.util.NamingService;
import sl314.util.sql.ConnectionPool;
import java.sql.SQLException;
...but still compilation errors occured.
Maybe something's wrong with the codes or with the compiler.
If you have suggestions regarding this, please post it.

Cathy
[ October 23, 2003: Message edited by: Cathy VM ]
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
How about changing you classpath environment variable from:

to

Also verify that the .class and not just the source.java files are located there. Because I noticed the "src" as part of your path.
c:\ServletDevel\database\src\util\sl314\util\NamingService.class
c:\ServletDevel\database\src\util\sl314\util\sql\ConnectionPool.class
If not you must modify your classpath variable to point those class files.
Craig
Cathy Valdez
Greenhorn

Joined: Oct 22, 2003
Posts: 23
Craig,
Thank you for suggestions.

I've changed the classpath environment from:
CLASSPATH%;.;c:\ServletDevel;c:\Tomcat\common\lib\servlet.jar
to:
CLASSPATH%;.;c:\ServletDevel\database\sl314\util\;c:\Tomcat\common\lib\servlet.jar

I've also changed the development directory path for NamingService.class from:
c:\ServletDevel\database\src\util\

to:
c:\ServletDevel\database\sl314\util\

and NamingService.class is located there.
Now I know what the problem is, I do not have the ConnectionPool.class file which should be located at the directory path below:
c:\ServletDevel\database\sl314\util\sql\
I am new with servlets, I don't know how to have that ConnectionPool.class.
Actually, I only want this example web application integrated with database to run in my PC, as a start of learning servlets with database.
Do i have to install something about ConnectionPool in my PC just to have that ConnectionPool.class?
Or should I build the ConnectionPool? If so, how will I do it?
Any information regarding this from anybody would be great appreciated.

Thanks in advance.
Cathy
[ October 23, 2003: Message edited by: Cathy VM ]
 
jQuery in Action, 2nd edition
 
subject: failed to compile servlet file
 
Similar Threads
cannot activate a web application with database
compilation failed
compilation failed
failure to activate a Web application with database
problem in web application with connection pooling