2011-11-07 78 views
1

我遇到了JBoss 7.02.Final的问题。我正在从JBoss5.1GA移植一个项目,并且(在支持EE6的查找中有相当数量的重写)我在注册classpath上的Eclipselink时遇到了问题。我搜索了四周,我看到几个帖子说这个问题已经解决,但我似乎无法找到一个工作的例子。JBoss7和Eclipselink,没有EntityManager的持久性提供者

由于我是EE6开发的新手,所以我做错事的可能性非常高。

耳朵被构建为以下

- ProductionEE6 
    ./lib/eclipselink2.*.jar 
    ./lib/javax.persistence.jar 
    . . . 
    ProductionEJB.jar 
    . . . 
    Production.war 

我的persistence.xml是:

<?xml version="1.0" encoding="UTF-8"?> 
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd"> 
    <persistence-unit name="production" transaction-type="RESOURCE_LOCAL"> 
     <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> 

     <non-jta-data-source>java:/ProductionDS</non-jta-data-source> 
     <class><!-- entities --></class> 

     <properties> 
      <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/> 
      <property name="eclipselink.target-server" value="JBoss"/> 
      <!-- A few other properties here --> 
     </properties>  
    </persistence-unit> 
</persistence> 

一切靴子了罚款,我看到的数据源,通过我得到的安全性(通过一个自定义DatabaseModule,所以我的数据源一定很好),当我最终打电话给一个EJB时,我看到以下错误:

Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named production 
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final] 
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final] 
    at com.danielbchapman.production.entity.DelegateInstance.getEm(DelegateInstance.java:67) [ProductionEJB.jar:] 
    at com.danielbchapman.production.entity.EntityInstance.getEm(EntityInstance.java:39) [ProductionEJB.jar:] 
    at com.danielbchapman.production.beans.OptionsDao.<init>(OptionsDao.java:20) [ProductionEJB.jar:] 
    ... 94 more 

对此,我没有使用JTA数据源,因此我一直在手动处理事务。这呼唤,就是“DelegateInstance”上面用下面的代码:(这里persistenceUnitId是“生产”在这种情况下)

/** 
* @return an instance of the entity manager if it isn't there. 
*/ 
public EntityManager getEm() 
{ 
    if(manager == null) 
    { 
     manager = Persistence.createEntityManagerFactory(getPersistenceUnitId()) 
       .createEntityManager(); 
    } 

    return manager; 
} 

我什么担心最多的是看到了这个堆栈上: [ hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]很明显,我没有正确加载EclipseLink。我在这里没有想法,所以如果有人能帮助我,我会非常感激。

回答

1

EclipseLink 2.4现在将与JBoss AS 7.1.1一起工作 - 测试和工作 - hth

+0

谢谢约翰,我会给这个建筑一个镜头。 –

+0

对不起,花了这么长时间来测试,但是,是的,现在Eclipselink 2.4在JBoss 7.1.1中运行良好。 –

0

根据http://dev.dzhokanov.com/?p=8

此外,本次论坛主题来支持我的假设 - http://community.jboss.org/message/623759#623759

在线程斯科特·马洛(JBoss的7/JPA的主要开发人员)坦言:

“您不是唯一想要使用EclipseLink但尚未准备好的人。 “

据我所知,EclipseLink JPA实现中存在一些不兼容性,为了与JBoss 7兼容,需要对其进行调整。因此,我不期望Jboss 7-EclipseLink支持即将推出。

所以可能是这种情况,目前根本不可能。但是如果你找到了方法,我会对它很感兴趣。

+0

我直接联系了Scott,并且正在关闭Alpha。我现在是石壁的时间,但希望在接下来的〜2周内我会完成。 ALPHA允许你设置一个Eclipselink模块,但是你会遇到你没有Session Customization的情况下使用JBoss 5.1获得的VFS URL错误。它是从VFS拉取persistence.xml的空资源的问题。总之 - 我需要很多时间。让我知道你的进步。 –

+0

我只是改变了实现使用Hibernate,并继续前进。对不起,我没有时间在这个问题上提供更多帮助。祝你好运! –

相关问题