Illegal access: this web application instance has been stopped already. Could not load org.apache.log4j.spi.NOPLoggerRepository

StackOverflow https://stackoverflow.com/questions/15827522

Question

I am using Netbeans 6.7 with Tomcat 6.0 and jasper reports for generating reports in a web application. I always get this exception when I run my application. can someone please help me out?

The exception is

INFO: Illegal access: this web application instance has been stopped already.  Could not load org.apache.log4j.spi.NOPLoggerRepository.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
        at org.apache.log4j.LogManager.getLoggerRepository(LogManager.java:175)
        at org.apache.log4j.LogManager.getLogger(LogManager.java:199)
        at org.apache.log4j.Logger.getLogger(Logger.java:105)
        at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:283)
        at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:193)
        at org.hibernate.connection.DriverManagerConnectionProvider.close(DriverManagerConnectionProvider.java:147)
        at org.hibernate.connection.DriverManagerConnectionProvider.finalize(DriverManagerConnectionProvider.java:142)
        at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
        at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
        at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
Was it helpful?

Solution

It could be due to a memory problem, I had this message and also a java.lang.OutOfMemoryError: Java heap space, adjusting startup parameters to: -XX:PermSize=512M -Xms1024m -Xmx4096m solved the problem the problem.

OTHER TIPS

I found I would get a similar error occasionally while running my JSP web application with Netbeans on Tomcat and always while debugging it. In my case it was "could not load Java.lang.math or Oracle.lnx.lib". A coworker had me undeploy the web application instances from tomcat and it solved the problem. To undeploy a webapplication instance, go to the Services Tab > Servers and then double click on Apache Tomcat or TomEE and after running the application once since opening netbeans, a Web Applications Folder should appear. If you double click on that, you should see instances of your application appear. You should be able to right click them and then click undeploy (you may have to right click them and hit stop first). Finally, you should stop and then start tomcat before building and running your application.

Hope this helps.

See attached screenshot for clarity

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top