2016-05-09 3 views
0

Ich versuche Spring Session 1.2.0 in ein vorhandenes Spring MVC-Projekt mit bereits konfigurierter Spring Security zu integrieren.Spring Session-Sicherheitskonfiguration und mehrere contextLoaderListener-Klassen Ausnahme

Ich habe Konfiguration erfolgt nach diesen:

http://docs.spring.io/spring-session/docs/1.2.0.BUILD-SNAPSHOT/reference/html5/guides/security.html

http://docs.spring.io/spring-session/docs/1.2.0.BUILD-SNAPSHOT/reference/html5/guides/httpsession-jdbc.html

Allerdings kann ich die App nicht auf Tomcat einsetzen, da ich immer Ausnahme halten:

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml! at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:277) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1879) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

Es gibt eine verwandte Ausgabe Why this Spring application with java-based configuration don't work properly

Wie konfiguriere ich Spring Session, ohne eine neue Instanz von ContextLoaderListener zu erstellen?

+0

Wie lädt man in der vorhandenen Anwendung die Spring Security-Konfiguration? –

+0

Ich hatte tatsächlich eine vorhandene Spring Security-Konfiguration und zwei davon erstellt das Problem erwähnt. Also, das war meine eigene Schuld, weil ich das überhaupt nicht verstanden habe. – Nordkraft

Antwort

0

Ich hatte bereits eine Spring Security-Konfiguration. Um mein Problem zu lösen, habe ich die Annotation @EnableJdbcHttpSession in die bestehende Konfiguration eingefügt und sichergestellt, dass die Datenquelle und der Transaction Manager konfiguriert sind.

Verwandte Themen