ghhhhhhhh
ghhhhhhhh

Reputation: 77

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'constructor-arg'

this is my spring-security.xml

<beans:beans xmlns="http://www.springframework.org/schema/security"

    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
        http://www.springframework.org/schema/security
        http://www.springframework.org/schema/security/spring-security-3.2.xsd
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
     http://www.springframework.org/schema/util  http://www.springframework.org/schema/util/spring-util-3.1.xsd">

    <http auto-config="true" use-expressions="true">
        <intercept-url pattern="/admin**" access="hasRole('ROLE_ADMIN')" />

        <intercept-url pattern="/signup" access="permitAll"></intercept-url>
        <intercept-url pattern="/signin" access="permitAll"></intercept-url>
        <intercept-url pattern="/logout" access="permitAll"></intercept-url>
        <intercept-url pattern="/denied" access="permitAll"></intercept-url>
        <intercept-url pattern="/**" access="isAuthenticated()"></intercept-url>
        <access-denied-handler error-page="/403" />

        <form-login login-page="/signin" default-target-url="/home"
            authentication-failure-url="/denied" />
        <logout logout-success-url="/logout"></logout>
    </http>


    <authentication-manager>  
  <authentication-provider> 
    <password-encoder ref="passwordEncoder" hash="sha-256"/>
  <jdbc-user-service data-source-ref="dataSource"
          users-by-username-query=
            "select email,password, 'true' as enabled from user_login where email=? limit 1"
          authorities-by-username-query=
            "select email, role from user_roles where email =?  " />
      </authentication-provider>

 </authentication-manager> 
    <beans:bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder">
     <constructor-arg value="256"/>
 </beans:bean>
</beans:beans>  

i m getting this error as cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'constructor-arg'. - Security namespace does not support decoration of element [constructor-arg] - Configuration problem: Security namespace does not support decoration of element [constructor-arg] Offending resource: file (project path) how can i solve this errror?

.i want to enocde the password and check if that matches with the database password.

Upvotes: 1

Views: 3571

Answers (1)

Tung Vo
Tung Vo

Reputation: 2549

I think the problem because beans is not the default namespace . So you could try

<beans:bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder">
 <beans:constructor-arg value="256"/>

or declare beans as default namespace

    <beans xmlns="http://www.springframework.org/schema/beans"

Upvotes: 4

Related Questions