我正在创建一个使用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,