JDev Exception:Cannot acquire data source java:/app/jdbc/jdbc/DataSourceName.

Issue:

 

When you are invoking some operation that related to EJB entity persistence in weblogic using EclipseLink, you may come across the exception as following.

 

Caused by: Exception EclipseLink-7060 (Eclipse Persistence Services - 1.0.1 (Build 20080905)): org.eclipse.persistence
.exceptions.ValidationException
Exception Description: Cannot acquire data source java:/app/jdbc/jdbc/DataSourceName.
Internal Exception: javax.naming.NameNotFoundException: While trying to look up /app/jdbc/jdbc/DatabaseDevDS in /app/ejb/E
JB.jar#SessionEJB.; remaining name '/app/jdbc/jdbc/DataSourceName'
at org.eclipse.persistence.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:429)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:123)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:164)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:32
4)

 

 

Solution:

Please check whether your JNDI name format is like  java:/app/jdbc/jdbc/DataSourceName*)

There is a double "jdbc") as opposed to a global name (*DataSourceName*) in your JPA persistence.xml. It indicates that you are using an “application scoped” datasource and not a “globally scoped” datasource that is defined directly on your WebLogic server.


If you want to use an application scoped datasource on Oracle WebLogic server, please refer to

http://wiki.eclipse.org/EclipseLink/Examples/JPA/WLS_AppScoped_DataSource

and

http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Application_Scoped_Datasource_Setup

 

The above enterprise application based tutorial using EclipseLink as the JPA provider describes a workaround for using an “application scoped” datasource when deployed on WebLogic 10.3 using both the normal element and the overriding javax.persistence.jtaDataSource property, until the base WLS Server bug being tracked by EclipseLink bug# 246126 in http://bugs.eclipse.org/246126 is fixed shortly.

 

In addition, you’d better add following property to your  persistence.xml:
1) Add a reference to the WebLogic platform

2) Verify that you have really defined your application scoped datasource with a double "jdbc" "java:/app/jdbc/jdbc/DatabaseDevDS"and didn't really mean "java:/app/jdbc/DatabaseDevDS" which is usually standard

 

see
http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Persistence.xml
and an EclipseLink open source example that uses a globally define datasource in a WebLogic Web application tutorial using EclipseLink as the JPA provider
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEJB/ejbModule/META-INF/persistence.xml

Also, an additional workaround would be to globally define the datasource on your integrated WebLogic server and reference it as described in...
http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Global_Scoped_Datasource_Setup

 

 

For the details, please refer to http://forums.oracle.com/forums/thread.jspa?threadID=828586

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yexianyi

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值