Skip to Content

How do I ignore/bypass creating Data source binding for my SCP Java Application?

Feb 07 at 05:09 AM


avatar image
Former Member

Hi Colleagues,

I have a SCP Java Application that has to be deployed on multiple different sub - accounts, where some sub accounts have a data source added, while some are not connected to ANY DATA SOURCE. For the latter type of subaccounts, I want to skip/ignore the loading of persistant units. We don't need a data source binding for the same. But when I don't attach a data source binding for the application, i get an error message:

org.apache.openejb.OpenEJBException: Could not lookup <jta-data-source> 'openejb/Resource/data-buffer/jdbc/defaultManagedDataSource' for unit 'cfa-library': Error calling instance factory method: public java.lang.Object

I need to somehow NOT create a data source binding, and not get this error. Can you let me know if there is any way for the same.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Ivan Mirisola
Feb 07 at 12:09 PM

Hi Suhas,

I believe we are talking about a neo deployment, correct?

I need to ask a few questions before answering your question. Why do you need to use a compute unit on each sub-account? This way it would make it very hard to maintain version compatibility across multiple sub-accounts - no to mention a waste of compute unit resources.

Why not use the multi-tenancy concept and the SCP SDK APIs to figure out on which tenant your code is running? This way you database connection will always remain bound in your main account. The sub-accounts will contain only a subscription to the main account and thus there is no need to have multiple deployments. All you need to do is figure out the tenant ID during app logon (first UI screen you display) and than you manage the database artifacts based on the tenant ID (just like SAP ERP does with the 'client' concept). There are APIs on the SDK available to determine the context on which your code is running. And there are also ways to make your code run from the main account onto the context of another sub-account (tenant). Let me know if you need any details on this approach so I can provide you links to the relevant documentation.

If the above approach doesn't work for you, please let us know how your EJB connects to your database instance (i.e: JPA, JDBC/DAO, etc.) - recommended way is to use JPA with either Spring Boot or EclipseLink. In any case, please share how your persistence.xml for us to better understand what is being used and how. I believe you may need to set property "javax.persistence.schema-generation.database.action" to "none" to avoid schema creation at startup. This way SCP will not attempt to bind your app to a database right away. But this is only a wild guess, since I am not sure how your app is set.


Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Ivan,

Thanks a lot for the answer. We are deploying the application in the NEO environment.

We have used Spring MVC + EclipseLink JPA to connect to the data source.

We have two java projects : cfa-library and cfa-main.

The Project cfa-library is the common library project, and consists of all the persistance APIs. The cfa-library is included as a .jar dependency in the pom.xml of cfa-main.

The cfa-main project is a deployable .war file, which will ultimately be deployed on SCP Neo Account.

There are multiple class files under different java packages in cfa-main project. During deployment, multiple .war files will be created from the cfa-main project, each time using different class files under specific packages. For example, the cfa-main project consists of two packages - and Two .war files would be created , one packaged with files only in the .seb package(Lets call it warfile1), and the other one containing files only in the .databuffer package((Lets call it warfile2).

Now these two .war files will be deployed in different sub accounts under the same global account.

The warfile1 doesn't require a data source, as a result the data source binding would not be created for the warfile1. The warfile2 requires a database connection, therefore a data source binding would be created.

The Problem arises when we don't create a data source binding for warfile1, as the Classes in the cfa-library jar file connect to the data source. How can I start the application from warfile1, without having a data source binding?

Below is my persistance.xml. This file is present in cfa-library project, and remains the same for both warfile1 and warfile2.:

Do let me know if any more information is needed.

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="" xmlns:xsi="" 
	<persistence-unit name="cfa-library" transaction-type="JTA">
			<property name="eclipselink.ddl-generation" value="create-tables"/>
			<property name="eclipselink.query-results-cache" value="false"/>

Hi Suhas,

Have you tried with "eclipselink.ddl-generation" = "none"?

According to EclipseLink docs, none will not trigger any DDL to create tables or schemas (which is used by SCP to define the binding). Since you have it set to "create-tables", the system will try to create the binding first.

I still don't understand why you would need more then one sub-account for running your application. It would be possible to subscribe to the whole solution from a subscriber sub-account if needed (even from other global accounts). The provider account is all you need. Technically you don't need this type of separation when you have the tenant concept in place.