上下文初始化失败

时间:2015-12-27 23:15:53

标签: java spring tomcat

我的代码存在问题。

项目结构显示在图像上 project structures

Tomcat输出:

 Dec 28, 2015 1:01:56 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:TUTEVWeb' did not find a matching property.
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/7.0.67
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Dec 7 2015 13:07:11 UTC
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         7.0.67.0
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Mac OS X
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.11.2
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          x86_64
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.8.0_65-b17
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         /Users/ramazancesur/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         /Users/ramazancesur/Documents/Tomcats/apache-tomcat-7.0.67
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/Users/ramazancesur/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/Users/ramazancesur/Documents/Tomcats/apache-tomcat-7.0.67
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/Users/ramazancesur/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/Users/ramazancesur/Documents/Tomcats/apache-tomcat-7.0.67/endorsed
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Dec 28, 2015 1:01:56 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/ramazancesur/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Dec 28, 2015 1:01:56 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 28, 2015 1:01:56 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Dec 28, 2015 1:01:56 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 450 ms
Dec 28, 2015 1:01:56 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Dec 28, 2015 1:01:56 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.67
Dec 28, 2015 1:01:57 AM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Dec 28, 2015 1:01:57 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Dec 28, 2015 1:01:57 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Dec 28, 2015 1:01:57 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Dec 28, 2015 1:01:57 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Mon Dec 28 01:01:57 EET 2015]; root of context hierarchy
Dec 28, 2015 1:01:57 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/appCtx.xml]
Dec 28, 2015 1:01:58 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2b40520e: defining beans [Kullanici,Kisi,KisiService,KullaniciService,KisiDao,KullaniciDao,DataSource,SessionFactory,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,txManager]; root of factory hierarchy
Dec 28, 2015 1:01:58 AM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2b40520e: defining beans [Kullanici,Kisi,KisiService,KullaniciService,KisiDao,KullaniciDao,DataSource,SessionFactory,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,txManager]; root of factory hierarchy
Dec 28, 2015 1:01:58 AM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.tutev.web.entity.Kullanici] for bean with name 'Kullanici' defined in ServletContext resource [/WEB-INF/appCtx.xml]; nested exception is java.lang.ClassNotFoundException: com.tutev.web.entity.Kullanici
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.tutev.web.entity.Kullanici
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1856)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)
    ... 18 more

Dec 28, 2015 1:01:58 AM 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.CannotLoadBeanClassException: Cannot find class [com.tutev.web.entity.Kullanici] for bean with name 'Kullanici' defined in ServletContext resource [/WEB-INF/appCtx.xml]; nested exception is java.lang.ClassNotFoundException: com.tutev.web.entity.Kullanici
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.tutev.web.entity.Kullanici
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1856)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)
    ... 18 more

Dec 28, 2015 1:01:58 AM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.1.6 (SNAPSHOT 20111206) for context '/TUTEVWeb'
Dec 28, 2015 1:01:58 AM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
Dec 28, 2015 1:01:58 AM com.sun.faces.config.processor.NavigationConfigProcessor addNavigationRules
WARNING: JSF1057: The resource referred to by from-view-id, 'login.xhtml', does not start with '/'.  This will be added for you, but it should be corrected. 
Dec 28, 2015 1:01:58 AM com.sun.faces.config.processor.NavigationConfigProcessor addNavigationCasesForRule
WARNING: JSF1058: The resource referred to by to-view-id, 'error.xhtml', for navigation from '/login.xhtml', does not start with '/'.  This will be added for you, but it should be corrected.
Dec 28, 2015 1:01:58 AM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 4.0
Dec 28, 2015 1:01:58 AM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
INFO: Monitoring jndi:/localhost/TUTEVWeb/WEB-INF/faces-config.xml for modifications
Dec 28, 2015 1:01:58 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Dec 28, 2015 1:01:58 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/TUTEVWeb] startup failed due to previous errors
Dec 28, 2015 1:01:58 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Dec 28, 2015 1:01:58 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 28, 2015 1:01:58 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Dec 28, 2015 1:01:58 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2115 ms

