Nov 29, 2017, 8:15 AM
1 Posts

Print printstacktrace to console

  • Category: Application Development
  • Platform: Linux
  • Release: 9.0.1
  • Role: Developer
  • Tags:
  • Replies: 1

I have a Java webagent that runs on a server. When it throws an error it should print the stacktrace to the console.

As an example I used a simple test agent that will generate an error (see below)

My problem is that when i call it on one server the stacktrace is printed:

hello world
java.lang.NullPointerException
    at JavaAgent.NotesMain(Unknown Source)
    at lotus.domino.AgentBase.runNotes(Unknown Source)
    at lotus.domino.NotesThread.run(Unknown Source)

But when i call it on another server just "hello world" is printed, no stacktrace.

Is there a setting where we can define this?

The server where the printstackTrace is printed is R9.0.1, where not is R8.5.3. However, this has always worked on the 9.0.1 servers when those where R8+

Sample agent:

  try 
          String[] x = null;
          System.out.println("hello world");
          x[0] ="dd";
          for (int i=0;i<4;i++)  System.out.println(x[i]);
         
      } catch(Exception e) {
          e.printStackTrace();
       }

 

Regards,
René

Dec 9, 2017, 11:54 PM
21 Posts
Try adding more code to debug the old fashioned way

Add some System.out.println before and after the loop, also before and after the stack trace. Ensure there is actually an exception happening and getting caught/handled.