• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

spring security on login  RSS feed

 
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to login using spring security so i am having two three xmls , one java and two jsp files

index.jsp


welcome.jsp

LoginController.java


sdnext-security.xml



sdnext-servlet.xml


web.xml


on the web-browser i am getting 404 error and on the console i am getting following error


org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2397)
at java.lang.Class.getDeclaredFields(Class.java:1806)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:372)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:320)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:789)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:545)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.CacheProvider
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
... 27 more


help me to solve this
 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Which hibernate version you're using?

( 2. a side question: Is this Maven-based project OR a regular Web Dynamic Project where you manually put jars into the WEB-INF/lib folder)
 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using spring 3.0 and this is dynamic web project no the maven
 
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul, already asked it? Which version of Hibernate are you using?

There are incompatible Jar files on the classpath.
 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
version 4 for hibernate commons-annotation and core ...
version 2 for hibernate jpa
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why are you using both Hibernate4 and 2?
Why you can't just use Hibernate4?
 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because i don't find it hibernate jpa in 4 version.. if you find please share the downloading link
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.. you mean to say, hibernate-jpa jar file, fine, that is version 2 only..
Can you post the list of all Jar files you are loading?
 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
following are names of jar files
  • jar

    /SpringSecurity/WebContent/WEB-INF/lib/activation-1.0.2.jar
    /SpringSecurity/WebContent/WEB-INF/lib/antlr-2.7.6.jar
    /SpringSecurity/WebContent/WEB-INF/lib/aopalliance-1.0.jar
    /SpringSecurity/WebContent/WEB-INF/lib/asm-1.5.3.jar
    /SpringSecurity/WebContent/WEB-INF/lib/asm-attrs-1.5.3.jar
    /SpringSecurity/WebContent/WEB-INF/lib/cglib-2.1_3.jar
    /SpringSecurity/WebContent/WEB-INF/lib/commons-beanutils-1.7.0.jar
    /SpringSecurity/WebContent/WEB-INF/lib/commons-collections-2.1.1.jar
    /SpringSecurity/WebContent/WEB-INF/lib/commons-digester-1.8.jar
    /SpringSecurity/WebContent/WEB-INF/lib/commons-email-1.0.jar
    /SpringSecurity/WebContent/WEB-INF/lib/commons-fileupload-1.1.1.jar
    /SpringSecurity/WebContent/WEB-INF/lib/commons-io-1.1.jar
    /SpringSecurity/WebContent/WEB-INF/lib/commons-lang-2.5.jar
    /SpringSecurity/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar
    /SpringSecurity/WebContent/WEB-INF/lib/hibernate-commons-annotations-4.0.2.Final.jar
    /SpringSecurity/WebContent/WEB-INF/lib/hibernate-core-4.2.15.Final.jar
    /SpringSecurity/WebContent/WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
    /SpringSecurity/WebContent/WEB-INF/lib/jstl-1.2.jar
    /SpringSecurity/WebContent/WEB-INF/lib/mysql-connector-java-5.1.6.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-aop-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-asm-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-beans-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-context-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-core-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-expression-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-jdbc-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-orm-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-acl-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-aspects-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-cas-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-config-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-core-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-crypto-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-ldap-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-openid-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-remoting-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-taglibs-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-security-web-3.1.3.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-tx-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-web-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/spring-webmvc-3.0.1.RELEASE.jar
    /SpringSecurity/WebContent/WEB-INF/lib/stax-api-1.0-2.jar
    /SpringSecurity/WebContent/WEB-INF/lib/validation-api-1.0.0.GA.jar
  •  
    Prasad Krishnegowda
    Ranch Hand
    Posts: 672
    4
    Eclipse IDE Java Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    If you are using Hibernate4, you should be using the Spring classes for Hibernate4.
    Chane your AnnotationSessionFactoryBean to org.springframework.orm.hibernate4.LocalSessionFactoryBean.
     
    Megha Singhal
    Ranch Hand
    Posts: 225
    IBM DB2 Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    error is still same 404 and on console following is coming


    org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot create inner bean '(inner bean)' of type [org.springframework.beans.factory.config.MethodInvokingFactoryBean] while setting bean property 'eraseCredentialsAfterAuthentication'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': Invocation of init method failed; nested exception is java.lang.NoSuchMethodException: org.springframework.security.authentication.ProviderManager.isEraseCredentialsAfterAuthentication()
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:125)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1308)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': Invocation of init method failed; nested exception is java.lang.NoSuchMethodException: org.springframework.security.authentication.ProviderManager.isEraseCredentialsAfterAuthentication()
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
    ... 24 more
    Caused by: java.lang.NoSuchMethodException: org.springframework.security.authentication.ProviderManager.isEraseCredentialsAfterAuthentication()

     
    Prasad Krishnegowda
    Ranch Hand
    Posts: 672
    4
    Eclipse IDE Java Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Now that Hibernate error is gone..

    <security:http auto-config="true">

    replace the above section with the following:

    <security:http auto-config="true" use-expressions="true">
     
    Megha Singhal
    Ranch Hand
    Posts: 225
    IBM DB2 Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    still same problem
     
    Megha Singhal
    Ranch Hand
    Posts: 225
    IBM DB2 Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    now following exception is coming on the web page


    HTTP Status 500 - Filter execution threw an exception

    type Exception report

    message Filter execution threw an exception

    description The server encountered an internal error that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException: Filter execution threw an exception

    root cause

    java.lang.NoSuchMethodError: org.springframework.security.authentication.AnonymousAuthenticationToken.<init>(Ljava/lang/String;Ljava/lang/Object;Ljava/util/List;)V
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.createAuthentication(AnonymousAuthenticationFilter.java:97)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:64)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

     
    Prasad Krishnegowda
    Ranch Hand
    Posts: 672
    4
    Eclipse IDE Java Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Can you tell us what you did after you got the previous exception? Did you add any extra Spring security Jars?
     
    Megha Singhal
    Ranch Hand
    Posts: 225
    IBM DB2 Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Prasad Krishnegowda wrote:Can you tell us what you did after you got the previous exception? Did you add any extra Spring security Jars?



    i didn't add extra jars .. i just replaced the version of jars like previously i was using spring 3.0 and i read somewhere that for hibernate 4.0 compatibility i need atleast version above 3.1 so i just do that.

    now i am facing this new exception
     
    Prasad Krishnegowda
    Ranch Hand
    Posts: 672
    4
    Eclipse IDE Java Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Post the list of jar files you are packaging now..
     
    Megha Singhal
    Ranch Hand
    Posts: 225
    IBM DB2 Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    its working now.. i created another project and replace all the jars with new version...
     
    Prasad Krishnegowda
    Ranch Hand
    Posts: 672
    4
    Eclipse IDE Java Spring
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Glad to know its working now..
     
    H Paul
    Ranch Hand
    Posts: 491
    5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Prasad
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!