aspose file tools*
The moose likes Servlets and the fly likes error #704....uhg! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "error #704....uhg!" Watch "error #704....uhg!" New topic
Author

error #704....uhg!

Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
ok, I'm about to pick up that computer and throw it out the window! I keep getting the same error...cannot access directory javax\servlet and javax\servlet\http.
My only guess left is that servlet.jar is no good. I would like to get another copy of it and try that. I've looked on the sun website, but I can't find where you download class files. If someone could tell me where to find that, I would be eternally grateful.
Annette
KMukhar
Greenhorn

Joined: Jan 25, 2000
Posts: 7
http://java.sun.com/products/servlet/download.html
But your problem is probably not the servlet.jar file. It sounds very much like a classpath problem. What classpath are you using? Or are you putting the .jar file into the extensions directory?
P SOLAIAPPAN
Ranch Hand

Joined: Oct 20, 2000
Posts: 68
Hi,
If you have installed TOMCAT then there is no need to down load "servlet.jar". Give the class path name in "autoexc.bat"
as below
set classpath=%classpath%; F:\jakarta-tomcat\lib\servlet.jar
Here "F:\jakarta-tomcat" is my tomcat installation dir.
solaiappan
[This message has been edited by P SOLAIAPPAN (edited December 13, 2000).]
[This message has been edited by P SOLAIAPPAN (edited December 13, 2000).]
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
No, I don't have tomcat installed. My classpath is d:\jdk1.2.2\lib\servlet.jar
I downloaded the servlet.jar file and someone told me I could put it in the lib file of my jdk (I originally had the jsdk1.2 and I set my classpath to the default installation of the jsdk, as in where it put the servlet.jar file). When installing the jsdk and setting my classpath to the .jar file didn't work, I thought maybe the file was corrupted or something so I downloaded it again and put it in the lib folder.
My autoexec.bat file is completely empty, like as if it is never used. If I add that line to the file, it will be the only thing in there. I don't even know if it will still run, since it doesn't seem to have any other purpose.
What do you guys think? I don't know what else to check
Annette
P SOLAIAPPAN
Ranch Hand

Joined: Oct 20, 2000
Posts: 68
Hi,
I thing your servlet.jar file is OK. There is very little chance it is get corrupted when down loaded. If it is inside a zip file definetely your WINZIP will complain about it.
It is most likely classpath problem. In dos prompt you can checkup classpath by typing "set" command
solaiappan
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
what is the exact command to check the classpath from the dos prompt?
P SOLAIAPPAN
Ranch Hand

Joined: Oct 20, 2000
Posts: 68

c:\windows>set
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
doesn't work.... Are you sure?
P SOLAIAPPAN
Ranch Hand

Joined: Oct 20, 2000
Posts: 68
You go to MSDOS window and simply type only(of course press enter also)
set
nothing else, You will see list of all environment variables set, in dos window.
"classpath" is a environment variable used by java to search class files. It is a must that you set your classpath to use "servlet.jar"

[This message has been edited by P SOLAIAPPAN (edited December 13, 2000).]
[This message has been edited by P SOLAIAPPAN (edited December 13, 2000).]
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
ok, I've tried it, and the classpath is set correctly.
I'm using Borland JBuilder to write the code in and compile. Do you think it could be a problem with JBuilder? Whenever I compile, it gives me 3 errors. Cannot access directory javax\servlet etc.
Catalin Bren
Greenhorn

Joined: Oct 10, 2000
Posts: 12
The CLASSPATH of your system and the libraries that you use
in your JBuilder project are two different things. You have
to go in JBuilder project > Project > Project Properties >
Required libraries > Add > New > and then set the path of
your servlet.jar and then recompile.
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
You are a genius! I did not know about that. However, I now went from having 3 errors to having 13. Now I'm getting errors saying it can't find the following 3 classes:
Connection
Statement
Resultset
There are a few more errors, but I think they are all centered around those. What package are those classes in? I'm guessing they are not in servlet.jar.
Catalin Bren
Greenhorn

Joined: Oct 10, 2000
Posts: 12
I hope you did
import java.sql.*;
If now doesn't find java.sql.*
I think you need to reinstall JBuilder !

