1
My first xml file applicationContext-security.xml:
<?xml version="1.0" encoding="UTF-8"?>
<b:beans xmlns="http://www.springframework.org/schema/security"
xmlns:b="http://www.springframework.org/schema/beans"
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.xsd">
<http auto-config="true">
<intercept-url pattern="/admin/*" access="ROLE_ADMINISTRADOR" />
<intercept-url pattern="/restrito/*" access="ROLE_USUARIO" />
<form-login login-page="/publico/login.jsf"
always-use-default-target="true" default-target-url="/restrito/principal.jsf"
authentication-failure-url="/publico/login.jsf?login_error=1" />
<logout/>
<remember-me />
</http>
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="financeiroDataSource"
authorities-by-username-query="SELECT u.login, p.permissao
FROM usuario u, usuario_permissao p
WHERE u.codigo = p.usuario
AND u.login = ?"
users-by-username-query="SELECT login, senha, ativo
FROM usuario
WHERE login = ?" />
</authentication-provider>
</authentication-manager>
</b:beans>
And there’s this other applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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">
<bean id="financeiroDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/FinanceiroDB</value>
</property>
</bean>
</beans>
All are in the WEB-INFO folder.
Es are errors in Tomcat log:
first
GRAVE: Context initialization failed org.springframework.Beans.factory.Parsing.Beandefinitionparsingexception: Configuration problem: Unable to locate Spring Namespacehandler for XML schema namespace [http://www.springframework.org/schema/security] Offending Resource: Servletcontext Resource [/WEB-INF/applicationContext-security.xml]
2nd
Sep 09, 2014 9:47:18 PM org.apache.Catalina.core.Standardcontext listenerStart GRAVE: Exception sending context initialized Event to Listener instance of class org.springframework.web.context.Contextloaderlistener org.springframework.Beans.factory.Parsing.Beandefinitionparsingexception: Configuration problem: Unable to locate Spring Namespacehandler for XML schema namespace [http://www.springframework.org/schema/security] Offending Resource: Servletcontext Resource [/WEB-INF/applicationContext-security.xml]
My libs:
spring-2.5.6.jar
spring-security-cas-3.1.0.RELEASE. jar
spring-security-core-3.1.0.RELEASE. jar
spring-security-openid-3.1.0.RELEASE. jar
spring-security-remoting-3.1.0.RELEASE. jar
spring-security-samples-Contacts-3.0.2.RELEASE-sources.jar
spring-security-samples-tutorial-3.0.2.RELEASE-sources.jar
It seems that the configuration XML is not in the required pattern. Depending on the IDE you can validate this XML before running the application. Which IDE you are using?
– Luídne
@I’m wearing the Eclipse
– Jack
Post also your XML. It will help a lot in this case.
– Luídne
I changed the bug description and added my files. @Luíde
– Jack
What version of Tomcat and Spring Security you are using?
– Luídne
One more thing, what libs are you using in the project?
– Luídne
@Luídne added to the description the libs I’m using from spring. And I updated the two errors that happen when starting Tomcat.
– Jack