Results 1 to 6 of 6

Thread: Strange NoClassDefFoundError EntityManagerFactoryUtils when shutting down application

  1. #1
    Join Date
    Apr 2011
    Posts
    8

    Question Strange NoClassDefFoundError EntityManagerFactoryUtils when shutting down application

    Recently I have been getting some strange exceptions thrown when shutting down one of our applications.

    I get the same exception thrown for every single Spring component from services, AOP, security etc.

    I am using Spring 3.0.5.RELEASE, deploying to Tomcat 6. I'm guessing its something to do with the shutdown order of spring components which may be causing it, we get no issues when the application is running and being used only on shutdown?

    Anyone got any ideas about how to prevent this error?

    Cheers, James

    Stack below: (Its the same for every error but pointing to a different component.

    Code:
    2012-03-21 09:25:53,929 ?:? ERROR [org.springframework.beans.factory.support.DefaultListableBeanFactory] Destroy method on bean with name 'commonDataSource' threw an exception
    java.lang.NoClassDefFoundError: org/springframework/orm/jpa/EntityManagerFactoryUtils
    	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessBeforeDestruction(PersistenceAnnotationBeanPostProcessor.java:356)
    	at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:166)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:487)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:463)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:431)
    	at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1048)
    	at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1022)
    	at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:970)
    	at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:378)
    	at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:78)
    	at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4011)
    	at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4615)
    	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
    	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
    	at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
    	at org.apache.catalina.core.StandardService.stop(StandardService.java:587)
    	at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
    	at org.apache.catalina.startup.Catalina.stop(Catalina.java:648)
    	at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:692)

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    Hello

    1) Check your Tomcat log files when you start your Tomcat, perhaps some error message is there
    2) About java.lang.NoClassDefFoundError: org/springframework/orm/jpa/EntityManagerFactoryUtils, be sure you have the mandatory dependences about JPA

    Let me know your advance
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3
    Join Date
    Apr 2011
    Posts
    8

    Default

    Cheers for the reply, in response to your feedback.

    1) I see no reference in any tomcat log as to a missing jar or other error messages.
    2) I see no dependency tree issues from the project plus the dependency for the project haven't changed in a while.

    After testing yesterday it appears to happen intermediately, i.e. not ever time I shut down the application as originally thought. I have seen no issues with the application running which leads me to one thought but I am unsure of its validity?

    One thought is that when spring is shutting down the application context does it remove classes from its classpath, if so how is the shut down ordering determined, could it be that depending on the shut down order this class is being removed from the classpath to early which is why I get intermediate issues when shutting down?

    My knowledge of how the spring classpath stuff works is limited, I was trying find some documentation on it but couldn't find it?

    James

  4. #4
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    Hello James

    1) I see no reference in any tomcat log as to a missing jar or other error messages.
    Are you sure about that?, Change your logger configuration to show any message. I think is (ALL)

    After testing yesterday it appears to happen intermediately, i.e. not ever time I shut down the application as originally thought. I have seen no issues with the application running which leads me to one thought but I am unsure of its validity?
    I think some configuration is wrong

    About the error stack trace, is the complete stack? If not , post the complete, some times the rest of the details are more useful than the first message
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  5. #5
    Join Date
    Feb 2006
    Posts
    4

    Default

    I am experiencing the same problem. Was there any resolution to this?

    *Note: Here are the beans that are being closed down and causing this exception to be thrown [org.springframework.aop.config.internalAutoProxyCr eator, org.springframework.context.annotation.internalAsy ncAnnotationProcessor, org.springframework.context.annotation.internalSch eduledAnnotationProcessor, 'org.springframework.cache.annotation.AnnotationCa cheOperationSource#0, 'org.springframework.cache.config.internalCacheAdv isor, 'org.springframework.transaction.annotation.Annota tionTransactionAttributeSource#0]


    Here is my full stack trace:
    2012-06-25 14:30:48 | ERROR | 'weblogic.kernel.Default (self-tuning)' | DefaultListableBeanFactory | Destroy method on bean with name 'org.springframework.aop.config.internalAutoProxyC reator' threw an exception
    java.lang.NoClassDefFoundError: org/springframework/orm/jpa/EntityManagerFactoryUtils
    at org.springframework.orm.jpa.support.PersistenceAnn otationBeanPostProcessor.postProcessBeforeDestruct ion(PersistenceAnnotationBeanPostProcessor.java:35 7)
    at org.springframework.beans.factory.support.Disposab leBeanAdapter.destroy(DisposableBeanAdapter.java:1 93)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.destroyBean(DefaultSingletonB eanRegistry.java:498)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.destroySingleton(DefaultSingl etonBeanRegistry.java:474)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.destroySingletons(DefaultSing letonBeanRegistry.java:442)
    at org.springframework.context.support.AbstractApplic ationContext.destroyBeans(AbstractApplicationConte xt.java:1066)
    at org.springframework.context.support.AbstractApplic ationContext.doClose(AbstractApplicationContext.ja va:1040)
    at org.springframework.context.support.AbstractApplic ationContext.close(AbstractApplicationContext.java :988)
    at org.springframework.web.context.ContextLoader.clos eWebApplicationContext(ContextLoader.java:384)
    at org.springframework.web.context.ContextLoaderListe ner.contextDestroyed(ContextLoaderListener.java:78 )

  6. #6
    Join Date
    Apr 2011
    Posts
    8

    Default

    Hi CHenry,

    Quote Originally Posted by chenry View Post
    I am experiencing the same problem. Was there any resolution to this?
    :
    I have found no real solution, this sometime still happens with no noticeable pattern or reason. I have moved to spring 3.1 and now deploy to tomcat 7 not 6. This seems to have solved most of it.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •