5

I am getting the following java stackoverflow error on a xml transformation in weblogic server 10g hosted in sun solaris. This happens only for a particular xml tranformation and rest all xml transformation works fine. The xsl file used is also not very big.

I am using the Transformation api available in rt.jar but getting this error from xalan apache package(com.sun.org.apache.xalan.internal.xsltc.dom.SimpleResultTreeImpl) which I havent packaged in my application.

Another interesting thing is that I didnt get this exception when I run the application in weblogic 10g server hosted in windows machine, I get this only in sun solaris.

Can anyone let me know why I get this error.

Can you let me know which jar file is causing the exception ? Will weblogic have a xalan.jar ? If so I can try to upgrade the jar file and see if its working ?

Caused by: java.lang.StackOverflowError
    at com.sun.org.apache.xalan.internal.xsltc.dom.SimpleResultTreeImpl.characters(SimpleResultTreeImpl.java)
    at com.sun.org.apache.xalan.internal.xsltc.dom.SimpleResultTreeImpl.copy(SimpleResultTreeImpl.java:438)
    at com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.copy(BasisLibrary.java:1317)
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
    at GregorSamsa.replace()
mprabhat
  • 20,107
  • 7
  • 46
  • 63
Ashok Ambrose
  • 191
  • 3
  • 17
  • 3
    Well, without the XSL and sample XML it is going to be hard for anyone to help. The culprit looks like class `GregorSamsa`. – Jim Garrison Jun 05 '12 at 17:38
  • 8
    GregorSamsa has been transformed into a bug !? – JB Nizet Jun 05 '12 at 17:58
  • I agree with mr. Garrison that it is difficult to find the real reason without the files, but here goes a wild guess: is there some specific characteristic on the XSL that may cause it to become circular? – rlinden Jun 05 '12 at 18:05
  • Linden, There is no such specific characteristic in XSL to go circular. It is working fine in weblogic 10g hosted in windows machine but fails in sun solaris. More over I tried the XML XSL tranformation in xml spy too and its working. Need to know if weblogic has a default xalan jar file. I suspect if the xalan jar file should be updated to the latest ? Do you think so ? – Ashok Ambrose Jun 05 '12 at 18:53
  • 1
    Execution *should* be the same, so if it's different on the solaris, perhaps your classpath/settings are different: Have you updated all *other* jars, configuration files, etc on the solaris? Check your environments match each other, not just the jar containing your code. – Bohemian Jun 05 '12 at 18:53
  • 1
    This error can happen if the available RAM is too low. Is the Solaris machine's RAM less than that on the machines where the transformation runs successfully? Also, there should be runtime parameters defining the available stack and heap space -- the defaults can be very different on the two different platforms. – Dimitre Novatchev Jun 06 '12 at 03:46
  • 1
    A few things. If the xml is highly nested and/or HUGE, I could see a stack overflow. Secondly, and more likely, you are using an incorrect jar version on one of the environments. Note that doesn't mean the NEWEST jar. – aglassman Jun 07 '12 at 14:24

1 Answers1

4

It appears that there is some recursion happening here based on all the calls to GregorSamsa.replace(). The fact that it works on Windows and not Solaris could be due to different implementations of the JVM or more likely, default JVM options for stack size.

Here is what the JVM stack size option does.

Here is how you can increase the stack size in Eclipse.

Here is how you can set the stack size via command line along with more discussion on this topic:

$ javac TT.java
$ java -Xss4m TT

-Xss4m = 4 megs
-Xss1024k = 1024kb

If you want to launch a new thread from your application with a specified stack size for only that thread then take a look at the constructors for Thread class, including:

public Thread(ThreadGroup group, Runnable target,String name,long stackSize)
Community
  • 1
  • 1
Michael Freake
  • 1,197
  • 2
  • 14
  • 35
  • Thank you very much guys. Increasing the stack size to 1024k worked. But will this increase have a side effect on the performance since it borrows some memory from the heap? – Ashok Ambrose Jun 08 '12 at 20:45