无法从驱动程序[null],用户[null]和URL [null]获取连接。 / EclipseLink 1.2 / Spring 2.5.6 / OSGI

时间:2010-05-07 13:47:36

标签: spring jpa osgi eclipselink

我尝试部署一个项目,其中EclipseLink JPA在OSGI平台上用作ORM工具。在OSGI容器外部运行时,该项目可以正常工作。

使用的版本:Spring 2.5.6,EclipseLink 1.2.0

不幸的是,我在OSGI平台上遇到了这个错误:

Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null].  Verify that you have set the expected driver class and URL.  Check your login, persistence.xml or sessions.xml resource.  The jdbc.driver property should be set to a class that is compatible with your database platform
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:290)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:146)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:198)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:186)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:434)
    at $Proxy152.createEntityManager(Unknown Source)
    at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:190)
    at $Proxy153.find(Unknown Source)

由于未知原因,EclipseLink未检索创建并添加到org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean的数据源

欢迎任何想法?

亲切的问候,

查尔斯

2 个答案:

答案 0 :(得分:0)

您是否检查过数据库属性文件是否在类路径中?

确保它在那里。

答案 1 :(得分:0)

请参阅,

http://wiki.eclipse.org/EclipseLink/Examples#OSGi_Examples

确保您可以访问DataSource并且所有OSGi和Spring配置都是正确的。