There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
james smitho wrote:Yes, you were right. I deleted that. But still error;
unreported exception java.lang.Exception; must be caught or declared to be thrown
[javac] Connection db = Data.getConnection();
^
Should I change Connection db ???
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
james smitho wrote:Indeed. Well, I think this is correct . But still same error than last time.
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
james smitho wrote:Thanks for answering. I'm going crazy with this.
I tried like this;
And now I tried to change like you suggested;
But error; cannot find symbol
[javac] symbol : variable db
[javac] location: class theater.BasicServlet
( I think your line is better than mine, but how we solve this problem? )
james smitho wrote:I don't know how this problem go away? Please, help.
But: still compiler says;
unreported exception java.lang.Exception; must be caught or declared to be thrown
[javac] Connection db = Data.getConnection();
[javac] ^
SCJP, SCWCD
james smitho wrote:Hi. Thank you. So the problem is a line
in Search- class. ? But how I solve that??
I don't know how?! Please help.
But still that same error in Search- class;
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
james smitho wrote:Thanks. All right, that must be the reason! This is my best shot. ( I don't have a chance to test this for hours...unfortunately...).
But does that exception ( same as in other class... ) look good?
Or if it doesn't, how should it be changed in this case?
SCJP, SCWCD
# .java:96: db is already defined in doPost(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
# [javac] Connection db = null;
# [javac] ^
# .java:137: db is already defined in doPost(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
# [javac] Connection db = null;
# [javac] ^
# [javac] 7 errors
#
# BUILD FAILED
# cannot find symbol
# [javac] symbol : variable db
# [javac] location: class theater.BasicServlet
# [javac] db = Data.getConnection();
# [javac] ^
# .java:30: cannot find symbol
# [javac] symbol : variable db
# [javac] location: class theater.BasicServlet
# [javac] db = Data.getConnection();
# [javac] ^
# .java:31: cannot find symbol
# [javac] symbol : variable db
# [javac] location: class theater.BasicServlet
# [javac] execute(req, out, db);
# [javac] ^
# .java:37: cannot find symbol
# [javac] symbol : variable db
# [javac] location: class theater.BasicServlet
# [javac] if (db != null)
# [javac] ^
# .java:38: cannot find symbol
# [javac] symbol : variable db
# [javac] location: class theater.BasicServlet
# [javac] Data.closeConnection(db);
# [javac]
SCJP, SCWCD
Compiler is complaining that db var is not defined in BasicServlet.Rok Štelcer wrote:
This error has to do with BasicServlet and NOT with SearchServlet.
SCJP, SCWCD
SCJP, SCWCD