[This message has been edited by Catalin Bren (edited December 14, 2000).]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
All the classes it can't find are in the java.sql package. Check to make sure you have the import statement.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
Yay!! I'm one step closer to solving this problem. I'm down to 3 errors (all the same).
"result.close();
stmt.close();
con.close()
Unreported exception. Must be caught or declared to be thrown."
I didn't throw anything, so what does that mean?
P SOLAIAPPAN
Ranch Hand

Joined: Oct 20, 2000
Posts: 68
Hi,
In the beginning I never expected you are using JBuilder, I thought you are using command line prompt or a simple editor like "TEXTPAD"(This is very simple easy to use text editor and can be used for compiling /running java programs/applets). Any how you are giving information bit by bit. Why don't you simply post your code for the above servlet/dabase program so that error can be easily detected. From your above statement it appears that you have not properly declared checked exceptions which are mandatory.

solaiappan

[This message has been edited by P SOLAIAPPAN (edited December 14, 2000).]
chak ms
Greenhorn

Joined: Dec 11, 2000
Posts: 12
Now your problem is about the exceptions. U have to explicitly throw the exception. First u locate which procedure is causing to throw this exception and throw it. Still if it gives the problem with the exception, u put the code in try/catch block and catch the thrown exception provided with no code or u can execute a print statement as a part of debugging.
Hope this could help u.
with regards
chak
Originally posted by Annette L'Heureux:
Yay!! I'm one step closer to solving this problem. I'm down to 3 errors (all the same).
"result.close();
stmt.close();
con.close()
Unreported exception. Must be caught or declared to be thrown."
I didn't throw anything, so what does that mean?

Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
Sorry everybody. I thought this was a simple matter to be fixed in the beginning. I never thought it would get this long.
I would like to show you the code I'm using. (I believe Thomas Paul gave it to me a few days ago). How do I copy and paste my code here without it getting all distorted?

P SOLAIAPPAN
Ranch Hand

Joined: Oct 20, 2000
Posts: 68
Select your codes first then copy using mouse right click menu (or <CTRL> <a> --for selecting , <CTRL> <c> -----for copying if you use key board ) and paste(<CTRL> <v> ---for pasting) it in the reply window. There will not be any problem, people can read it (except some time if you use jsp codes smiling face will appear)

[This message has been edited by P SOLAIAPPAN (edited December 14, 2000).]
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
ok, here you go. If this come out bad, I'll try again...
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;

public class DBInventory3 extends javax.servlet.http.HttpServlet {
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
PrintWriter out = res.getWriter();
res.setContentType("text/html");
out.println("<html><head></head></html>");

Connection con = null;
Statement stmt = null;
ResultSet result = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc racle:thin:@ott46:1521:d10h", "inv", "invdev1");
stmt = con.createStatement();
result = stmt.executeQuery("select * from tb__vendors");
}
catch (Exception e) { }

ResultSetMetaData rsmd = null;
int numOfCols = 0;

try {
rsmd = result.getMetaData();
numOfCols = rsmd.getColumnCount();
}
catch (SQLException e) { }

out.println("<table border=2>");

try {
out.println("<tr>");
for (int i=1; i<= numOfCols; i++)
{
out.println("<td><b>" + rsmd.getColumnName(i) + "</b></td>");
}
out.println("</tr>");
}
catch (SQLException e) { }

try {
while (result.next())
{
out.println("<tr>");
for(int i=1; i<= numOfCols; i++)
{
out.println("<td>" + result.getString(i) + "</td>");
}
out.println("</tr>");
}
}
catch (SQLException e) {}

result.close();
stmt.close();
con.close();
out.println("</table>");
out.println("</body></html>");
return;
}
}
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
The problem is with the "close" statements at the end. I did not throw them to begin with, so why it's giving me that error is beyond me. Any insight would be greatly appreciated!!!
I just want to thank everybody again for being so patient. Once things start going, it should be a lot better.
Annette
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
Attempting to close any one of these can throw an SQLException. Just do this

Make sure that you close them in the reverse order that you opened them. This whole bit should be put in a finally block, as well, to make sure that the resources will get released. Like so,

Sean
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
Sean you are a god!!!
I have no more errors!!!
Ok, stupid questions. What's the best way to run this to see if it works?
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
Wait!! I just got it working!! I am currently jumping up and down doing the happy dance!!!
The fun begins from here.....
Thanks everybody!
Annette
ramesh kumar
Ranch Hand

Joined: Nov 16, 2000
Posts: 32
congrats, it must be a great achievement for u now,
All the best buddy.
Ramesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error #704....uhg!