Exception.printStackTrace

When I run code in the WTK emulator, I get a detailed stack trace. It actually says the name of the method when the exception occurred. Now I am running the code on the device, and the stack trace it gives me is useless. So, my question is, is there any way to find out what the offending method is?
java.lang.NullPointerException
Frame 120c77f8 contents:
Previous frame....: 120c77d8
Previous ip.......: 10313b03 (offset within invoking method: 123)
Method............: 1025e428 'printStackTrace()V' (virtual)
Class.............: 1023352c java/lang/Throwable
Bytecode..........: 102399b7
Exception handlers: 00000000
Frame size........: 1 (1 arguments, 0 local variables)
Argument[0].......: 120cb1f0
Frame 120c77d8 contents:
Previous frame....: 120c77d0
Previous ip.......: 00000000
Method............: 10313b6c 'run()V' (virtual)
Class.............: 10315a8c a/a/b/a
Bytecode..........: 10313a88
Exception handlers: 10313a80
Frame size........: 2 (1 arguments, 1 local variables)
Argument[0].......: 120c64f0
Local[1]..........: 120cb1f0

Hi, sorry I don't think your going to get much info, without using emulators, I recomend using more than just the WTK, try it in the emulator of the target phone.
I'd guess from "Method............: 10313b6c 'run()V' (virtual)" the error is thrown in 'void run()'.

