cancel
Showing results for 
Search instead for 
Did you mean: 

Runtime version when deploying Java application to BTP Neo

takuya_endo
Advisor
Advisor
0 Kudos

Hi, everyone

Can you anyone why the following case of #1 is only successful?

They are cases when deploying Java application in BTP Neo.

==<Cases>==

#1 Datasource binding is not defined and Runtime is "Java EE 7 Web Profile TomEE 7".

-> We get the following error and deploying is failed

ERROR#com.sap.core.services.accessor.tomcat.support.DelegatingObjectFactory#BC-NEO-RT- JAV#anonymous#localhost-startStop-1#com.sap.core.services.accessor#abd30f7a7#benefits#web##na#na#na#na#Exception is thrown by facroty [com.sap.cloud.runtime.kotyo.persistence.client.PersistenceDataSourceFactory@4fd10c95] during retrieving object instance. Exception is: javax.naming.NamingException: No persistence configuration available for resource name [jdbc/defaultManagedDataSource], check datasource bindings for this application

#2 Datasource binding is not defined and Runtime is Java Web Tomcat 9".

-> We don't get the error and deploying is successful.

=====

The difference between #1 and #2 is only runtime version.

Application to deploy is completely same.

Java EE7 Web Profile TomEE7 only works something process to validate or check datasource binding during deploy ?

View Entire Topic
takuya_endo
Advisor
Advisor
0 Kudos

Hi, ivan.mirisola.

Thank you for your answer.

It is very useful.

Please let me ask one more question.

Currently, if we deploy the application with Application-managed persistence approach against Java EE 7 Web Profile Tom EE7 runtime and Datasource binding is defined,

deploying is successful.

On the other hand, if we remove datasource binding, deploying is failed.

Is the definition of datasource binding playing the role of Container-managed persistence ?

From your comment I understood as follows.

1. Java EE 7 Web Profile Tom EE7

→ Requires Container-managed persistence approach

2. Java Web Tomcat 9 (or 😎

→ Requires Application-managed persistence approach

Therefore we may get the issue when deploying application with Application-managed persistence approach against runtime "Java EE 7 Web Profile TomEE 7".

And you recommend to develop application with both approaches for both runtimes.

Best regards,
Takuya Endo

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi takuya.endo,

I recommended using EclipseLink for JPA and using both approaches so you would be able to use any preferred runtime. I implicitly assumed that you know what you are doing - which may imply the need to add missing jar libraries so the SDK runtime is able to run the code without any issues. For instance, the annotation @PersistenceContext isn't supported out of the box for Java Web - not because Java doesn't support it. It simply means that the annotation libraries for it aren't present within the runtime on BTP/Neo when you deploy it. However, if you include them on your project it will work. It might not be recommended as it could potentially break the application when you upgrade to a different runtime version without updating the included libraries to make the code compatible - in my experience on most cases it works just fine.

To be on the safe side of things the documentation clearly states that for JPA projects you ought to be using Web Profile with container managed.

And, regardless of the management type you are using on your app, it is still mandatory to bind your application to the database service. That is how your application knows how to pick up all the JDBC connection details like host, user and password and schema. Otherwise, the application simply doesn't know what "java:comp/env/jdbc/DefaultDB" means is terms of JDBC connection. Same will happen if you are using container managed.

BTW: I pretty confident you shouldn't be investing on new development that would run on Neo as it is about to be sunset by SAP in the short term.

Best regards,
Ivan