- This topic has 3 replies, 3 voices, and was last updated 16 years ago by Loyal Water.
-
AuthorPosts
-
DavidMemberI am trying to implement Spring Security 2.0 using MyEclipse 6.01GA
I have this in my applicaitonContext.xml:
<?xml version=”1.0″ encoding=”UTF-8″?>
<beans
xmlns=”http://www.springframework.org/schema/beans”
xmlns:beans=”http://www.springframework.org/schema/beans”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:tx=”http://www.springframework.org/schema/tx”
xsi:schemaLocation=”http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd”><import resource=”springSecurity.xml”/>
…
</beans>And in my springSecurity.xml I have this:
<?xml version=”1.0″ encoding=”UTF-8″?>
<beans:beans xmlns=”http://www.springframework.org/schema/security”
xmlns:beans=”http://www.springframework.org/schema/beans”><http auto-config=”true” session-fixation-protection=”none”>
<intercept-url pattern=”/**” access=”ROLE_USER” />
</http>
</beans:beans>
and it all looks fine until I start up tomcat when I get this:
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 3 in XML document from ServletContext resource [/WEB-INF/springSecurity.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘beans:beans’.
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 3 in XML document from ServletContext resource [/WEB-INF/springSecurity.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘beans:beans’.When I edit the XML I don’t get any validation errors, only on startup. Can anyone point out what I am doing wrong? I am using the Spring reference tutorial for guidance.
Loyal WaterMemberLooks more like a spring related issue to me. I suggest you cross post on the spring forums as well.
Cal HolmanParticipantDon’t know if you figured this out but you might try avoiding redefining “bean” Here is how I did it:
<?xml version=”1.0″ encoding=”UTF-8″?>
<beans xmlns=”http://www.springframework.org/schema/beans”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:security=”http://www.springframework.org/schema/security”
xsi:schemaLocation=”http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.4.xsd”><security:http auto-config=”true” access-denied-page=”/accessDenied.jsp”>
<security:intercept-url pattern=”/login.htm*” filters=”none”/>
<security:intercept-url pattern=”/admin/*” access=”ROLE_ADMIN” />
<security:form-login login-page=”/logon.htm” authentication-failure-url=”/login.jsp?login_error=1″ default-target-url=”/home.htm”/>
<security:logout logout-success-url=”/home.htm”/>
</security:http></beans>
Loyal WaterMemberholmanc,
Thanks for posting this information. -
AuthorPosts