Announcement Announcement Module
Collapse
No announcement yet.
How to debug loading applicant Context? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to debug loading applicant Context?

    Hi there,

    I am getting an OutOfMemoryError during loading of application context (while running tests). I really have no idea how to troubleshoot that. Any help would be appreciate that.

    The stacktrace is below:

    Code:
    java.lang.IllegalStateException: Failed to load ApplicationContext
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308) [spring-test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) [spring-test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) [spring-test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321) [spring-test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at
    ...
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoManager' defined in class path resource [daoTestContext.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: Java heap space
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:353) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:983) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:879) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) [spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84) [spring-test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1) [spring-test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280) [spring-test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304) [spring-test-3.0.5.RELEASE.jar:3.0.5.RELEASE]
    	... 39 common frames omitted
    Caused by: java.lang.OutOfMemoryError: Java heap space
    	at java.util.jar.Manifest$FastInputStream.<init>(Manifest.java:315) [na:1.6.0_33]
    	at java.util.jar.Manifest$FastInputStream.<init>(Manifest.java:310) [na:1.6.0_33]
    	at java.util.jar.Manifest.read(Manifest.java:178) [na:1.6.0_33]
    	at java.util.jar.Manifest.<init>(Manifest.java:52) [na:1.6.0_33]
    	at java.util.jar.JarFile.getManifestFromReference(JarFile.java:167) [na:1.6.0_33]
    	at java.util.jar.JarFile.getManifest(JarFile.java:148) [na:1.6.0_33]
    	at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:696) [na:1.6.0_33]
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:228) [na:1.6.0_33]
    	at java.net.URLClassLoader.access$000(URLClassLoader.java:58) [na:1.6.0_33]
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:197) [na:1.6.0_33]
    	at java.security.AccessController.doPrivileged(Native Method) [na:1.6.0_33]
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190) [na:1.6.0_33]
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:306) [na:1.6.0_33]
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) [na:1.6.0_33]
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:247) [na:1.6.0_33]
    	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1817) [postgresql-9.1-901.jdbc4.jar:na]
    	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) [postgresql-9.1-901.jdbc4.jar:na]
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) [postgresql-9.1-901.jdbc4.jar:na]
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388) [postgresql-9.1-901.jdbc4.jar:na]
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273) [postgresql-9.1-901.jdbc4.jar:na]
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96) [commons-dbcp-1.4.jar:1.4]
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96) [commons-dbcp-1.4.jar:1.4]
    	at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
    	at org.hibernate.loader.Loader.getResultSet(Loader.java:1808) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
    	at org.hibernate.loader.Loader.doQuery(Loader.java:697) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
    	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
    	at org.hibernate.loader.Loader.doList(Loader.java:2228) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
    	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
    	at org.hibernate.loader.Loader.list(Loader.java:2120) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
    	at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
    	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
    	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
    Tests run: 72, Failures: 1, Errors: 0, Skipped: 71, Time elapsed: 31.047 sec <<< FAILURE!

  • #2
    In your logging mechanism setup debug loggers that map directly to the packages listed in your stack trace.

    You might also want to step through and debug your test??? Set an appropriate break point.

    You could also troubleshoot with something like JProfiler.

    Jeff

    Comment

    Working...
    X