0

spring security +hibernate: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0'

asked 2014-08-01 14:31:32 +0800

cynhache gravatar image cynhache
1

Hello im getting this error, my spring-security is:

 <global-method-security pre-post-annotations="enabled" />
<http auto-config="true"
    use-expressions ="true"
    access-denied-page="/AccesoDenegado.xhtml">

<!-- Se definen los dos perfiles y se interceptan las paginas para realizar la autenticacion -->

    <intercept-url pattern="/page1**" access="ROLE_PROFE"/>

    <intercept-url pattern="/page2**" access="ROLE_ALUMNO" />

     <!--Se define una pagina de login personalizada, no a que viene por defecto-->

     <form-login 
     login-processing-url="/j_spring_security_check"
     login-page="/login.xhtml" 
     authentication-failure-url="/login" />

      <!-- Cerrar Sesion-->

      <logout invalidate-session="true" delete-cookies="JSESSIONID" logout-success-url="/" logout-url="/logout" /> 


</http>

<authentication-manager>

  <authentication-provider>

    <jdbc-user-service data-source-ref="dataSource"
      users-by-username-query=
        "select usuario,contraseña, habilitado from tabla_usuarios where usuario=?"
      authorities-by-username-query=
        "select usuario, rol from roles where usuario =?  " /> 

  </authentication-provider>
</authentication-manager>

</beans:beans>

my Aplication Context

<import resource="classes/com/mkyong/customer/spring/DataSource.xml"/>
<import resource="classes/com/mkyong/customer/spring/HibernateSessionFactory.xml"/>


<!-- Beans Declaration -->
<import resource="classes/com/mkyong/customer/spring/CustomerBean.xml"/>

</beans> My hibernate session factory

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<property name="dataSource">
  <ref bean="dataSource"/>
</property>

<property name="hibernateProperties">
   <props>
     <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
     <prop key="hibernate.show_sql">true</prop>
   </props>
</property>

<property name="mappingResources">
<list>
      <value>com/mkyong/customer/hibernate/Customer.hbm.xml</value>
</list>
 </property>

</bean> </beans> my dataSource bean

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>WEB-INF/classes/config/database/db.properties</value> </property> </bean>

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${jdbc.driverClassName}"/> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> </bean>

</beans>

and my customer bean

<bean id="customerBo" 
     class="customer.bo.impl.CustomerBoImpl" >
    <property name="customerDao" ref="customerDao" />
</bean>

<bean id="customerDao" 
     class="customer.dao.impl.CustomerDaoImpl" >
    <property name="sessionFactory" ref="sessionFactory"></property>
</bean>

</beans>

when i use autentication without hibernate works fine, but when i integrate them, i get that error.. any idea why??

delete flag offensive retag edit

Comments

a little more stacktrace would be helpfull (caused by ......)

chillworld ( 2014-08-01 15:30:45 +0800 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2014-08-04 08:36:05 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Show us your web.xml please

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-08-01 14:31:32 +0800

Seen: 10 times

Last updated: Aug 04 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More