Similar Messages

  • Printing exceptions (printStackTrace()) in a file

    Dear everyone,
    I need to print the exceptions' stack traces in a file
    (e.printStackTrace()).
    How do I do that?
    I attempted by setting the out stream (System.setOut())
    to my file's print stream. But it didn't work.
    Thanks a bunch for your help!
    George

    Simple :
      try {
        //code
      } catch (Throwable t) {
        PrintWriter writer = new PrintWriter(new FileWriter("c:\\temp\\error.txt"));
        t.printStackTrace(writer);
        writer.flush();
        writer.close();
      }

  • How to reduce output line of  exception.printStackTrace()

    hi,
    i just want to print on console where exception eactly occured this is enough..but when i call e.printStackTrace()  it give a long list of stack trace...
    most probably just few 3 or 4 line is enough when i ask e.printStackTracehow to do this in java.. what are method i have to override in Throwable class.. plz

    The Exception class provides all this information, you don't necessarily have to invoke printStackTrace(). Read up on the API for Exception and you'll find several useful methods that you could call to retrieve just the information you like.
    On a side note, you'll be surprised how often some of that extraneous information will be helpful when trying to debug your code.

  • Writing Exception.printStackTrace to a string

    Hi,
    I need to write the exception strack trace to a String so that I can email it details of exceptions on a web site to a system administrator.
    The printStackTrace() method prints exactly what I want to an OutputStream (such as system.out) but I don't know how I can get this into a string. Simply doing Exception.toString() does not produce enough detail about the exception to make it useful.
    Can anyone help?
    Below is some code that demonstrates what I'm trying to do but does not work because the printStackTrace() method on the exception object doesn't write to a string.
    try {
    // Some exception here, in this case / by 0
    int i = 7 / 0;
    catch (Exception e) {
    // This is too short and does not give enough information
    String exceptionInfoShort = e.toString()
    // This is what I want to do but it is not supported
    String exceptionInfoLong = e.printStackTrace();
    Cheers,
    Brent.

    No point messing about with PrintWriters and StringWriters. When you call e.printStackTrace() the method will construct a StringBuffer from every item in the stack trace and then print out the String representation of the buffer.
    You could do this yourself if only you could get the stack trace. Strangely, there is a method Exception.getStackTrace() that does exactly that (amasing what you can learn in two seconds from the API):
    void eMailStackTrace(Exception e) {
       StackTraceElement[] trace = e.getStackTrace();
       StringBuffer stackTraceBuffer = new StringBuffer();
       for(int i = 0 ; i < trace.length ; i++)
          stackTraceBuffer.append(trace.toString());
    String stackTrace = stackTraceBuffer.toString();
    email(stackTrace);

  • Exception handling in JSF

    This question has been asked time and again, without any clear answers to it. I would appreciate if some one can help me on this.
    I am developing a web application with the following architecture:
    JSF page calls backing bean methods which calls the service methods. Now my service methods can throw different exceptions like ValidationException, BusinessException, SystemException etc.
    Now, what i want to do is : If Validation/Business Exceptions are thrown show the error messages to the user on the same page from which the action was called. And if a SystemException is thrown navigate to a default error page.
    How can i handle this thing? Any clues?

    Thanks for the reply BalusC,
    I checked the log files (application log as well as server log) also and there is no other stack trace besides of the exception which i am throwing. Let me elaborate on the exact issue:
    I am trying to handle concurrency issues in my application. For example, When two users simultaneously try to edit the same record, the user who first saves the changes successfully. Now when the second user tries to save the changes i want to show him a message that "This record has been modified after you opened it for edit. Please refresh your page and reapply the changes". To show this message i am throwing a BusinessException from my service, which in turn gets propagated to my saveAction method. The saveAction method needs to handle this exception and somehow should show the above message to the user.
    To achieve this,
    1. i tried catching the exception in my saveAction and added the necessary faces message to FacesContext object. But it does not work. Later i read the reason behind this too, that in the invoke application phase a new context will be created and the messages will not be available to it.
    2. I then added the throws clause to my saveAction method, so that my default exception handler will handle it.
    saveAction method signature :
    public String saveAction () throws BusinessException {
        //some code here for save
        return null;
    }This is my code for the ErrorHandler.jsp:
    <body>
            <h1 style="color: red">Error</h1><br/><%
                 // print stack trace.
                ExceptionHandler exceptionHandler = new ExceptionHandler();
                 // unwrap ServletExceptions.
                while (exception instanceof ServletException || exception instanceof FacesException ||
                        exception instanceof ApplicationException) {
                    if(exception instanceof ServletException) {
                        exception = ((ServletException) exception).getRootCause();
                    } else if(exception instanceof FacesException) {
                        exception = ((FacesException) exception).getCause();
                    } else if(exception instanceof ApplicationException) {
                        exception = ((ApplicationException) exception).getCause();
      %><font color="red"><%=exceptionHandler.handleException(exception)%></font><br/></body>and this is my code for the handleException method defined in the ExceptionHandler.java:
    public static String getMessage(final String msgKey, final Object args[]) {
            String message = messages.getProperty(msgKey);
            if(args != null) {
                final String replaceArgs[] = (String[]) args;
                for(int i = 0; i < replaceArgs.length; i++)
                    message = message.replaceFirst("{" + i + "}", replaceArgs);
    return message;
    public String handleException(final Throwable exception) {
    logger.debug("handleException called..");
    String errorMessage = "Unknown error occured.";
    String stackTrace = "Stacktrace can not be found. Please check the logs for more details.";
    String errorString = null;
    final StringWriter stringWriter = new StringWriter();
    if(exception != null) {
    exception.printStackTrace (new PrintWriter (stringWriter));
    stackTrace = stringWriter.toString();
    errorMessage = getMessage(exception.getMessage(), null);
    errorString = "<b>" + errorMessage + "</b> <br> </br> <br> <input id=\"show\" type=\"button\" value=\"Show Details >>\" onClick=\"toggle();\" /> <div id=\"errorStackTrace\" style=\"display:none;\" > <pre>" + stackTrace + "</pre> </div>";
    return errorString;
    With the help of this code, i am simply trying to navigate to the error page if an exception occurs and display the appropriate error message with the stacktrace.
    The strange thing is, the ErrorHandler.jsp page correctly gets called, which in turn calls the handleException method which returns the formatted error string. (I checked this by adding log statements everywhere). But the system does not actually navigates to the ErrorHandler.jsp page and shows an alert with the following message : "Request error, status : 500 Internal Server Error message : "
    Can someone help me figure out what exactly the problem is?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Exception stack trace not found

    Hi all,
    I am using weblogic 92 application server.
    The deployed J2EE application has calls to exception.printStackTrace.
    I turned on Redirect Stdout Logging Enabled setting in the admin console and restarted the server. But I can see only log4j messages but not the output of the printstacktrace() method in the serverxxx.log/.out files.
    Is there any other setting I need to set or any other file I need to look for?
    Your help is highly appreciated.
    Thanks in advance for your valuable interest and time.

    Hi,
    We have already checked this guide.
    on the receiver side I am using JDBC
    in message monitoring I am getting given below errors
    Error Attempt to establish database connection failed with SQL error com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:sqlserver://10.1.45.36:1433;databaseName=XIT': UnsupportedClassVersionError: com/microsoft/sqlserver/jdbc/SQLServerDriver (Unsupported major.minor version 50.0)
    2009-02-03 16:20:57 Error Exception caught by adapter framework: Database connection could not be established
    2009-02-03 16:20:57 Error Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Database connection could not be established.
    2009-02-03 16:20:57 Error The message status set to NDLV.
    When we checked the entries in provider.xml after the req deployment ,
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE provider-descriptor SYSTEM "library.provider.dtd">
      <provider-descriptor>
        <display-name>com.sap.aii.af.jmsproviderlib</display-name>
        <component-name>com.sap.aii.af.jmsproviderlib</component-name>
        <major-version>7</major-version>
        <minor-version>0</minor-version>
        <micro-version>6</micro-version>
        <provider-name>sap.com</provider-name>
          <references>
             <reference type="library" strength="weak">jms</reference>
          </references>
        <jars>
         <jar-name>sqljdbc.jar</jar-name>
         <jar-name>sqljdbc4.jar</jar-name>
        </jars>
      </provider-descriptor>
    Can nebody comment on the same.
    Regards,
    Prashant

  • Problem accessing exception object in jsp error page - Apache Tomcat 5.0.25

    Hi all,
    I'm thoroughly confused and need some help. I've deployed a very simple web application in Apache Tomcat 5.0.25 to test exception handling - errortest.jsp and error.jsp. errortest.jsp throws a divide by zero exception if executed with default values in text fields.
    When I put the directive IsErrorPage="true" in error.jsp i get a HTTP 500 error when error.jsp is accessed. If I remove it error.jsp is displayed but I cant access the exception object - if I try to I get an exception below:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 5 in the jsp file: /error.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    E:\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mywebapp\org\apache\jsp\error_jsp.java:46: cannot resolve symbol
    symbol : variable exception
    location: class org.apache.jsp.error_jsp
    out.print(exception.getMessage());
    ^
    1 error
    Below is the code for the two jsp pages:
    errortest.jsp:
    <%@ page errorPage="error.jsp" %>
    <html>
    <head><title>Error test</title></head>
    <body>     
         <form action="errortest.jsp" method="post">
         Enter first number:<input type="text" name="first" value="5"/><br>
         Enter second number:<input type="text" name="second" value="0"/><br>
         <input type="submit"/>
         </form>
         <%
         if (request.getMethod().equals("POST")) {
              int first = Integer.parseInt( request.getParameter( "first" ) );
              int second = Integer.parseInt( request.getParameter( "second" ) );
              int answer = first/second;
         %>
    </body>
    </html>
    NB: I am able to catch and display the exception if I use a try/catch block around the division as shown below.
    try {
    int answer = first/second;
    } catch( Exception e) {
    e.printStackTrace( new PrintWriter(out) );
    error.jsp (first draft)
    NB: HTTP 500 error occurs when directive "isErrorPage" is added:
    <%@ page isErrorPage="true" %>
    <html>
    <head><title>Error Page</title></head>
    <body>
    </body>
    </html>
    error.jsp (second draft)
    NB: directive is removed but exception thrown when implicit exception object is accessed. error.jsp displays if exception object is not accessed:
    <%@ page %>
    <html>
    <head><title>Error Page</title></head>
    <body>
    <%=exception.getMessage()%>
    </body>
    </html>
    Web server specs:
    Apache Tomcat 5.0.25
    Machine specs:
    Windows XP Pro
    Java environments:
    j2sdk1.4.2_03
    J2EE 1.4

    This works for me:
    throwError.jsp
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <%@ page language="java" errorPage="/error.jsp"
    contentType="text/html; charset=utf-8" %>
    <html>
    <head>
         <title>Throw Exception</title>
    </head>
    <body>
    Throwing exception....
    <%
    // throw ArithmeticException
    int badInt = 12/0;
    %>
    </body>
    </html>
    error.jsp
    <%@ page language="java" isErrorPage="true" %>
    <head><title>Doh!</title></head>
    An Error has occurred in this application.
    <% if (exception != null) { %>
    <pre><% exception.printStackTrace(new java.io.PrintWriter(out)); %></pre>
    <% } else { %>
    Please check your log files for further information.
    <% } %>

  • Java.lang.Exception: discarding statement JPanel0.add(JTextField0)

    This message appears when I try to save a Panel with all subcomponents.
    My programm saves JLabel in the resulting Xml-file but neither JTextField nor JComboBox, etc.
    I've checked my classes, and all subcomponents of my Spanel are JavaBeans.
    (Spanel extends JPanel and has a no-args constructor as well).
    So is it a JDK bug?
    Hope somebody can help me.
    This is my program :
    public static void serializeContainer(Container spanel,String fileName) throws IOException {
    FileOutputStream fos = new FileOutputStream(fileName);
    XMLEncoder encoder = new XMLEncoder(fos);
    encoder.setExceptionListener(new ExceptionListener() {
    public void exceptionThrown(Exception exception) {
    exception.printStackTrace();
    encoder.writeObject(spanel);
    encoder.close();
    And this is the printStackTrace :
    java.lang.Exception: discarding statement JPanel0.add(JTextField0);
         at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:333)
         at java.beans.DefaultPersistenceDelegate.invokeStatement(DefaultPersistenceDelegate.java:242)
         at java.beans.java_awt_Container_PersistenceDelegate.initialize(MetaData.java:378)
         at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)
         at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)
         at java.beans.javax_swing_JComponent_PersistenceDelegate.initialize(MetaData.java:565)
         at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)
         at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)
         at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:103)
         at java.beans.Encoder.writeObject(Encoder.java:55)
         at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
         at java.beans.Encoder.writeExpression(Encoder.java:260)
         at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:351)
         at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
         at java.beans.Encoder.writeObject(Encoder.java:55)
         at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
         at java.beans.Encoder.writeObject1(Encoder.java:192)
         at java.beans.Encoder.cloneStatement(Encoder.java:205)
         at java.beans.Encoder.writeStatement(Encoder.java:236)
         at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:320)
         at java.beans.DefaultPersistenceDelegate.invokeStatement(DefaultPersistenceDelegate.java:242)
         at java.beans.java_awt_Container_PersistenceDelegate.initialize(MetaData.java:378)
         at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)
         at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)
         at java.beans.javax_swing_JComponent_PersistenceDelegate.initialize(MetaData.java:565)
         at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)
         at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)
         at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)
         at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)
         at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:103)
         at java.beans.Encoder.writeObject(Encoder.java:55)
         at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
         at java.beans.Encoder.writeExpression(Encoder.java:260)
         at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:351)
         at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
         at java.beans.Encoder.writeObject(Encoder.java:55)
         at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
         at java.beans.Encoder.writeObject1(Encoder.java:192)
         at java.beans.Encoder.cloneStatement(Encoder.java:205)
         at java.beans.Encoder.writeStatement(Encoder.java:236)
         at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:320)
         at java.beans.XMLEncoder.writeObject(XMLEncoder.java:253)
         at coneco.workflow.painter.util.ObjectUtils.serializeContainer(ObjectUtils.java:91)
         at coneco.workflow.painter.SerializeListener.actionPerformed(SerializeListener.java:90)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1767)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1820)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1092)
         at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:932)
         at java.awt.Component.processMouseEvent(Component.java:5021)
         at java.awt.Component.processEvent(Component.java:4818)
         at java.awt.Container.processEvent(Container.java:1380)
         at java.awt.Component.dispatchEventImpl(Component.java:3526)
         at java.awt.Container.dispatchEventImpl(Container.java:1437)
         at java.awt.Component.dispatchEvent(Component.java:3367)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3214)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2929)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2859)
         at java.awt.Container.dispatchEventImpl(Container.java:1423)
         at java.awt.Window.dispatchEventImpl(Window.java:1566)
         at java.awt.Component.dispatchEvent(Component.java:3367)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)

    This message appears when I try to save a Panel with all subcomponents.
    My programm saves JLabel in the resulting Xml-file but neither JTextField nor JComboBox, etc.
    I've checked my classes, and all subcomponents of my Spanel are JavaBeans.
    (Spanel extends JPanel and has a no-args constructor as well).
    So is it a JDK bug?
    Hope somebody can help me.
    This is my program :
    public static void serializeContainer(Container spanel,String fileName) throws IOException {
    FileOutputStream fos = new FileOutputStream(fileName);
    XMLEncoder encoder = new XMLEncoder(fos);
    encoder.setExceptionListener(new ExceptionListener() {
    public void exceptionThrown(Exception exception) {
    exception.printStackTrace();
    encoder.writeObject(spanel);
    encoder.close();
    And this is the printStackTrace :
    java.lang.Exception: discarding statement JPanel0.add(JTextField0);
         at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:333)
         at java.beans.DefaultPersistenceDelegate.invokeStatement(DefaultPersistenceDelegate.java:242)
         at java.beans.java_awt_Container_PersistenceDelegate.initialize(MetaData.java:378)
         at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)
         at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)
         at java.beans.javax_swing_JComponent_PersistenceDelegate.initialize(MetaData.java:565)
         at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)
         at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)
         at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:103)
         at java.beans.Encoder.writeObject(Encoder.java:55)
         at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
         at java.beans.Encoder.writeExpression(Encoder.java:260)
         at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:351)
         at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
         at java.beans.Encoder.writeObject(Encoder.java:55)
         at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
         at java.beans.Encoder.writeObject1(Encoder.java:192)
         at java.beans.Encoder.cloneStatement(Encoder.java:205)
         at java.beans.Encoder.writeStatement(Encoder.java:236)
         at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:320)
         at java.beans.DefaultPersistenceDelegate.invokeStatement(DefaultPersistenceDelegate.java:242)
         at java.beans.java_awt_Container_PersistenceDelegate.initialize(MetaData.java:378)
         at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)
         at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)
         at java.beans.javax_swing_JComponent_PersistenceDelegate.initialize(MetaData.java:565)
         at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)
         at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)
         at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)
         at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)
         at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:103)
         at java.beans.Encoder.writeObject(Encoder.java:55)
         at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
         at java.beans.Encoder.writeExpression(Encoder.java:260)
         at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:351)
         at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
         at java.beans.Encoder.writeObject(Encoder.java:55)
         at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
         at java.beans.Encoder.writeObject1(Encoder.java:192)
         at java.beans.Encoder.cloneStatement(Encoder.java:205)
         at java.beans.Encoder.writeStatement(Encoder.java:236)
         at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:320)
         at java.beans.XMLEncoder.writeObject(XMLEncoder.java:253)
         at coneco.workflow.painter.util.ObjectUtils.serializeContainer(ObjectUtils.java:91)
         at coneco.workflow.painter.SerializeListener.actionPerformed(SerializeListener.java:90)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1767)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1820)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1092)
         at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:932)
         at java.awt.Component.processMouseEvent(Component.java:5021)
         at java.awt.Component.processEvent(Component.java:4818)
         at java.awt.Container.processEvent(Container.java:1380)
         at java.awt.Component.dispatchEventImpl(Component.java:3526)
         at java.awt.Container.dispatchEventImpl(Container.java:1437)
         at java.awt.Component.dispatchEvent(Component.java:3367)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3214)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2929)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2859)
         at java.awt.Container.dispatchEventImpl(Container.java:1423)
         at java.awt.Window.dispatchEventImpl(Window.java:1566)
         at java.awt.Component.dispatchEvent(Component.java:3367)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)

  • Display detail exception message in af:messages

    Hi!
    I'm using ADF BC 10.1.3.3. I've created a backing bean event that calls Row.validate() method since before I call commit I want to ensure all the validation is passed or else the user is redirected to another page without committing the changes. Well, after the Row.validate call I'm catching the exception. But the problem I'm facing is that I'd like to display the detailed message of the exception caught which holds the actual validation message I defined on the model layer. If I use only Exception.getMessage() I receive the JBO-27024: Failed to validate a row with... message.
    But using the Exception.printStackTrace I can see in JDeveloper output console something like this:
    oracle.jbo.RowValException: JBO-27024:
    +...+
    +     at java.lang.Thread.run(Thread.java:595)+
    +## Detail 0 ##+
    oracle.jbo.RowValException: THE ACTUAL VALIDATION MESSAGE I DEFINED ON MODEL LAYER
    +     at oracle.jbo.rules.RulesBeanUtils.raiseException(RulesBeanUtils.java:206)+
    +...+
    Is there a way I could get the message from Detail 0 in my Catch block in the backing bean? I thought that using getStackTrace could help but there are only records to "+at java.lang.Thread.run(Thread.java:595)+" and not from Detail 0 part.
    I hope my question is clear and maybe there is another approach to achieve this.
    I'm doing it this way since the jspx opened doesn't consists of all the attributes from the VO's row but the validation on the Model layer is executed on those attributes anyway. So I need to display a massage that the process can't be completed and it would be very nice to display the actual problem instead of the JBO-27024 message.
    Thank you in advance,
    regards!
    BB

    Thanks John,
    I was catching all exceptions and Exception class doesn't have any appropriate methods. Catching RowValException I'm able to get reference to all detail exceptions.
    Regards!

  • How to use printStackTrace method?

    I've used the printStackTrace in my last line of JSP code. But I got the error compilation, why ?
    I used:
    Exception.printStackTrace(new PrintWriter(out));
    Compilation error occured:
    Found 1 errors in JSP file:
    E:\\jrun\\servers\\default\\default-app\\cusdb\\actjoin_insert.jsp:78: Error: The method "printStackTrace" does not denote a class method.

    printStackTrace is not a static method.
    A usage example:try
      aMethod("Hello World");
    catch(Exception e)
      e.printStackTrace(out);
    }

  • Exceptions inside threads

    hi,
    it seems to me like checked exceptions can't be thrown inside threads. is there any way to throw them? another question, even more important, is: where both runtime and checked exceptions end up in the case they occur inside a thread (within the run() method), that is, where in the code could i catch them?
    thank you for the help.

    1. Of course you can throw a checked exception inside a Thread, you just can't let it escape the Run method. ;->
    2. If an exception remains uncaught and propogrates outside of the run() method, the Thread will be stopped (since run() exited) and the Exception will be caught by the JVM and passed to the uncaughtException() method of the ThreadGroup to which that thread belongs. By default this method either propogates the call to its parent ThreadGroup or (if it is the outer most parent) will call Exception.printStackTrace() sending the output to stderr.
    Chuck

  • Super Class Examples of Exception

    HELP!!!
    I'm in need of assistance. I do not get Super classes and really how they work. Our book goes into such detail, it doesn't really give us a little example to work from for understanding. So here is a question: I need is Use Inheritance to create an exception class (ExceptionA) which is the super class, then subclasses ExceptionB class and ExceptionC class which both B and C classes inherit from A. We are suppose to write a program to catch block for type ExceptionA catches exceptions of types ExceptionB and ExceptionC.
    I can't grasp the concept of how to put these together. I'm not sure where the main method fits in all of these and does each have a try/catch that calls something from ExceptionA?

    Ok..I'm just looking for help, yes an ANSWER to how to utilize (1) inheritance and then (2) to incorporate that into my homework. For example, I have an ExceptionA Class super, a subclass ExceptionB and a subclass ExceptionC. I'm really lost as to where do I put the main method. I have 3 methods, where do I put these and how do I call them. Does anyone have a little snippet of code that shows very basically a super class, a subclass that calls the superclass, and another subclass that calls the superclass and where the main fits in all of that. Below is all my code.
    * Figure 13.17 Catching Exceptions with Superclasses
    package Dialogs;
    //superclass Exception
    public class ExceptionA
         //start of main method
            public static void main( String args[] )
               try
                    //call method one
                    one();
                catch ( Exception exception )
                     exception.printStackTrace();
                }//end of try/catch for main
              } //end main method
    }//end of ExceptionA
    package Dialogs;
    public class ExceptionsB extends ExceptionA
         // exceptions back to main with one
         public static void one() throws Exception
          try
              //call method two
              two();
          } // end try
          catch ( Exception exception )
             throw new Exception( "Exception in one", exception );
          } // end try/catch for method one
         } // end method one
    }//end of class ExceptionsB
    package Dialogs;
    public class ExceptionC extends ExceptionA
       // two method throws back to one
       public static void two() throws Exception
          try
              //call method 3
             three();
          catch ( Exception exception )
             throw new Exception( "Exception in two", exception );
          } // end of try/catch two
       } // end method 2
       // throws Exception back to two
       public static void three() throws Exception
          throw new Exception( "Exception in three" );
       } // end method 3
    }

  • Java exceptions

    Hello
    I'm using HttpsURLConnection class and when I acces a page a get the exception "java.io.IOException: Server returned HTTP response code: 500 for URL".
    I would like to be able to read the "input" variable(BufferedReader) even when I receive this exception.
    It is possible to skip an exception?
    try {
    InputStream ins = con.getInputStream(); //the exception is triggered by this line
    InputStreamReader isr = new InputStreamReader(ins);
    BufferedReader input = new BufferedReader(isr); //I want to read this input variable
    } catch(Exception exception) {
    exception.printStackTrace();
    Thank you.

    HttpURLConnection.getErrorStream() seems to be what you need (in the catch block).
    Edited by: baftos on Jun 13, 2011 4:55 PM

  • Forte Debugger Question - How to break on exception?

    I am running my midlet under Forte Community Edition 3.0, and I am trying to track down a crash. The output window shows that a NullPointerException was thrown, so it should be a simple matter of finding the line with the offending allocation, but I cant find any way to make the debugger break on an exception. Is this possible?
    Thx,
    Fred

    I'll answer my own question here....the best thing I have found so far is to put a high level catch in the code, then call Exception.printStackTrace in the catch block. Its not ideal, but it helps find the offending code.
    Fred

  • How to print out the exception caught in the servlet controller to JSP?

    May I know how to print the Exception caught and the stacktrace thing? What i try to do this in the databaseErrata.jsp code was not given me any answer. Instead, causing a number of errors.
    Below are my servlet controller code and databaseErrata.jsp code.
    ----$CATALINA_HOME/webapps/mvct/WEB-INF/classes/Action.java----
    import java.io.*;
    import java.sql.*;
    import java.text.*;
    import javax.naming.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import foo.*;
    public class Action extends HttpServlet
      public void doGet(HttpServletRequest request,
    HttpServletResponse response)
        throws ServletException, IOException
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        // find real web resource
        String forward = request.getServletPath();
    //'forward' is a string variable consist of url
        if(forward.endsWith(".do"))
          forward = forward.substring(1, forward.length()
    -3) + ".jsp";
        else
          throw new ServletException(
          "Action servlet called with illegal path: " +
    forward); //display the defined error msg and error
    url within the 'forward'
    out.println("forward after forward.substring() = " +
    forward + "</br>");
        // build and validate view page attributes
        HttpSession session = request.getSession();
        try
          byEmployeeId convert =
    (byEmployeeId)session.getAttribute("convert");
          if(convert == null)
            session.setAttribute("convert", convert = new
    byEmployeeId());
          convert.start("11145");
        catch(NamingException ex)
          request.setAttribute("exception", ex);
          forward = "databaseError.jsp";
        catch(SQLException ex)
          request.setAttribute("exception", ex);
          forward = "databaseErrata.jsp";
        catch(IllegalArgumentException ex)
          request.setAttribute("message", "<FONT COLOR='red'>"+ex.getMessage()+"</font>");
        // forward request
        RequestDispatcher rd =
    request.getRequestDispatcher(forward);
        rd.forward(request,response);
    public void doPost(HttpServletRequest request,
    HttpServletResponse response)
        throws ServletException, IOException
          doGet(request, response);
    }----$CATALINA_HOME/webapps/mvct/databaseErrata.jsp----
    <% String message = (String)request.getAttribute("message"); %>
    <HTML>
    <HEAD>
    <TITLE>databaseErrata.jsp Page</TITLE>
    </HEAD>
    <BODY>
    <% if (message != null) { %>
    Message = <%= message %>
    <H1>databaseErrata.jsp Page</H1>
    </BODY>
    </HTML>

    You're missing a closing curly bracket in the JSP page.
    Also, this will only print the exception message. I would recommend passing on the whole Exception object.
    ie request.setAttribute("theException", ex);
    That way you have the exception object to print the stacktrace from.
    However, you are doing this manually. The container can handle this stuff for you if you so wish.
    Check the documentation on error pages. You are able to set up an error page in the web.xml, that all exceptions/errors get directed to.
    something like:
    <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/errorPages/debugError.jsp</location>
    </error-page>
    You then write the JSP page something like this
    <%@ page language="java" %>
    <%@ page isErrorPage="true" %>
    <%@ page import="java.util.*, java.io.*" %>
    <h1>Programming error <BR> FOR DEBUGGING PURPOSES ONLY</h1>
    <p>This page is only for debugging purposes.  Should not be deployed to live environment.</p>
    <p>Details of the error are as follows:</p>
    <table border = 1 width=200>
    <tr><td valign=top><strong>Error :</strong></td><td><%=exception.getMessage()%></td></tr>
    <tr><td valign=top width='80%'><strong>Trace :</strong></td><td><pre><% exception.printStackTrace(new PrintWriter(out));%></pre></td></tr>
    </table>
    <br>Cheers,
    evnafets

Maybe you are looking for

  • Vi error on nfs mount; E212: Can't open file for writing

    Hi all, I've setup a umask of 0 for testing on both NFS client (Centos 5.2) and NFS server (OSX 10.5.5 server). I can create files as one user and edit/save out as another user w/o issue when directly logged into the server via ARD. However, when I a

  • Dazzle Hollywood DV Bridge

    Dear Guys, I have used the above for several years and sadly it has just died on me. I need to find a replacement and would like to ask for suggestions. I am just an amateur user and use this converter to convert some VHS recordings for personal use.

  • How to remove Blank Fields in Reports ASAP

    I have a bugging problem. I have Reports 6.0 in which My address section 5 Fields of address one below the other. Report runs perfectly But when I have Address of only three lines then the middle lines are left empty. How can I shift the lines below

  • Whata re the drivers fro DB2?

    I wnat to post details into DB2 database thro XI3.0 JDBC Adapter. What are the drivers to be installed for JDBC Adapter to work in XI3.0? Please advise. Thanks, Bhaskar

  • Catch SQLServerException

    I know that a method can throw an non-runtime exception, so that a calling method can either throw or catch that exception. Right now, I am not so sure of what would happen if I write something that catch a runtime exception. Here, I am using Eclipse