Why cannot my servlet catch any errors?

my default-err or default-out file does not catch any erro when i run my servlet my servet is as below. i am using Jrun, on a win 2000 server.
public void makeConnection(){
try{
String url = "jdbc:odbc:Employees";
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
c = DriverManager.getConnection(url,"sa","as");
          } catch (java.sql.SQLException e) {
               System.out.println("Cannot get connection"+e);
          } catch (java.lang.ClassNotFoundException e) {
               System.out.println("Driver class not found"+e);
     } catch(Exception e){System.out.println("error"+e);}
     }

Well, there's the chance that it's not throwing an exception, but I assume from your post that it should be throwing one. My experience with servlet containers in general shows that one of two things (at least) may be happening.
1) The sys-out err-out is being cached and only periodically flushed to either the event logs or log files.
2) The System.out and System.err are not being directed into the default-err and default-out as the servlet container has it's own environment stdout and stderr directed there, and isn't multiplexing.
The safest way to try this out for real is to open a log file yourself and write the error log, or for a quicker, cleaner short-term solution actually write an HTML (or whatever you're returning to the client) info/error page with the error info embedded inside.
Hope that helps. :-)
Dallas

Similar Messages

  • Catch any error message (dumps) in B2B and show own text

    Hi, all
    How we can catch any error messages (dumps) in the B2B?
    How we can show own text like this 'Site under construction. Please visit later...after 1 hour... '
    Denis

    Option 1(dirty approach): modify your runtimeexception jsp
    Option 2(better approach): on your load balancer (like F5 or SAP web dispatcher) configure such that all HTTP500 response codes are redirected to a hub page which has your custom text or images
    pradeep

  • Basic error handling: how to catch all errors in a portion of code (and act accordingly)

    I have a portion of code in a VI that I know is likely to fail at some point (opening a file, then reading two arrays from it: the file can be absent, or contain the wrong data).
    I would like to be able to catch any errors that may occur during this procedure, and if such an error occurs launch a pre-defined action (return a default value, for instance).
    Is there a simple way to do this, in a way similar to the disabling of a portion of code with a Diagram Disable structure ?

    use the "bundle by name" function to set the individual elements of the error cluster to the values you want.
    CLA, LabVIEW Versions 2010-2013

  • Catching DateValidator errors

    I am trhying to use a DateValidator in ActionScript to
    validate fields before going to a new screen. I need to catch any
    errors from the validator and not display them. Has anyone came
    across a way to catch errors from validators? Here is the code I am
    working with:

    Hi,
    There is a section in the doc on handling validator errors
    here:
    http://livedocs.macromedia.com/flex/2/docs/00001068.html
    You can see the entire chapter on validators here:
    http://livedocs.macromedia.com/flex/2/docs/00001054.html
    Stephen
    "dzlmbq" <[email protected]> wrote in
    message
    news:e90b31$k5l$[email protected]..
    >I am trhying to use a DateValidator in ActionScript to
    validate fields
    >before
    > going to a new screen. I need to catch any errors from
    the validator and
    > not
    > display them. Has anyone came across a way to catch
    errors from
    > validators?
    > Here is the code I am working with:
    >
    >
    >
    > <?xml version="1.0" encoding="utf-8"?>
    > <mx:Application xmlns:mx="
    http://www.macromedia.com/2003/mxml"
    > xmlns:local="*"
    > backgroundColor="#FFFFFF">
    >
    > <mx:Script>
    > <![CDATA[
    > import mx.controls.Alert;
    >
    > var localDateField:String = "";
    >
    > private function validateDate():Void {
    > try {
    > localDateField = taMain.text;
    >
    > mx.validators.DateValidator.isValid(this,
    'localDateField');
    > } catch (e) {
    > Alert.show(e);
    > }
    > }
    > ]]>
    > </mx:Script>
    >
    > <mx:DateValidator field="localDateField"
    allowedFormatChars="/" />
    >
    > <mx:VBox id="main" >
    > <mx:TextArea id="taMain" height="20" />
    > <mx:Button label="Validate Date"
    click="validateDate()" />
    > </mx:VBox>
    > </mx:Application>
    >

  • Why i am not getting an error???

    Dear sirs...
    i created an application to upload files to the database using JDeveloper 10.1.2.1.0 and UIX. The field used to store the files is an intermedia field.
    Whenever i upload the file greater than 2M i get an error message. i modified the application such that it uploads 5M. now for attachments greater than 5M i get no error messages at all. the uploaded file is truncated to 5M and i do not get any error message.
    my question is:
    why i am not getting any error message??? what are the possible causes of this??? Does any one face such an error???
    thanks for any help in advance
    best regrads

    I haven't heard of such a limitation. I would recommend creating a reproducible testcase and opening a TAR on Metalink so our support engineers can help debug the issue, report a bug if you are encountering one, and help you determine a possible workaround. Thanks.

  • Wrapper cannot find servlet class error

    Hi all!
    I'm receiving a mysterious error when I try to run my web ap. "Wrapper cannot find servlet class com.ruffalocody.report.ReportServlet or a class it depends on"
    I'm running it on JBoss 3.2.7, and I have another web ap, made almost identical to this one which does not display the same error/exception.
    If anyone could give me advice on what I should do to fix this, I'd very much appreciate it. :)
    Full exception message:
    javax.servlet.ServletException: Wrapper cannot find servlet class com.ruffalocody.report.ReportServlet or a class it depends on
         org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
         org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:162)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
         org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         java.lang.Thread.run(Thread.java:534)
    root cause
    java.lang.ClassNotFoundException: com.ruffalocody.report.ReportServlet
         java.net.URLClassLoader$1.run(URLClassLoader.java:199)
         java.security.AccessController.doPrivileged(Native Method)
         java.net.URLClassLoader.findClass(URLClassLoader.java:187)
         java.lang.ClassLoader.loadClass(ClassLoader.java:289)
         java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
         org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:162)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
         org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         java.lang.Thread.run(Thread.java:534)the servlet class file ReportServlet.class is located in:
    WEB-INF\classes\com\ruffalocody\report
    web.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <servlet>
            <servlet-name>RprtSrvlt</servlet-name>
            <servlet-class>com.ruffalocody.report.ReportServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>RprtSrvlt</servlet-name>
            <url-pattern>/reports</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
         <welcome-file>
                index.jsp
            </welcome-file>
        </welcome-file-list>
        <!-- Context Param -->
        <context-param>
        <param-name>crystal_image_uri</param-name>
        <param-value>crystalreportviewers10</param-value>
        </context-param>
        <!-- Context Param End -->
    </web-app>It's called from the index.jsp page w/ ulr: "reports?goTo=view"
    Servlet code (not sure if it's useful, but including just in case):
    * ReportServlet.java
    * Created on February 1, 2007, 11:04 AM
    package com.ruffalocody.report;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory;
    import com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2;
    import com.crystaldecisions.sdk.occa.report.reportsource.IReportSource;
    import com.crystaldecisions.report.web.viewer.CrystalReportViewer;
    import com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase;
    * @author aerohner
    * @version
    public class ReportServlet extends HttpServlet
        String rptLoc = "CR10_JRC_BeginHere.rpt";
        /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
         * @param request servlet request
         * @param response servlet response
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
         response.setContentType("text/html;charset=UTF-8");
         String goTo = request.getParameter("goTo");
         if(goTo != null && goTo.equals("view"))
             viewReport(request, response);
         }// end goTo view
         else if(goTo != null && goTo.equals("export"))
             exportReport(request, response);
         }// end go to export
         else
             RequestDispatcher view = request.getRequestDispatcher("index.jsp");
             view.forward(request,response);
        private void viewReport(HttpServletRequest request,
             HttpServletResponse response) throws ServletException, IOException
         IReportSource rptSrc = setUpReportSource(request);
         if (rptSrc != null)
             // create viewer
             CrystalReportViewer viewer = new CrystalReportViewer();
             try
              viewer.setReportSource(rptSrc);
              forward(request, response, viewer);
             catch(ReportSDKExceptionBase e)
              e.printStackTrace();
         }// if rptsrc not null
         else
             log("rptSrc is null");
         }// end else not null
        }// end viewReport(.)
        private void exportReport(HttpServletRequest request, HttpServletResponse response)
        }// end exportReport(.)
        private IReportSource setUpReportSource(HttpServletRequest request)
         IReportSourceFactory2 rptFact = new JPEReportSourceFactory();
         IReportSource rptSrc = null;
         try
             rptSrc = (IReportSource)
              rptFact.createReportSource(rptLoc, request.getLocale());
         }// end try
         catch (Exception e)
         return rptSrc;
        }// end setUpReportSource()
        private void forward(HttpServletRequest request,
             HttpServletResponse response, Object viewer)
             throws ServletException, IOException
         request.setAttribute("viewer", viewer);
         RequestDispatcher view = request.getRequestDispatcher("viewer.jsp");
         view.forward(request,response);
        }// end forward(...)
        // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
        /** Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
         processRequest(request, response);
        /** Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
         processRequest(request, response);
        /** Returns a short description of the servlet.
        public String getServletInfo()
         return "Short description";
        // </editor-fold>
    }Thanks :)

    I'm curious. Could you strip off the "java." part of the package, so both in your sourcefile as in the directory structure? It may be that the java package is not allowed, but then I wouldn't know why you didn't get a compile error...

  • I'm wondering..why does the outermost exception always catch the error?

    hi
    why do sometimes (or everytime) i create a code which looks something like this..
    try{
        try{
              //some error here
        } catch (Exception e){
               System.out.println("got it here: " + e.getMessage();
    }catch (Exception e){
          System.out.println("got it here instead: " + e.getMessage();
    }it's always the outermost catch block caughts the error. In this example the line got it here instead: some error messageis displayed.
    I really thought for sure the inner exception is the one who should catch the error first, right? Furthermore they both catch the same thing (Exception).
    Any information is greatly appreciated. thanks

    No, you're wrong.I'm relieved to hear that. But why does my code always does what I mentioned above? here's my code (it's a partial code, actually. it takes too many lines to put all the codes here):
    void generatePIN(String Date){
              char currentCodeChar;
              int seeder=0, serialNumber=0000000;
              int currentNumberInt=0, nextNumber=0, currentCodeInt=0;
              String voucherSerial=null, PINnumber=null, currentNumber=null, currentCode=null, nextCode=null, currentSerial=null, nextSerial=null;
              int PIN1=0,PIN2=0;
              String query=null;
              PreparedStatement ps=null;
              ResultSet rs=null;
              try{
                   //this portion here is used for proper seeding random number
                   SecureRandom sr1 = SecureRandom.getInstance("SHA1PRNG");
                   seeder=sr1.nextInt();
                   if (seeder<0){
                        seeder=seeder*-1;
              }catch (Exception e){
                   System.out.println(e.getMessage());
                   System.exit(1);
              random = new Random(seeder);
              PIN1 = random.nextInt(89999999)+10000000;
              PIN2 = random.nextInt(89999999)+10000000;
              PINnumber = "" + PIN1 + PIN2;
              System.out.println("PIN number: " + PINnumber);
              //check serial number first before storing the pin & serial number in database
              //if serial number exist, regenerate the serial number
              try{
                   try{
                   query = "select * from data1";
                   ps = con.prepareStatement(query);     
                   rs = ps.executeQuery();
                             while (rs.next()){
                             currentSerial = rs.getString("SerialNo");
                   }catch (SQLException ex){
                        System.out.println("error here?" + ex.getMessage());
                   while (currentNumberInt<=9999999){
                        currentNumberInt++;                    
              }catch (Exception e){
                   JOptionPane.showMessageDialog(null,"Database error 1: " + e.getMessage());
                   return;
         }the database is empty. hence it returns an error when i tried getting some data from it. but i expected the error message should be:
    error here? some error message..instead of the
    Database error 1: some error message pop-up being displayed.
    Did i make any mistake in my code? I've spent hours on this..
    thanks for helping

  • Why am I now receiving the error 42404: a required iTunes component is not installed after the 10.5.3 iTunes update? Now, I cannot sync my iphone...

    Why am I now receiving the error 42404: a required iTunes component is not installed after the 10.5.3 iTunes update? Now, I cannot sync my iphone...I have uninstalled and re-installed several times now without any luck.
    Thanks,

    'The installer has insufficient privileges to modify this file C:\Program Files (x86)\Common Files\Apple\Apple Application Support\Web kit.resources\inspector\Images\Spinner Inactive Selected.gif.'
    That one's consistent with disk/file damage. The first thing I'd try with that is running a disk check (chkdsk) over your C drive.
    XP instructions in the following document: How to perform disk error checking in Windows XP
    Vista instructions in the following document: Check your hard disk for errors
    Windows 7 instructions in the following document: How to use CHKDSK (Check Disk)
    Select both Automatically fix file system errors and Scan for and attempt recovery of bad sectors, or use chkdsk /r (depending on which way you decide to go about doing this). You'll almost certainly have to schedule the chkdsk to run on startup. The scan should take quite a while ... if it quits after a few minutes or seconds, something's interfering with the scan.
    Does the chkdsk find/repair any damage? If so, can you get an install to go through properly afterwards?

  • Why  catch any other exception other than Exception ?

    Hi,
    I am under the following impression. Is my understanding correct?
    why do I need to catch any other exception other than Exception in the catch block.
    If I write code :
    try{
    //checked code
    }catch(Exception e){
    e.printStackTrace();
    e.getMessage();
    }the e.printStackTrace(); and e.getMessage(); will belt out the exact error message and the cause of it.
    Why then should I use any narrower excetpion than Exception (Like SQLException, in case of SQL code). ?

    You don't have to catch the specific exceptions. However, it makes the code clearer. If you have catch exception, then the next person to maintain that code, has to then study the try block to determine what, if anything, might be thrown in that block, in order to be able to effectively modify the code, whereas when you have catch CNF, then the next person to maintain the code knows, automatically, that that is the only possible exception (checked anyway) that should be thrown in that block.
    The other reason, is so that when varying (and especially unrelated, i.e. SQL and Parse) exceptions can be thrown, they can be handled differently.
    So, as a summary, it is either a matter of form, or a matter of completeness. But, yes, you can simply catch Exception, if you wish.
    Edit: The first point is also valid even when you are the only one who will ever see the code. I can't count the number of times where I have written something then had to revisit it years later, and thought to myself, WTF. (I have a tendency, if I don't "watch" myself to not comment my code enough, and, at the same time, tend to get a little more "clever" or "cryptic" than I absolutely have to.)

  • I cannot open Pages from the app or from a saved document on the desk top.  I get an error: "The application Pages cannot be opened  -1712"  Any suggestions?

    I cannot open Pages from the app or from a saved document on the desk top.  I get an error: "The application Pages cannot be opened  -1712"  Any suggestions?

    The following previous discussion has a solution that worked for a variety of people with the -1712 error on a variety of applications and may help: The application Safari can't be opened -1712

  • I have a an iMac 27" and am trying to import some videos of a friends wedding into iMovie however one of the movies won't import. It doesn't say why or give any error message or codes. All of the other movies on the card download with out a problem.

    I have an iMac 27" and am trying to import some videos of a friends wedding into iMovie however one of the movies won't import. It doesn't say why or give any error message or codes.
    All of the other movies on the card download with out a problem. The movie in question is not 'corrupt' as you can watch it in iMovie direct from the SD card but as soon as you try to import it, it  just says 'error'. iIve tried moving the file to an external drive ( and other variations on this theme) then importing but have had no luck.
    Can anyone please help me.

    The mystery remains....
    Thanks for the pointers. The file type is .mts (a proprietry sony one).
    I have now found some video converter software (Wondershare and iSkysoft) at a cost. Either will convert this file for me into .mp4. This I can then import into iMovie without any problems. I've checked this on the trial versions and it worked well but without paying am left with a giant watermark in the video
    The mystery (which I still havent solved) is why did 20 other .mts files import fine and then this one not?
    If you could point me in the direction of some free .mts converter software that would be the cherry on the cake.
    Thanks

  • HT1338 MacBook Pro 10.6.8 error 2008 cannot empty trash. Any new solution?

    MacBook Pro 10.6.8 error 2008 cannot empty trash. Any new solution?

    Okay.   Try Googling Macbook error 8003.   Item1 and others below it relate to that error.

  • When trying to install iTunes I get an error saying "a program needed to install itunes cannot be run".  Any ideas what that program is?

    My computer would not let me update my version of itunes so I was advised to uninstall and start fresh.  I still get the same error..."a program needed to complete the installation cannot run".  Can any one tell me what program they are referring to or if anyone has a fix for this?
    Mandee

    I'd start with the following user tip with that one:
    "There is a problem with this Windows Installer package ..." error messages when installing iTunes for Windows

  • HT2932 When I try to save a file from my GarageBand to my PC it keeps giving me a error message . Message says could not be copied because error occurred. The file cannot be found. Any suggestions?

    When I try to save a file from my GarageBand to my PC it keeps giving me a error message . Message says could not be copied because error occurred. The file cannot be found. Any suggestions?

    I was trying to upload from my iPad to my pc.
    That was hard for us to guess, from your post It might have helped to mention the iPad.
    How are you trying to save the song to your PC? Are you sending the song to iTunes? If yes, as a project or as an audio file? Make sure, you select "AAC" and not "GarageBand", when you share the song from your iPad.
    If the clip is not too large, you might alternately try to share it by mail, see:
    Share GarageBand songs

  • HT204003 if i open passbook on iphone 5, it always say cannot connect to itunes, any fix from apple tech support? and whats the reason for this problem? why do we have to figure it out and not even apple can give answer??

    if i open passbook on iphone 5, it always say cannot connect to itunes, any fix from apple tech support? and whats the reason for this problem? why do we have to figure it out and not even apple can give answer??

    actually i found out how to fix it
    1 sign out of apple account
    2 close down passbook app
    3 change year to 2013
    4 reopen passbook and sign in at the button with your apple ID
    5 change the time to auto update and it should work from now on.
    this worked for me let me know if it work for you:)

Maybe you are looking for

  • Getting values from select option

    Hi, I have a requirement where the user is going to pass values in select-option  in low and high. lets say s_bwart(movement types). now i have to fetch this bwart values into an internal table. my internal table will be having only one field that is

  • Calendar object without time

    Hi, I need to get a calendar object without displaying the time (hh:mm) field. Can smone help me with this?? Thanks in advance

  • [SOLVED] Problem installing gnome-extra packages

    I have completed the installation and all that left is gnome-extra packages. I fetched the packages and after the integrity check it says Failed to commit transaction invalid or corrupted packages gnome-games-3.0.21- <pacgae_info> is either invalid o

  • FW: iPlanet Web Server 4.x Advisory

    All-- A message from iPlanet about iWS: Recommend Immediate Patch/Upgrade We are writing to inform you of an important upgrade recommendation. iPlanet has identified a security vulnerability in the iPlanet Web Server Enterprise Edition 4.x products.

  • HP CN245B Photosmart all in one wireless e-printer B110a HAS DISAPPEARED from my computer?!

    Please help this Techno-phobe!!  My printer is no longer listed in Devices & Printers (so, obviously, will not print!).  Went to HP Solution centre & found a download that is supposed to fix this problem - specs included Windows 7 64bit (which mine i