Tomcat - 使用名称entityManagerFactory创建bean时出错

时间:2014-06-11 18:15:37

标签: java oracle hibernate tomcat cas

我正在使用带有Apache Tomcat 7.0.54的Maven 2.2.1覆盖和用于LDAP身份验证的Oracle数据库,使用Jasig CAS 3.5.2.1实现RHEL6,我在制作Tomcat时遇到了一些麻烦与数据库玩得很好。当我启动Tomcat并尝试登录CAS时,我收到一条404消息,当我检查Tomcat localhost日志时,它说的是:

Jun 11, 2014 10:40:12 AM org.apache.catalina.core.ApplicationContext log
SEVERE: SafeContextLoaderListener: 
The Spring ContextLoaderListener we wrap threw on contextInitialized.
But for our having caught this error, the web application context would not have initialized.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ticketRegistry': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring-con
figuration/ticketRegistry.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:342)
    .
    .
    .
    .
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/sp
ring-configuration/ticketRegistry.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
    .
    .
    .
    .
    .
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 42 more

我的entityFactoryManager bean看起来像:

<!-- Ticket Registry -->
 <bean id="ticketRegistry" class="org.jasig.cas.ticket.registry.JpaTicketRegistry" />

<!-- 
 Injects EntityManager/Factory instances into beans with
 @PersistenceUnit and @PersistenceContext
-->
   <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>

   <bean id="entityManagerFactory"
     class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
       <property name="dataSource" ref="dataSource"/>
       <property name="jpaVendorAdapter">
         <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
           <property name="generateDdl" value="true"/>
           <property name="showSql" value="true" />
           <property name="databasePlatform" value="org.hibernate.dialect.OracleDialect"/>
         </bean>
       </property>
     <property name="jpaProperties">
       <props>
         <prop key="hibernate.dialect">${database.hibernate.dialect}</prop>
         <prop key="hibernate.hbm2ddl.auto">update</prop>
       </props>
     </property>
 </bean>

其中database.hibernate.dialect = org.hibernate.dialect.OracleDialect。

我已经尝试了一些我在这里和网络上看过的东西,但没有任何东西可以解决我对这件事的困惑。我很感激我能得到的任何帮助。

感谢您的时间。

0 个答案:

没有答案