创建名为'entityManagerFactory'的bean时出错:init方法的调用失败;嵌套异常是javax.naming.NamingException

时间:2013-09-30 23:53:08

标签: spring glassfish jndi ejb-3.1

我正在创建一个使用spring + ejb3.1 + glassfish的项目

这里是文件配置:

的beans.xml

<jee:jndi-lookup id="dataSource" jndi-name="jdbc/dbaas" />

  <jee:jndi-lookup id="entityManagerFactory" jndi-name="dbaasPU"/>

  <jpa:repositories base-package="com.manwin.dbaas.repository" />

  <tx:jta-transaction-manager />

  <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
           <bean id="someId" class="org.springframework.orm.hibernate4.HibernateExceptionTranslator"/> 



  <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
  </bean>

的persistence.xml

  <persistence-unit name="dbaasPU" transaction-type="JTA">
        <jta-data-source>jdbc/dbaas</jta-data-source>
  </persistence-unit>

一个班级

@WebService
@Stateless
@Interceptors(SpringBeanAutowiringInterceptor.class)
public class JobServiceImpl implements JobService{

    @Inject
    JobDaoJpa jobDaoJpa;

我遇到了以下错误:

Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Invocation of init method failed; nested exception is javax.naming.NamingException: Lookup failed for 'cloud-dbaas-PU' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory,

0 个答案:

没有答案