Announcement Announcement Module
Collapse
No announcement yet.
Naive user facing issue while creating a sample spring application (petclinic) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Naive user facing issue while creating a sample spring application (petclinic)

    Hi All,
    I am a naive user of spring. I have started learning it just now. I wanted to learn spring by understanding examples. So I tried to install petclicnic sample application of spring from the link https://github.com/SpringSource/spring-petclinic. When I tried to run mvn install command I got the following error
    java.lang.NoClassDefFoundError: org/springframework/beans/factory/NoUniqueBeanDe
    finitionException. I tried to resolve it by using the information provided in https://jira.springsource.org/browse/SPR-10218. I added all the dependencies. Now I am getting the following error. Please help



    ERROR ContextLoader - Context initialization failed
    java.lang.NoClassDefFoundError: org/springframework/asm/ClassVisitor
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.<init>(AbstractAutowireCapableBeanFactory. java:121) ~[spring-beans-3.1.4
    .RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.<init>(AbstractAutowireCapableBeanFactory. java:168) ~[spring-beans-3.1.4
    .RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.
    <init>(DefaultListableBeanFactory.java:163) ~[spring-beans-3.1.4.RELEASE.jar:3.1
    .4.RELEASE]
    at org.springframework.context.support.AbstractRefres hableApplicationCon
    text.createBeanFactory(AbstractRefreshableApplicat ionContext.java:194) ~[spring-
    context-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.context.support.AbstractRefres hableApplicationCon
    text.refreshBeanFactory(AbstractRefreshableApplica tionContext.java:127) ~[spring
    -context-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.obtain
    FreshBeanFactory(AbstractApplicationContext.java:5 37) ~[spring-context-3.2.2.REL
    EASE.jar:3.2.2.RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.refres
    h(AbstractApplicationContext.java:451) ~[spring-context-3.2.2.RELEASE.jar:3.2.2.
    RELEASE]
    at org.springframework.web.context.ContextLoader.conf igureAndRefreshWebA
    pplicationContext(ContextLoader.java:389) ~[spring-web-3.2.2.RELEASE.jar:3.2.2.R
    ELEASE]
    at org.springframework.web.context.ContextLoader.init WebApplicationConte
    xt(ContextLoader.java:294) ~[spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.web.context.ContextLoaderListe ner.contextInitiali
    zed(ContextLoaderListener.java:112) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]

    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContex
    t.java:4791) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.StandardContext.startInte rnal(StandardContex
    t.java:5285) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:150)
    [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1559) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1549) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303) [n
    a:1.6.0_20]
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:138) [na:1.6.0_20
    ]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExec
    utor.java:886) [na:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor
    .java:908) [na:1.6.0_20]
    at java.lang.Thread.run(Thread.java:619) [na:1.6.0_20]
    Caused by: java.lang.ClassNotFoundException: org.springframework.asm.ClassVisito
    r
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoa
    der.java:1714) ~[tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoa
    der.java:1559) ~[tomcat-embed-core-7.0.30.jar:7.0.30]
    ... 20 common frames omitted
    INFO XmlWebApplicationContext - Closing Root WebApplicationContext: startup dat
    e [Wed Mar 27 11:31:56 CDT 2013]; root of context hierarchy
    WARN XmlWebApplicationContext - Exception thrown from ApplicationListener handl
    ing ContextClosedEvent
    java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - c
    all 'refresh' before multicasting events via the context: Root WebApplicationCon
    text: startup date [Wed Mar 27 11:31:56 CDT 2013]; root of context hierarchy
    at org.springframework.context.support.AbstractApplic ationContext.getApp
    licationEventMulticaster(AbstractApplicationContex t.java:347) [spring-context-3.
    2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.publis
    hEvent(AbstractApplicationContext.java:334) [spring-context-3.2.2.RELEASE.jar:3.
    2.2.RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.doClos
    e(AbstractApplicationContext.java:1049) [spring-context-3.2.2.RELEASE.jar:3.2.2.
    RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.close(
    AbstractApplicationContext.java:1010) [spring-context-3.2.2.RELEASE.jar:3.2.2.RE
    LEASE]
    at org.springframework.web.context.ContextLoader.clos eWebApplicationCont
    ext(ContextLoader.java:558) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.web.context.ContextLoaderListe ner.contextDestroye
    d(ContextLoaderListener.java:143) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.apache.catalina.core.StandardContext.listenerS top(StandardContext
    .java:4831) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.StandardContext.stopInter nal(StandardContext
    .java:5478) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.util.LifecycleBase.stop(Lifecy cleBase.java:232) [
    tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:160)
    [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1559) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1549) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303) [n
    a:1.6.0_20]
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:138) [na:1.6.0_20
    ]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExec
    utor.java:886) [na:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor
    .java:908) [na:1.6.0_20]
    at java.lang.Thread.run(Thread.java:619) [na:1.6.0_20]
    WARN XmlWebApplicationContext - Exception thrown from LifecycleProcessor on con
    text close
    java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refr
    esh' before invoking lifecycle methods via the context: Root WebApplicationConte
    xt: startup date [Wed Mar 27 11:31:56 CDT 2013]; root of context hierarchy
    at org.springframework.context.support.AbstractApplic ationContext.getLif
    ecycleProcessor(AbstractApplicationContext.java:36 0) [spring-context-3.2.2.RELEA
    SE.jar:3.2.2.RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.doClos
    e(AbstractApplicationContext.java:1057) [spring-context-3.2.2.RELEASE.jar:3.2.2.
    RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.close(
    AbstractApplicationContext.java:1010) [spring-context-3.2.2.RELEASE.jar:3.2.2.RE
    LEASE]
    at org.springframework.web.context.ContextLoader.clos eWebApplicationCont
    ext(ContextLoader.java:558) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.web.context.ContextLoaderListe ner.contextDestroye
    d(ContextLoaderListener.java:143) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.apache.catalina.core.StandardContext.listenerS top(StandardContext
    .java:4831) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.StandardContext.stopInter nal(StandardContext
    .java:5478) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.util.LifecycleBase.stop(Lifecy cleBase.java:232) [
    tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:160)
    [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1559) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1549) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303) [n
    a:1.6.0_20]
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:138) [na:1.6.0_20
    ]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExec
    utor.java:886) [na:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor
    .java:908) [na:1.6.0_20]
    at java.lang.Thread.run(Thread.java:619) [na:1.6.0_20]

  • #2
    Originally posted by ChinmayDutta View Post
    Hi All,
    I am a naive user of spring. I have started learning it just now. I wanted to learn spring by understanding examples. So I tried to install petclicnic sample application of spring from the link https://github.com/SpringSource/spring-petclinic. When I tried to run mvn tomcat7:run command I got the following error
    java.lang.NoClassDefFoundError: org/springframework/beans/factory/NoUniqueBeanDe
    finitionException. I tried to resolve it by using the information provided in https://jira.springsource.org/browse/SPR-10218. I added all the dependencies. Now I am getting the following error. Please help



    ERROR ContextLoader - Context initialization failed
    java.lang.NoClassDefFoundError: org/springframework/asm/ClassVisitor
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.<init>(AbstractAutowireCapableBeanFactory. java:121) ~[spring-beans-3.1.4
    .RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.<init>(AbstractAutowireCapableBeanFactory. java:168) ~[spring-beans-3.1.4
    .RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.
    <init>(DefaultListableBeanFactory.java:163) ~[spring-beans-3.1.4.RELEASE.jar:3.1
    .4.RELEASE]
    at org.springframework.context.support.AbstractRefres hableApplicationCon
    text.createBeanFactory(AbstractRefreshableApplicat ionContext.java:194) ~[spring-
    context-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.context.support.AbstractRefres hableApplicationCon
    text.refreshBeanFactory(AbstractRefreshableApplica tionContext.java:127) ~[spring
    -context-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.obtain
    FreshBeanFactory(AbstractApplicationContext.java:5 37) ~[spring-context-3.2.2.REL
    EASE.jar:3.2.2.RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.refres
    h(AbstractApplicationContext.java:451) ~[spring-context-3.2.2.RELEASE.jar:3.2.2.
    RELEASE]
    at org.springframework.web.context.ContextLoader.conf igureAndRefreshWebA
    pplicationContext(ContextLoader.java:389) ~[spring-web-3.2.2.RELEASE.jar:3.2.2.R
    ELEASE]
    at org.springframework.web.context.ContextLoader.init WebApplicationConte
    xt(ContextLoader.java:294) ~[spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.web.context.ContextLoaderListe ner.contextInitiali
    zed(ContextLoaderListener.java:112) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]

    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContex
    t.java:4791) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.StandardContext.startInte rnal(StandardContex
    t.java:5285) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:150)
    [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1559) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1549) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303) [n
    a:1.6.0_20]
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:138) [na:1.6.0_20
    ]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExec
    utor.java:886) [na:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor
    .java:908) [na:1.6.0_20]
    at java.lang.Thread.run(Thread.java:619) [na:1.6.0_20]
    Caused by: java.lang.ClassNotFoundException: org.springframework.asm.ClassVisito
    r
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoa
    der.java:1714) ~[tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoa
    der.java:1559) ~[tomcat-embed-core-7.0.30.jar:7.0.30]
    ... 20 common frames omitted
    INFO XmlWebApplicationContext - Closing Root WebApplicationContext: startup dat
    e [Wed Mar 27 11:31:56 CDT 2013]; root of context hierarchy
    WARN XmlWebApplicationContext - Exception thrown from ApplicationListener handl
    ing ContextClosedEvent
    java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - c
    all 'refresh' before multicasting events via the context: Root WebApplicationCon
    text: startup date [Wed Mar 27 11:31:56 CDT 2013]; root of context hierarchy
    at org.springframework.context.support.AbstractApplic ationContext.getApp
    licationEventMulticaster(AbstractApplicationContex t.java:347) [spring-context-3.
    2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.publis
    hEvent(AbstractApplicationContext.java:334) [spring-context-3.2.2.RELEASE.jar:3.
    2.2.RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.doClos
    e(AbstractApplicationContext.java:1049) [spring-context-3.2.2.RELEASE.jar:3.2.2.
    RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.close(
    AbstractApplicationContext.java:1010) [spring-context-3.2.2.RELEASE.jar:3.2.2.RE
    LEASE]
    at org.springframework.web.context.ContextLoader.clos eWebApplicationCont
    ext(ContextLoader.java:558) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.web.context.ContextLoaderListe ner.contextDestroye
    d(ContextLoaderListener.java:143) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.apache.catalina.core.StandardContext.listenerS top(StandardContext
    .java:4831) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.StandardContext.stopInter nal(StandardContext
    .java:5478) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.util.LifecycleBase.stop(Lifecy cleBase.java:232) [
    tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:160)
    [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1559) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1549) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303) [n
    a:1.6.0_20]
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:138) [na:1.6.0_20
    ]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExec
    utor.java:886) [na:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor
    .java:908) [na:1.6.0_20]
    at java.lang.Thread.run(Thread.java:619) [na:1.6.0_20]
    WARN XmlWebApplicationContext - Exception thrown from LifecycleProcessor on con
    text close
    java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refr
    esh' before invoking lifecycle methods via the context: Root WebApplicationConte
    xt: startup date [Wed Mar 27 11:31:56 CDT 2013]; root of context hierarchy
    at org.springframework.context.support.AbstractApplic ationContext.getLif
    ecycleProcessor(AbstractApplicationContext.java:36 0) [spring-context-3.2.2.RELEA
    SE.jar:3.2.2.RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.doClos
    e(AbstractApplicationContext.java:1057) [spring-context-3.2.2.RELEASE.jar:3.2.2.
    RELEASE]
    at org.springframework.context.support.AbstractApplic ationContext.close(
    AbstractApplicationContext.java:1010) [spring-context-3.2.2.RELEASE.jar:3.2.2.RE
    LEASE]
    at org.springframework.web.context.ContextLoader.clos eWebApplicationCont
    ext(ContextLoader.java:558) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.web.context.ContextLoaderListe ner.contextDestroye
    d(ContextLoaderListener.java:143) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.apache.catalina.core.StandardContext.listenerS top(StandardContext
    .java:4831) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.StandardContext.stopInter nal(StandardContext
    .java:5478) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.util.LifecycleBase.stop(Lifecy cleBase.java:232) [
    tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:160)
    [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1559) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.
    java:1549) [tomcat-embed-core-7.0.30.jar:7.0.30]
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303) [n
    a:1.6.0_20]
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:138) [na:1.6.0_20
    ]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExec
    utor.java:886) [na:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor
    .java:908) [na:1.6.0_20]
    at java.lang.Thread.run(Thread.java:619) [na:1.6.0_20]
    I also found that the classVisitor was present in spring 2.5.x and I believe no longer present in spring 3.

    Comment

    Working...
    X