• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error handling in JSP

 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
I've run into a problem in JDBC and I want to see the error text on the errorpage I've declared in my JSP but when the errorpage loads, the code
<%= exception.getMessage() %>
prints the output 'null' on the errorpage.
Does this mean the exception details are not getting passed properly from the first JSP?
I know the exception has to do with a resultset from a bean not being scrollable - but I'll post THAT question over on the JDBC forum.
How would I get the bean to tell the JSP the details of the error?
Thanks in advance
------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On your error page, did you indicate that it is the error page?

I'd think it would be fairly vendor specific but the exception oject may not be populated without it...
Dave.
[This message has been edited by David O'Meara (edited October 14, 2001).]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suppose it is possible that the Exception does not have a message so null is the right output.
You might try exception.printStackTrace( out ) to get more information.
Bill
------------------
author of:
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
Thanks to both of you.
David:
<%@page isErrorPage="true"%> is already on the page
Bill:
I inserted the code as you suggested and I got the following error message:
An error occurred at line: 22 in the jsp file: /jsp/errorpage.jsp
Generated servlet error:
C:\Tomcat4\work\localhost\examples\jsp\errorpage$jsp.java:66: Incompatible type for method. Can't convert javax.servlet.jsp.JspWriter to java.io.PrintWriter.
out.print( exception.printStackTrace( out ) );
^
1 error
Any ideas?
Thanks very much,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by William Brogden:
I suppose it is possible that the Exception does not have a message so null is the right output.


Nice point
Hmm, streams, one of my weaknesses, you could try some thing like this:

Not incredibly pretty, (stole it from some of my other code) but it should get you started
Dave.
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI David,
I tried your code but I got these errors:

Should I be importing any special classes here?
Thanks,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.io.*
Dave.
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Dave,
I had tried it earlier and then removed it (silly me!)
Thing is now I'm getting the error message I don't understand it
Here it is:

and here's the bean method:

The bean works perfectly well if I don't pass any args into the createStatement() method.
Any help will be appreciated,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a complete stab in the dark and after looking at the description for AbstractMethodError, I'm guessing you should stop Tomcat, recompile everything you can then restart Tomcat

Thrown when an application tries to call an abstract method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled.


(Good luck, I'm going home so hopefully William Brogden or another capable soul will assist)
Dave.
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
I restarted and recompiled everything but to no avail.
I'll have to go over the java.sql docs to see what abstract method I am invoking or not to create this error.
Bye,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic