3

I get this error

SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener
        at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5035)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5687)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1028)
        at org.apache.catalina.startup.HostConfig.undeploy(HostConfig.java:1498)
        at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1425)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1646)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:328)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1374)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1546)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1556)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1524)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextCleanupListener
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
        ... 16 more

I look in my deployed folder however and I see the jar that contains that file, what am I doing wrong?

https://github.com/davidahines/spacechip/tree/spring_security

The issue is that when I try to go to localhost:8080/spacechip I get "The resource is unavailable."

There is my configuration.

davidahines
  • 3,976
  • 16
  • 53
  • 87

3 Answers3

2

try change dependency of spring-web to 3.0.5.RELEASE in your pom, you are currently have 2 version on classpath

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-web</artifactId>
  <version>3.0.5.RELEASE</version>
</dependency>
Jaiwo99
  • 9,687
  • 3
  • 36
  • 53
1

The jar may be in your deployed folder, but is the jar (or your deployed folder with a wildcard) in the CLASSPATH?

Duston
  • 1,601
  • 5
  • 13
  • 24
  • I don't know, how do I check that? Do you mean environment variable or something? I am in windows. – davidahines Dec 05 '14 at 20:20
  • The answer to that question depends on how you're running the program. From the commandline, you can add it to the CLASSPATH environment variable (Set CLASSPATH= ... etc), or use the -cp commandline switch for java.exe You could also add it to the CLASSPATH in My Computer->Properties. If it's running under a server (like a web server or some such) then you'd have to refer to its documentation because neither of the above may apply. For example, with Lotus Domino the jar would have to be in \Notes\JVM\Lib\Ext, (because there's no explicit classpath.) – Duston Dec 05 '14 at 20:44
  • The bottom-line is that java doesn't implicitly look anywhere (not even the current subdirectory) for Jar files. It only checks the CLASSPATH whereever (and however) it is set. – Duston Dec 05 '14 at 20:45
  • I am running it through tomcat, do I still add it through my command line? – davidahines Dec 05 '14 at 21:05
0

EnvironmentAware is located in the spring-context-3.1.1.RELEASE.jar, so you are missing that one.

Also recheck your Maven POM file so that you are not missing any other Spring library, like spring-web, spring-webmvc (you may have these since the DispatcherServlet class if found), spring-orm if you use an ORM like Hibernate, spring-jms if you use JMS, etc.

Fakher
  • 2,098
  • 3
  • 29
  • 45