Skip to Content
avatar image
Former Member

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 07, 2018 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.


    Add comment
    10|10000 characters needed characters exceeded

    • 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.