当我使用Jboss 4.2.3 GA并配置了我的ms-sql.ds文件时,出现以下错误。我创建了一个Entity Bean EJB3,并试图从EJB 2.1 Session Bean中访问该Entity bean。首先,我想检查是否有可能。因为当我使用EntityManager
或EntityManagerFactory
, 我的EntityManager
正在作为空。此外,而不是如果我用EntityManagerFactory
,它给 一个错误说:没有找到持久性提供者
javax.persistence.PersistenceException:否 EntityManager的持久性提供者名为EjbComponentPU
下面是我的课
public class TestBean implements SessionBean {
//pass persistence unit to entityManager.
@PersistenceContext(unitName="EjbComponentPU")
private EntityManager entitymanager;
我的项目文件夹结构是:
src
- 拥有所有的软件包。 里面,我有META-INF
文件夹,其中有persistence.xml
文件
感谢您的任何帮助。
你可以显示你的persistence.xml的内容吗? – mikereem
http://stackoverflow.com/questions/1158159/no-persistence-provider-for-entitymanager-named – imoteb
嗨,这是我的persistence.xml文件。 – anu8802