解决方案 »

  1.   

    配置扫描目录后   applicationContext.xml  里面的bean 配置是否正确?
      

  2.   


    我也觉得是,但是不知道是那个jar,你看下我这还缺什么包
      

  3.   


    applicationContext.xml 里还需要配置什么bean 就配了数据源
    entity配置在META-INF/persistence.xml 里
      

  4.   

    最土的方法就是把所有的jar都丢进去,然后运行看看
      

  5.   

    用的tomcat启动?把tomcat-->你的工程下面的j2ee.jar删了试试能不能启动吧
      

  6.   


    不行 会报这个java.lang.NoClassDefFoundError: javax/servlet/Filter
      

  7.   

    applicationContext.xml这个文件什么内容,看看
      

  8.   

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx" 
        xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/tx    
        http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
        http://www.springframework.org/schema/data/jpa
        http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.1.xsd
    http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring     
    http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd
    ">
    <!-- 配置自动注入-->
    <context:annotation-config/> 
    <!-- info3 交给spring过滤器托管 -->
    <bean id="springFilter" class="com.infoservice.mvc.FilterDispatcher"></bean>
    <!-- 定义实体管理器工厂 -->
         <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">  
                 <property name="persistenceUnitName" value="HibernateJPAPU"/>
         </bean>
             
         <!-- 配置事务管理器 -->  
        <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">  
             <property name="entityManagerFactory" ref="entityManagerFactory" />  
        </bean> 
           
        <!-- 启用 annotation事务--> 
        <tx:annotation-driven transaction-manager="transactionManager"/> 

    <jpa:repositories base-package="com.hr.dao"/>
       <!-- 扫描符合@Service @Repository的类 
        <context:component-scan base-package="com.hr" use-default-filters="false">
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Service" />
         <context:include-filter type="annotation" expression="org.springframework.stereotype.Repository" />
    </context:component-scan>
    -->

    <!--缓存机制
    <ehcache:annotation-driven cache-manager="ehCacheManager" />
    <bean id="ehCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">    
    <property name="configLocation" value="classpath:ehcache.xml" />
    </bean>
    -->
    <!-- 配置SpringDataJpa文件 
    <import resource="SpringDataJPA.xml"/>
    -->
    <!-- SpringData指定扫描目录配置文件
    <import resource="RepositoryScan.xml"/>
     -->
    <!-- 配置定时任务文件 
    <import resource="Schedule.xml"/>
    -->

    </beans>