申请背景:

Login.xhtml 

<html xmlns="http://www.w3.org/1999/xhtml"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:p="http://primefaces.org/ui">
 <h:head><title></title></h:head>
 <h:body>
     <h:form>
         <table>
             <tr>
                <td><h:outputLabel for="kullaniciAdi" 
                value="Kullanıcı Adı : " /></td>
                <td><p:inputText id="kullaniciAdi" 
                value="#{loginMB.kullanici.kullaniciAdi}"></p:inputText>
                </td>
             </tr>
             <tr>
                <td><h:outputLabel for="sifre" value="Şifre : "  /></td>
                <td><p:inputText id="sifre" 
                value="#{loginMB.kullanici.sifre}"></p:inputText>
                </td>
             </tr>
             <tr>
                <td><p:commandButton id="giris" value="Giriş" 
                action="#{loginMB.login}" ajax="false"/></td>
                <td />
             </tr>
         </table>
     </h:form>
</h:body>
</html> 

Kullanici班:

package com.tutev.web.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="gnl_kullanici")
public class Kullanici {

    Long id;
    String kullaniciAdi;
    String sifre;
    Kisi kisi;

    @Id
    @SequenceGenerator(name = "gnl_kullanici_seq", sequenceName = "gnl_kullanici_seq", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "gnl_kullanici_seq")
    @Column(name = "kullanici_id")
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "kullanici_adi",length=30,unique=true)
    public String getKullaniciAdi() {
        return kullaniciAdi;
    }
    public void setKullaniciAdi(String kullaniciAdi) {
        this.kullaniciAdi = kullaniciAdi;
    }

    @Column(name = "kullanici_sifre")
    public String getSifre() {
        return sifre;
    }
    public void setSifre(String sifre) {
        this.sifre = sifre;
    }

    @ManyToOne(optional = true)
    @JoinColumn(name="kisi_id",columnDefinition = "kisi_id")
    public Kisi getKisi() {
        return kisi;
    }
    public void setKisi(Kisi kisi) {
        this.kisi = kisi;
    }
    @Override
    public String toString() {
        return "Kullanici [id=" + id + ", kullaniciAdi=" + kullaniciAdi
                + ", sifre=" + sifre + ", kisi=" + kisi + "]";
    }
}

Kullanici_ManagedBean:

package com.tutev.web.managedbean;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

import com.tutev.web.entity.Kullanici;
import com.tutev.web.service.impl.IKullaniciService;

@ManagedBean(name="loginMB")
@RequestScoped
public class LoginManagedBean implements Serializable{

    private static final long serialVersionUID = 7261398347826935912L;

    private static final String SUCCESS = "success";
    private static final String ERROR = "error";

    @ManagedProperty(value="#{KullaniciService}")
    IKullaniciService kullaniciService;

    Kullanici kullanici;

    @PostConstruct
    private void init() {
    kullanici=new Kullanici();

    }

    public String login() {
        Kullanici kullaniciDb=getKullaniciService().getByUserNamePassword(this.getKullanici());
        if(kullaniciDb!=null && kullaniciDb.getId()!=null){
            return SUCCESS;
        }else{
            return ERROR;
        }
    }

    public Kullanici getKullanici() {
        return kullanici;
    }

    public void setKullanici(Kullanici kullanici) {
        this.kullanici = kullanici;
    }

    public IKullaniciService getKullaniciService() {
        return kullaniciService;
    }

    public void setKullaniciService(IKullaniciService kullaniciService) {
        this.kullaniciService = kullaniciService;
    }
}

Web.xml中

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="TutevWeb"
         version="2.5">

      <display-name>TutevWeb</display-name>

      <context-param>
         <param-name>contextConfigLocation</param-name>
         <param-value>
            /WEB-INF/appCtx.xml
         </param-value>
      </context-param>

      <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
      </listener>
      <listener>
        <listener-class>
            org.springframework.web.context.request.RequestContextListener
        </listener-class>
      </listener>

      <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
      </context-param>

      <welcome-file-list>
        <welcome-file>login.xhtml</welcome-file>
      </welcome-file-list>

      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>

      <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
      </servlet-mapping>
