org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource
20:58 14 Nov 2013

I am getting the exception:

Error creating bean with name 'sessionFactory' defined in ServletContext resource

Is it happening because of jar mismatch? If you need any further details please let me know.

log

ERROR: org.springframework.web.servlet.DispatcherServlet - Context initialization failed

Stack-Trace :

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Unable to load class declared as  in the configuration:
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
    at javax.servlet.GenericServlet.init(GenericServlet.java:160)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.hibernate.MappingException: Unable to load class declared as  in the configuration:
    at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:638)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1561)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1540)
    at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1002)
    at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:69)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1514)
    at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:990)
    at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:69)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1449)
    at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:978)
    at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:69)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:642)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
    ... 28 more

spring-servlet.xml :


    
    
    



    
    







    
    
        classpath:/hibernate.cfg.xml
    
    
        org.hibernate.cfg.AnnotationConfiguration
    
    
        
            ${jdbc.dialect}
            true
            
        
    




    

pom.xml:

    
    3.0.5.RELEASE



    
    
        org.springframework
        spring-core
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-expression
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-beans
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-aop
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-context
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-context-support
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-tx
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-jdbc
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-orm
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-oxm
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-web
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-webmvc
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-webmvc-portlet
        ${org.springframework.version}
    

    
    
        org.springframework
        spring-test
        ${org.springframework.version}
        test
    
    
    
        org.springframework.security
        spring-security-core
        ${org.springframework.version}
    
    
        org.springframework.security
        spring-security-web
        ${org.springframework.version}
    
    
        org.springframework.security
        spring-security-taglibs
        ${org.springframework.version}
    
    
        org.springframework.security
        spring-security-config
        ${org.springframework.version}
    


    
    
        org.hibernate
        hibernate-entitymanager
        3.6.7.Final
    
    
        org.hibernate
        hibernate-validator
        3.1.0.GA
    
    
        org.hibernate
        hibernate-annotations
        3.3.1.GA
    
    
        org.hibernate
        hibernate-core
        3.3.2.GA
    
    
    
        net.sf.ehcache
        ehcache-core
        2.2.0
    
    
        antlr
        antlr
        2.7.7
    

    

    
        taglibs
        standard
        1.1.2
    
    
        javax.servlet
        jstl
        1.1.2
    
    
        commons-dbcp
        commons-dbcp
        20030825.184428
    
    
        commons-pool
        commons-pool
        20030825.183949
    

    
    
        log4j
        log4j
        1.2.14
        jar
        
            
                javax.mail
                mail
            
        
    
    
        org.slf4j
        slf4j-log4j12
        1.6.0
    

    
        com.oracle
        ojdbc14
        10.2.0.1.0
    
    
        javax.servlet
        servlet-api
        2.4
        provided
    
    
        javax.servlet.jsp
        jsp-api
        2.1
        provided
    
    
        javax.validation
        validation-api
        1.0.0.GA
    



After digging a lot I found that it is happening because of ClassNotFound exception for AnnotationSessionFactoryBean but I have added the dependencies and it is in my class path so why I am getting this kind of exception. screen shots attached enter image description here enter image description here Thanks.....

java spring hibernate