on 2023 Sep 18 5:40 PM
Hello all,
I was doing a POC with a CAP Java multi-tenancy with out CDS using a steamlined-MTX approach with the sample file downloaded from here : https://github.com/SAP-samples/cloud-cap-samples-java
My requirement was that I need to refactor an already available application deployed in NEO in BTP to make it multi-tenant aware. there was no CDS artifact in my project , only .hdbtable file. The application also connects to on Prem SAP systems via RFC using SAP JCo
with help from people of this community, everything worked. the as the last piece of puzzle I started to read documentation of SAP JCo to make it multi-tenant aware. then I came to know that for JCo to work we have to switch to WAR deployment instead of default JAR deployment but the latest CAP version uses Springboot 3 which intern uses jakarta.* instead of javax.*. So for WAR deployment we would need at least Tomcat 10.but there is no build pack available for that according to SAP
So to make it work I switched to mtx-classic branch approach(downloaded sample code from GIT), changed all the codes, made necessary changes for war deployment and now when I am deploying it in CF, the backend service(srv modulde) is not getting started .:( .Getting this error stack trace
{"msg":"A child container failed during start","level":"ERROR","written_ts":"1695048877752000000","logger":"org.apache.catalina.core.ContainerBase","written_at":"2023-09-18T14:54:37.752Z","thread":"main","type":"log","stacktrace":["java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start","\tat java.util.concurrent.FutureTask.report(FutureTask.java:122)","\tat java.util.concurrent.FutureTask.get(FutureTask.java:192)","\tat org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:873)","\tat org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:249)","\tat org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)","\tat org.apache.catalina.core.StandardService.startInternal(StandardService.java:428)","\tat org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)","\tat org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:922)","\tat org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)","\tat org.apache.catalina.startup.Catalina.start(Catalina.java:772)","\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)","\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)","\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)","\tat java.lang.reflect.Method.invoke(Method.java:498)","\tat org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347)","\tat org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)","Caused by: org.apache.catalina.LifecycleException: A child container failed during start","\tat org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:885)","\tat org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:795)","\tat org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)","\tat org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1328)","\tat org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1318)","\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)","\tat org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)","\tat java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)","\tat org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)","\t... 13 more","Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/S4ConfigRPA]]","\tat java.util.concurrent.FutureTask.report(FutureTask.java:122)","\tat java.util.concurrent.FutureTask.get(FutureTask.java:192)","\tat org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:873)","\t... 21 more","Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/S4ConfigRPA]]","\tat org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)","\tat org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)","\tat org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1328)","\tat org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1318)","\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)","\tat org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)","\tat java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)","\tat org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)","\t... 21 more","Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.sap.cds.framework.spring.config.runtime.CdsRuntimeInitializer': Invocation of init method failed; nested exception is com.sap.cds.CdsException: com.sap.cds.CdsCommunicationException: Sidecar returned with status 404","\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)","\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)","\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)","\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)","\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)","\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)","\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)","\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)","\tat org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920)","\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)","\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)","\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)","\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)","\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:307)","\tat org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175)","\tat org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155)","\tat org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97)","\tat org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)","\tat org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4936)","\tat org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)","\t... 27 more","Caused by: com.sap.cds.CdsException: com.sap.cds.CdsCommunicationException: Sidecar returned with status 404","\tat com.sap.cds.mtx.impl.MetaDataAccessorImpl$Cache.getOrLoadIfStale(MetaDataAccessorImpl.java:219)","\tat com.sap.cds.mtx.impl.MetaDataAccessorImpl.getCdsModel(MetaDataAccessorImpl.java:141)","\tat com.sap.cds.services.impl.model.DynamicModelProvider.get(DynamicModelProvider.java:53)","\tat com.sap.cds.services.impl.runtime.CdsRuntimeImpl.getCdsModel(CdsRuntimeImpl.java:98)","\tat com.sap.cds.services.impl.runtime.RequestContextRunnerImpl.run(RequestContextRunnerImpl.java:193)","\tat com.sap.cds.services.impl.runtime.RequestContextRunnerImpl.run(RequestContextRunnerImpl.java:174)","\tat com.sap.cds.services.impl.ServiceImpl.emit(ServiceImpl.java:156)","\tat com.sap.cds.services.ServiceDelegator.emit(ServiceDelegator.java:52)","\tat com.sap.cds.services.impl.mt.TenantProviderServiceImpl.readProviderTenant(TenantProviderServiceImpl.java:30)","\tat com.sap.cds.services.impl.mt.ProviderTenantNormalizationConfiguration.providers(ProviderTenantNormalizationConfiguration.java:23)","\tat com.sap.cds.services.impl.runtime.CdsRuntimeConfigurerImpl.lambda$providerConfigurations$5(CdsRuntimeConfigurerImpl.java:208)","\tat java.util.ArrayList.forEach(ArrayList.java:1259)","\tat com.sap.cds.services.impl.runtime.CdsRuntimeConfigurerImpl.providerConfigurations(CdsRuntimeConfigurerImpl.java:208)","\tat com.sap.cds.framework.spring.config.runtime.CdsRuntimeInitializer.afterPropertiesSet(CdsRuntimeInitializer.java:90)","\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)","\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)","\t... 46 more","Caused by: com.sap.cds.CdsCommunicationException: Sidecar returned with status 404","\tat com.sap.cds.mtx.impl.AbstractSidecarAccess.lambda$getCheckFunction$0(AbstractSidecarAccess.java:89)","\tat com.sap.cloud.mt.tools.api.ServiceEndpoint$ServiceEndpointBuilder.lambda$createResponseChecker$0(ServiceEndpoint.java:93)","\tat com.sap.cloud.mt.tools.impl.ServiceCallImpl.execute(ServiceCallImpl.java:187)","\tat com.sap.cloud.mt.tools.impl.ServiceCallImpl.lambda$execute$1(ServiceCallImpl.java:96)","\tat com.sap.cloud.mt.tools.impl.Retry.execute(Retry.java:37)","\tat com.sap.cloud.mt.tools.impl.ServiceCallImpl.execute(ServiceCallImpl.java:96)","\tat com.sap.cloud.mt.tools.impl.ServiceCallImpl.execute(ServiceCallImpl.java:74)","\tat com.sap.cds.mtx.impl.AbstractSidecarAccess.getCsn(AbstractSidecarAccess.java:107)","\tat com.sap.cds.mtx.impl.MetaDataAccessorImpl$CdsCache.access(MetaDataAccessorImpl.java:322)","\tat com.sap.cds.mtx.impl.MetaDataAccessorImpl$Cache.load(MetaDataAccessorImpl.java:239)","\tat com.sap.cds.mtx.impl.MetaDataAccessorImpl$Cache.access$400(MetaDataAccessorImpl.java:163)","\tat com.sap.cds.mtx.impl.MetaDataAccessorImpl$Cache$1.load(MetaDataAccessorImpl.java:183)","\tat com.sap.cds.mtx.impl.MetaDataAccessorImpl$Cache$1.load(MetaDataAccessorImpl.java:180)","\tat com.github.benmanes.caffeine.cache.LocalLoadingCache.lambda$newMappingFunction$2(LocalLoadingCache.java:145)","\tat com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2406)","\tat java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1859)","\tat com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2404)","\tat com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2387)","\tat com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:108)","\tat com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:56)","\tat com.sap.cds.mtx.impl.MetaDataAccessorImpl$Cache.getOrLoadIfStale(MetaDataAccessorImpl.java:217)","\t... 61 more"]}
in the mtx-sidecar
67d61b9etrial-ict-ict-mt-sidecar.cfapps.us10-001.hana.ondemand.com - [2023-09-18T16:28:56.145274409Z] "POST /-/cds/model-provider/getCsn HTTP/1.1" 404 58 167 "-" "Apache-HttpClient/4.5.14 (Java/1.8.0_381)" "10.0.136.1:32468" "10.32.1.6:61083" x_forwarded_for:"3.225.44.56, 10.0.136.1" x_forwarded_proto:"https" vcap_request_id:"421169ee-841e-4b8f-684b-d5ede30049ec" response_time:0.001587 gorouter_time:0.000109 app_id:"0476a16c-ec14-4d5f-bc8e-eca2cb3804b4" app_index:"0" instance_id:"81a8ac9b-6389-4269-626d-92be" failed_attempts:0 failed_attempts_time:"-" dns_time:0.000000 dial_time:0.000000 tls_time:0.000000 backend_time:0.001478 x_cf_routererror:"-" x_correlationid:"-" tenantid:"-" sap_passport:"-" x_scp_request_id:"cf464fcd-4c7f-406a-84f0-8b3e34fc09b6-65087AC7-8F3958" x_cf_app_instance:"-" x_forwarded_host:"-" x_custom_host:"-" x_ssl_client:"-" x_ssl_client_session_id:"-" x_ssl_client_verify:"-" x_ssl_client_subject_dn:"-" x_ssl_client_subject_cn:"-" x_ssl_client_issuer_dn:"-" x_ssl_client_notbefore:"-" x_ssl_client_notafter:"-" x_cf_forwarded_url:"-" traceparent:"-" x_b3_traceid:"421169ee841e4b8f684bd5ede30049ec" x_b3_spanid:"684bd5ede30049ec" x_b3_parentspanid:"-" b3:"421169ee841e4b8f684bd5ede30049ec-684bd5ede30049ec"
Can anyone please help me or otherwise I guess I have to stop my endeavour here
Request clarification before answering.
It looks like this error is caused by the fact that you somewhere still set the "cds.multitenancy.mtxs.enabled" / "CDS_MULTITENANCY_MTXS_ENABLED" property to "true". The "/-/cds/model-provider/getCsn" path that is used indicates that the CAP Java app tries to use the Streamlined MTX APIs and not the MTX Classic APIs
However please note that when using CAP Java 1.34.x (which I guess you do, based on the other discussions in the JCO area), you can still use Streamlined MTX. You only need to make sure that you are using @sap/cds-dk 6 and not 7 in your MTX Sidecar, as 7 is only compatible with CAP Java 2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello marcbecker , yes actually I copied the whole application.yml from my old CAP 2 project and replaced my cap 1.34 project's application.yml with it. there was a property called "mtxs.enabled: true" . I have removed it and uploaded the same and it worked!. I can't thank you enough for this. I can now work with JCO integration.
the other thing you mentioned that I can use Streamlined MTX with cap 1.34 also. So in that case what I have to do
1. copy the MTX module from the new CAP proejct
2. Replace the the MTX module of CAP 1.34 with the copied folder
3. then change this to "@sap/cds": "^7" to "@sap/cds": "^6" in the package.json of mtx
4. Copy over side-car configuration from CAP 2 mta.yml to CAP 1.34 mta.yml
5. add these values in saas-registry service's appurls property "onSubscriptionAsync: true", "onUnSubscriptionAsync: true", "onUpdateDependenciesAsync: true", "callbackTimeoutMillis: 3600000"
Please let me know if my understanding is correct or do I have to do more configuration changes.
One thing I noticed in CAP 1.34 project's mta.yml files present in GITHUB, that this oauth2-configuration is not mentioned in xsuaa service.
So for trial account router was unable to redirect after successful login .so I had to add that taking reference from CAP 2 project's mta.yml
Sound about right. You will also need to add back the configuration property mtxs.enabled and set it to true. Yeah the mtx-classic branch is not really maintained anymore, it might be a little bit outdated by now, which is why the redirect-uris configuration is missing. Good that you solved it though!
Hello marcbecker , I have one question
what are the main benefits of using stream lined mtx instead of classic mtx.if you can please shed some light on this matter that would be very helpful.
one more problem I am facing in classic mtx. I want to delete tenant specific HDI container on tenant un-subscription process. so I added this code from documentation.
from the log I can see this handler method is getting called. however the tenant Container is not deleted.
also this log is getting printed
{"msg":"Skipping subscription deletion of tenant '8347ef66-0b2d-4140-add6-070d45bda6f2'","level":"INFO","written_ts":"1695454011597000000","logger":"com.sap.cds.services.mt.impl.MtSubscriptionServiceCompatibilityHandler","correlation_id":"30539e53-3956-44c1-5924-2e51eaf8347e","written_at":"2023-09-23T07:26:51.597Z","thread":"http-nio-0.0.0.0-8080-exec-10","type":"log"}
Can you please help me to understand what could be the issue here
1. You seem to have placed the MTXS Sidecar into mtx-sidecar, not mtx/sidecar path. Due to this some default build steps might not behave correctly potentially causing the error "Could not get additional deployment resources". Please try to adapt the folder structure and try again
2. Classic MTX is in maintenance mode and is replaced by Streamlined MTX. New features and future optimizations are only developed as part of Streamlined MTX, therefore it is highly recommended to use the latter.
3. I'd recommend that you do not use the MtSubscriptionService API anymore. Rather disable the compatibility mode with the MtSubscriptionService API by setting "cds.multitenancy.compatibility.enabled: false" in your application.yaml. With that new mode subscriptions are deleted by default and you do not require any additional custom handler. For any custom handlers you need to use the DeploymentService events instead of the MtSubscriptionService events, more details here: https://pages.github.tools.sap/cap/docs/guides/deployment/as-saas#custom-logic
Hello marcbecker ,
Thank you for your inputs. I will definitely check the point 1.
Understood point number 2
DB deletion during tenant un subscription was already solved by making ""cds.multitenancy.compatibility.enabled: false" in application.yaml. sorry I have forgotten to delete the question. Thanks a lot for responding.
Hello marcbecker ,
I am not able to make it work. Getting the same error message. Please help.
*I would like to highlight one point . even though there is no folder with name- "mtx-sidecar" but when I run "mbt build" a folder is created with name "mtx-sidecar" with the following content "gen --> sdc --> _i18n, db, node_modules,srv"
* This is the starting commands of mta.yml
*This is now my sidecar configuration in mta.yaml
*After deployment while tenant subscription getting the error message
STDERR [mtx] - Error: Could not get additional deployment resources
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR at /home/vcap/app/node_modules/@sap/cds-mtxs/srv/model-provider.js:85:37
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR at async next (/home/vcap/app/node_modules/@sap/cds/lib/srv/srv-dispatch.js:76:17)
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR at async ModelProviderService.handle (/home/vcap/app/node_modules/@sap/cds/lib/srv/srv-dispatch.js:74:10)
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR at async resources4 (/home/vcap/app/node_modules/@sap/cds-mtxs/srv/plugins/hana.js:123:18)
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR at async /home/vcap/app/node_modules/@sap/cds-mtxs/srv/plugins/hana.js:234:7
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR at async Promise.all (index 1)
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR at async _deploy (/home/vcap/app/node_modules/@sap/cds-mtxs/srv/plugins/hana.js:222:18)
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR at async next (/home/vcap/app/node_modules/@sap/cds/lib/srv/srv-dispatch.js:76:17)
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR at async ApplicationService.handle (/home/vcap/app/node_modules/@sap/cds/lib/srv/srv-dispatch.js:74:10)
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR at async _nextTask (/home/vcap/app/node_modules/@sap/cds-mtxs/srv/jobs-service.js:131:12) {
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR code: 500,
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR numericSeverity: 4
2023-09-26T05:51:26.333+0000 [APP/PROC/WEB/0] STDERR }
Hello marcbecker,
Yes last week I have checked that. yes both are different
I tried to replace classic .cdsrc with stream lined .cdsrc
but got some error in during build itself. so I reverted to classic .cdsrc
So should I replace .cdsrc and try again and maybe let you know the error
this the .cdsrc for classic project
this is the .cdsrc for steam lined
This error occurs, when the @sap/cds-mtxs package is not installed into the root node_modules. This is (unfortunately) required by the cds build. There are various ways to solve this:
1. In our bookshop sample we explicitly install @sap/cds-mtxs along @sap/cds-dk: https://github.com/SAP-samples/cloud-cap-samples-java/blob/main/srv/pom.xml#L185-L193
2. You could also use npm workspace concept to make dependencies of mtx/sidecar available locally as well: https://cap.cloud.sap/docs/guides/multitenancy/old-mtx-migration#add-workspace-for-sidecar-in-root-p...
Hello marcbecker ,
is this documentation changed just like 2 hours back ?
Earlier when I checked like 3 hours ago something was written about "workspace" now not able to find it in the given page.
Hello marcbecker, Yes that was the problem. Thanks for correcting me . out of process 1 or process2 which is the preferred way?
Actually as I mentioned in my earlier questions, I am not using CDS. but have kept .cds files in srv and db folder otherwise getting some errors . So what I did was I removed the entire "<!-- STEPS TO BUILD CDS MODEL AND GENERATE POJOs -->" plugin .now I think I have to add again
but I do not have schema.sql or schema-nomocks.sql so will it work If I remove these two executions and keep the rest as it
Hi marcbecker,
I have created a Multi tenant SAAS application (Non-CAP NodeJS based) and have deployed this app to SAP BTP in the Provider subaccount. Along with the application I have the saas-registry instance and xsuaa instance created in my Provider subaccount. I am also able to subscribe to this application from the Consumer subaccount.
Current Status: So far, I have successfully implemented application subscription from tenant subaccounts using the saas-registry and an xsuaa instance. I’ve also implemented the necessary logic for subscribe and unsubscribe events in the backend.
Note: This is a pure backend application, and I am not using an Approuter, as there is no frontend component involved. The application is intended to be consumed by tenant-specific backend or frontend apps via API calls.
Problems:
Asking for Suggestions:
User | Count |
---|---|
30 | |
22 | |
16 | |
8 | |
7 | |
7 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.