</web-app>

应用程序上下文(App_ctx)

        <beans xmlns="http://www.springframework.org/schema/beans"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:tx="http://www.springframework.org/schema/tx"
                xmlns:context="http://www.springframework.org/schema/context"
                xsi:schemaLocation="http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/tx
                http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
                http://www.springframework.org/schema/context
                http://www.springframework.org/schema/context/spring-context-3.0.xsd">

            <bean id="Kullanici" class="com.tutev.web.entity.Kullanici"/>
            <bean id="Kisi" class="com.tutev.web.entity.Kisi"/>

             <bean id="KisiService" class="com.tutev.web.service.KisiService">
                <property name="kisiDao" ref="KisiDao" />
            </bean>

            <bean id="KullaniciService" class="com.tutev.web.service.KullaniciService">
                <property name="kullaniciDao" ref="KullaniciDao" />
            </bean>

             <bean id="KisiDao" class="com.tutev.web.dao.KisiDao">
                <property name="sessionFactory" ref="SessionFactory" />
            </bean>

            <bean id="KullaniciDao" class="com.tutev.web.dao.KullaniciDao">
                <property name="sessionFactory" ref="Kullanici" />
            </bean>

            <bean id="DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
                <property name="driverClass" value="org.postgresql.Driver" />
                <property name="jdbcUrl" value="jdbc:postgresql://localhost:5431/TTV" />
                <property name="user" value="...user..." />
                <property name="password" value="...pass..." />
                <property name="maxPoolSize" value="10" />
                <property name="maxStatements" value="0" />
                <property name="minPoolSize" value="5" />
            </bean>
            <bean id="SessionFactory"
                class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
                <property name="dataSource" ref="DataSource" />
                <property name="annotatedClasses">
                    <list>
                        <value>com.tutev.web.entity.Kullanici</value>
                        <value>com.tutev.web.entity.Kisi</value>
                    </list>
                </property>
                <property name="hibernateProperties">
                    <props>
                        <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
                        <prop key="hibernate.show_sql">true</prop>
                        <prop key="hibernate.hbm2ddl.auto">update</prop>
                        <prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop>
                    </props>
                </property>
            </bean>
            <tx:annotation-driven transaction-manager="txManager" />
            <bean id="txManager"
                class="org.springframework.orm.hibernate4.HibernateTransactionManager">
                <property name="sessionFactory" ref="SessionFactory" />
            </bean>
        </beans>

和pom.xml,

<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
    http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>TUTEVWeb</groupId>
  <artifactId>TUTEVWeb</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <properties>
        <spring.version>3.1.1.RELEASE</spring.version>
    </properties>

    <dependencies>

        <!-- Spring Framework dependencies -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
    </dependency> 

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <!-- JSF dependencies -->
     <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-api</artifactId>
      <version>2.1.6</version>
    </dependency>

    <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-impl</artifactId>
      <version>2.1.6</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

        <!-- Primefaces dependency -->
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>4.0</version>
    </dependency>

        <!-- Hibernate dependencies -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.1.0.Final</version>
    </dependency>

    <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.12.1.GA</version>
    </dependency>

    <!-- Postgres Java Connector dependency -->
    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.1-901.jdbc4</version>
    </dependency>

    <!-- c3p0 dependency -->
    <dependency>
        <groupId>c3p0</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.1.2</version>
    </dependency>            

  </dependencies>
</project>

我的问题是严重:

Context initialization failed org.springframework.beans.factory.CannotLoadBeanClassException:
    Cannot find class [com.tutev.web.entity.Kullanici] for bean with name 'Kullanici'
    defined in ServletContext resource [/WEB-INF/appCtx.xml]; nested exception is
    java.lang.ClassNotFoundException: com.tutev.web.entity.Kullanici

我该怎么办?

1 个答案:

答案 0 :(得分:1)

您没有在pom.xml(<version>${spring.version}</version&gt;)

中声明spring版本变量