Hi all,
I have to redeploy the web application with out restarting the tomcat. To reach this requirement i written an ANT script, which stops the running web application and undeploys that one and deploys the new war file in to tomcat with out restarting the tomcat. If i run this ant script i am getting the following error after 10 to 15 redeployments.
SEVERE: Exception sending context initialized event to listener instance of class com.infovista.vistamart.evpn.server.util.AppInitializer
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at org.hibernate.cfg.Configuration.reset(Configuration.java:173)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:193)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:197)
at com.infovista.vistamart.evpn.server.util.ServiceLocator.initHibernate(Unknown Source)
at com.infovista.vistamart.evpn.server.util.ServiceLocator.getHibernateSessionFactory(Unknown Source)
at com.infovista.vistamart.evpn.server.util.AppInitializer.contextInitialized(Unknown Source)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:829)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:515)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1229)
at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1465)
at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:821)
at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:349)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
Dec 12, 2008 12:43:37 PM org.apache.catalina.core.ApplicationContext log
By searching in this forum i came to know one of the solution is to improve the hep size. I done increasing of heap size by the following statement in the catalina.bat file
set JAVA_OPTS=%JAVA_OPTS% -XX:PermSize=128m -XX:MaxPermSize=128m
But the same error i am getting if run the redeployment ant script more than 20 times. I don't like to increase the heap size because it decreases the performance of system and 1 of the extent the same problem i am getting again.
And i tried one more option to turn off the CGLIB by using the following cmd in the catalina.bat file
set JAVA_OPTS=%JAVA_OPTS% java -Dhibernate.cglib.use_reflection_optimizer=false
But still i am facing the same issue.
And i checked my code might be some memory leaks causing this issue. but i am closing all the connections and session factory and and data base shutdown every thing is happening correctly when context destroy is called.
Give me some idea how i can proceed in this issue to solve this problem completely. Thanq in advance............
|