I need to catch the complete java error stack trace from inline java. For example, the following is my java error stack trace when I run inline java in perl:
com.image.exception.ConversionException: Delete: deletion failed: temp +3d5140d9-ef4e-4e36-b8c5-e90166bb02c5.png at com.image.utils.ImageConverter.get(ImageConverter.java:389) at com.image.utils.Index.createPage(Index.java:522) at com.image.utils.createPage(Index.java:465) at com.image.Index.createDoc(Index.java:290) at com.image.RemImag.idxDoc(RemImag.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcc +essorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingM +ethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at InlineJavaUserClassLink.invoke(InlineJavaUserClassLink.java +:11) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcc +essorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingM +ethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.perl.inline.java.InlineJavaUserClassLoader.invoke_via_l +ink(InlineJavaUserClassLoader.java:86) at org.perl.inline.java.InlineJavaUserClassLoader.invoke(Inlin +eJavaUserClassLoader.java:131) at org.perl.inline.java.InlineJavaProtocol.CallJavaMethod(Inli +neJavaProtocol.java:283) at org.perl.inline.java.InlineJavaProtocol.Do(InlineJavaProtoc +ol.java:41) at org.perl.inline.java.InlineJavaServer.ProcessCommand(Inline +JavaServer.java:153) at org.perl.inline.java.InlineJavaServer.ProcessCommand(Inline +JavaServer.java:142) at org.perl.inline.java.InlineJavaServerThread.run(InlineJavaS +erverThread.java:51) But when I use the following to catch the stack trace: if ( caught("java.lang.Exception") ) { my $exception = $@; my $msg = $exception->getMessage(); my $string_writer = new java::io::StringWriter(); my $print_writer = new java::io::PrintWriter($string_w +riter); $exception->printStackTrace($print_writer); my $line = $string_writer->toString(); $errorLog->error($attachmentFilePath . "\n" . $msg . " +\n" . $line); } Only the following lines are recorded in the error log: java.lang.NullPointerException at com.image.RemImag.idxDoc(RemImag.java:81) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcc +essorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingM +ethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at InlineJavaUserClassLink.invoke(InlineJavaUserClassLink.java +:11) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcc +essorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingM +ethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.perl.inline.java.InlineJavaUserClassLoader.invoke_via_l +ink(InlineJavaUserClassLoader.java:86) at org.perl.inline.java.InlineJavaUserClassLoader.invoke(Inlin +eJavaUserClassLoader.java:131) at org.perl.inline.java.InlineJavaProtocol.CallJavaMethod(Inli +neJavaProtocol.java:283) at org.perl.inline.java.InlineJavaProtocol.Do(InlineJavaProtoc +ol.java:41) at org.perl.inline.java.InlineJavaServer.ProcessCommand(Inline +JavaServer.java:153) at org.perl.inline.java.InlineJavaServer.ProcessCommand(Inline +JavaServer.java:142) at org.perl.inline.java.InlineJavaServerThread.run(InlineJavaS +erverThread.java:51) It seems that it cut off the first few lines which are very important for me. How can I get the full stack trace by using inline java's exception caught? Thanks a lot!