Hi all,
This is my first post in the spring forums so howdy!
I'm sure you've been asked this question a million times before but I'm experiencing the following error message when I attempt to load the application context with spring and use a very basic spring security example. Please bear in mind this is my first attempt to get spring authentication working:-
The ant target trying to run the unit tests contains the following:-Code:[junit] java.lang.IllegalStateException: Failed to load ApplicationContext [junit] at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308) ... [junit] Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [test-security.xml] [junit] Offending resource: class path resource [spring-test-context.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: spring-security-web classes are not available. You need these to use <filter-chain-map> [junit] Offending resource: class path resource [test-security.xml] [junit] at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
The paths contain the following jar packages at runtime:-Code:<target name="unit-test" depends="unit-test-compile"> <junit printsummary="false" haltonfailure="true"> <classpath> <path refid="build.classpath"/> <path refid="test.classpath"/> <path refid="resources.classpath"/> <path refid="test.resources.classpath"/> </classpath> <formatter type="brief" usefile="false"/> <formatter type="xml" /> <batchtest todir="${test.data.dir}"> <fileset dir="${build.out.test.dir}"> <include name="**/*Test.class"/> </fileset> </batchtest> </junit> </target>
The contents of my test-spring-security.xml is:-Code:build.classpath = :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/ant-web-tasks-1.0.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/antlr-2.7.6.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/asm-attrs.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/asm.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/cglib-2.2.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/commons-collections-3.1.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/commons-dbcp-all-1.3.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/dom4j-1.6.1.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/ehcache-1.2.3.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/ejb3-persistence-1.0.2.GA.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/hibernate-testing.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/hibernate3.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/javassist-3.12.0.GA.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/jta-1.1.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/jta.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/junit.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/liquibase.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/log4j-1.2.15.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/mockito-all-1.8.5.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/mysql-connector-java-5.1.15-bin.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.hamcrest.core_1.1.0.v20090501071000.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.aop-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.asm-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.aspects-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.beans-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.context-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.context.support-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.core-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.expression-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.instrument-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.instrument.tomcat-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.jdbc-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.jms-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.orm-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.oxm-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.test-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.transaction-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.web-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.web.portlet-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.web.servlet-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/org.springframework.web.struts-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/slf4j-api-1.6.1.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/spring-security-acl-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/spring-security-aspects-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/spring-security-cas-client-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/spring-security-config-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/spring-security-core-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/spring-security-ldap-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/spring-security-openid-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/spring-security-taglibs-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/WebContent/WEB-INF/lib/spring-security-web-3.0.5.RELEASE.jar :/Users/jamurphy84/Documents/Projects/java/teambox/build/out/classes test.classpath = /Users/jamurphy84/Documents/Projects/java/teambox/build/out/classes/test resources.classpath = /Users/jamurphy84/Documents/Projects/java/teambox/build/out/main/resources test.resources.classpath = /Users/jamurphy84/Documents/Projects/java/teambox/build/out/test/resources
Anyone have any ideas? I'm concerned I might have overloaded the path with lots of jars I don't need. To be honest it's probably frustration because I thought this should be working already. I thought the only classes I would need are core, config and web as a bare minimum am I wrong?Code:<beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.3.xsd"> <security:http auto-config='true'> <security:intercept-url pattern="/**" access="ROLE_USER"/> <security:form-login login-page='/login.jsp'/> </security:http> <security:authentication-manager> <security:authentication-provider> <security:user-service> <security:user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" /> <security:user name="player1" password="player1" authorities="ROLE_USER" /> <security:user name="player2" password="player2" authorities="ROLE_USER" /> <security:user name="player3" password="player3" authorities="ROLE_USER" /> </security:user-service> </security:authentication-provider> </security:authentication-manager> </beans>
I'm using spring 3.0.5 and spring security 3.0.5 which I would assume should play okay together.
Any help is much appreciated.


Reply With Quote
