views:

9876

answers:

7

This is the error I get when I run my web application using NetBeans (using servlets). To fix this I even changed the heap size in netbeans.conf, but still it shows the same error. How can I keep this from happening?

HTTP Status 500 - 

--------------------------------------------------------------------------------

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: Servlet execution threw an exception
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)


root cause 

java.lang.OutOfMemoryError: Java heap space

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
+11  A: 
Michael Myers
True. +1. Although, would I have been the one writing this answer, I would have included the picture http://www.javapassion.com/handsonlabs/nbprofilermemory/index_files/3_heap17.png , from http://www.javapassion.com/handsonlabs/nbprofilermemory/ ;) (but that's just me: I always include picture)
VonC
"I always include picture": as you have noticed lately: http://stackoverflow.com/questions/707194#707206 (in the comments)
VonC
How do you find appropriate pictures, though? I tried to find a screenshot and couldn't.
Michael Myers
The problem is that,there is no VM options in the run category of the project properties.So,im struck up there again!!
@divya: Could you give us a screenshot or something? I have all the web application plugins uninstalled right now, so I can't easily reproduce your problem.
Michael Myers
I don't think this applies to Servlet Projects... only desktop projects.
James Schek
@James Schek: Apparently you're right, judging by divya's post below.
Michael Myers
+3  A: 

I'm guessing that increasing the memory won't fix the problem. What is that MonitorFilter doing? What's eating up all that memory?

Your best bet is to figure that out. If this is a web app, see if you can turn off that filter and run without it. If you have success, you know that the MonitorFilter is causing your to fail.

duffymo
+1 - Sometimes I get so caught up in answering a question that I don't address the real problem.
Michael Myers
+1 OP should also definitely review that class for excessive object creation, etc.
Dana the Sane
@mmyers - +1 for you, because it happens to all of you. 8)
duffymo
s/you/us - man, I can't type today.
duffymo
A: 

link for the project properties This is how my project properties dialogue box looks like,I dont find any VM options there,please help me as what can be done

+2  A: 

This has nothing to do with NetBeans (well, perhaps), rather it has to do with Tomcat. Tomcat is the process that is running out of heap, not NetBeans. Track down the startup process for your Tomcat. If it's bundled with NB, then Tomcat is buried within the NB installation, check for an "enterpriseN" directory, N being a number, Tomcat is probably in there and it's a rather generic distribution of it.

As to why the monitor is run OOM, that's hard to say, it's a pretty simple process when you think about it. You can also try disabling HTTP monitoring to see if it's a problem with the Monitoring itself or something with your application.

Will Hartung
+2  A: 

If you increase the virtual memory of your Tomcat server then it will be OK.

Steps:

  1. In NB go through the windows menu and add Services
  2. You will find Tomcat in the services. Right click on Tomcat server and select Properties
  3. Go to the platform in the properties and write -Xms512m in VM options field
A: 

Why doesn't this work in NetBeans 5.5.1 ????

When I try to add -Xmx1028m to the VM options

ie. VM Options: -Xms128m -Xmx1024m ...etc.

When I run the program, I get the error in the output window:

init: deps-jar: run-single: jython: illegal option -- Xms128m usage: jython [options] [-jar jar | -c cmd | file | -] [args] Options and arguments: -i : inspect interactively after running script, and force prompts, even if stdin does not appear to be a terminal -S : don't imply import site' on initialization -v : verbose (trace import statements) -Dprop=v : Set the property prop' to value `v' -jar jar : program read from run.py in jar file -c cmd : program passed in as string (terminates option list) -W arg : warning control (arg is action:message:category:module:lineno) -E codec : Use a different codec the reading from the console. -Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew file : program read from script file - : program read from stdin (default; interactive mode if a tty) --help : print this usage message and exit --version: print Jython version number and exit args : arguments passed to program in sys.argv[1:] Java Result: -1 BUILD SUCCESSFUL (total time: 0 seconds)

Any ideas about what's going on ????

Thanks,

Jake

Looks like you're using the python early-access module? Anyway, this should be in its own question.
Michael Myers
A: 

do "jython -J-Xmx1024m" as it is mentioned in the help...

~/jython2.5.1/jython --help Jython launcher options: -Jarg : pass argument through to Java VM (e.g. -J-Xmx512m)

Fraka6