Hello

Sometimes I update my web service JAR by deleting the old one (waiting for the undeploy message to appear on the console) and putting the new one (and seeing the deploy message) and when I call it, it gives a heap size error. I have to restart the PC and from then on, it works perfectly 9999999999 times over when I call it.

Why is this? How can I avoid it?

undeploy/deploy does not completely free up all memory your app used. Restart the server will be necessary sometimes.

also you can see following for your knowledge.

Anyway I can make it huge to further reduce the chance of having to restart the server?

If you could afford more memory to your JVM on the server machine. You could increase it. This reduces the chance of OutOfMemmoryError. May be you could also use a profiler to confirm that there has been no memory leaks in your application ?

If you could afford more memory to your JVM on the server machine. You could increase it

So how can I do this on Tomcat?

This can be done by assigning value to JAVA_OPTS variable. Look into some documentation on JAVA_OPTS as well to have more knowledge. One important information you do need to know is that each time you deploy an application on the server, the application thread will use the memory added on JAVA_OPTS. So you need to be careful if you are running multiple applications on the server.

Sometimes I update my web service JAR by deleting the old one, are you tried to use JWS(tJWS not clear from your description)

This can be done by assigning value to JAVA_OPTS variable. Look into some documentation on JAVA_OPTS as well to have more knowledge. One important information you do need to know is that each time you deploy an application on the server, the application thread will use the memory added on JAVA_OPTS. So you need to be careful if you are running multiple applications on the server.

How do I modify this in Linux?

Sometimes I update my web service JAR by deleting the old one, are you tried to use JWS(tJWS not clear from your description)

I simply delete the web service jar, wait for the undeployed message to appear, then copy the new one and wait for the deployed one to appear. Done.

increasing the amount of memory available to the JVM will not prevent a heap space error in this case, it will only delay it (you'll still run out of memory, it'll just take longer).

Restarting the application server is usually the best thing to do when redeploying applications, it's the only way to guarantee a clean situation at runtime (I've seen servers keeping things in memory they should have replaced during redeploy, causing weird runtime errors that take ages to debug, too often to still take the risk).

At development time, a light weight server usually takes only seconds to start, at production the installation should be scheduled for a time when there's no objection to downtime anyway.
The only exception would potentially be hotfixing, patching, something that should not have to be done except in dire emergencies.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.