i'm launching applet from jsp. For some data its working fine. when the data are really too big,its throwing Java heap space error. I increased the JVM to -Xmx512m
in Java Runtime Environment Settings.
But still getting the same error. If i run from html i'm not getting the error. Only when i launch it from Jsp i'm getting this error. I'm using Tomcat 5.5
If it's big enough that one call uses up all the ram you have in a JVM with 512m allotted, then it's probably more than what you want to be loading into a JSP to pass to an applet. You might find that increasing the heap space further will stop the problem in Tomcat but I suspect that you're going to run into issues either with the network or in the client.
Have you considered restructuring your app to first load the applet and then have the applet make calls to the server to get chunks of XML data as it needs it, instead of trying to pass the whole thing to your applet right up front?
Joined: Oct 21, 2008
should i have to increase m/y space for tomcat seperately? I have just set the memory space in control Panel --->java ---->java ---->runtime settings.
First it is a good idea to move this piece of code out from JSP to a Java class. It may not help you with the OutOfMemoryError but it is a good practice..
What is the size of the xml you store in your database column?
Usually BLOB datatype is used for storing such huge amount of Data. Instead of loading the entire data into a String i would suggest you to get an InputStream for this BLOB and use SAX parser to parse it.
I am sure not all details in the file needs to be passed to the client
Not sure if increasing the Heap size would help to a great extent, more the number of users more the memory usage and more the chances of OOME, you need to redesign somewhere.
If you can give some details of what you are trying to achieve maybe somebody can throw some light on it.