on 09-23-2020 4:00 PM
Greetings,
We have been tasked in creating a sap based cloud foundry application that requires multi tenancy. Due to the upcoming deprecation of the NEO environment, we have been tasked with the migration to cloud foundry. One of the major things that we use is multi-tenancy.
To reduce complexity we decided to just start a new cloud foundry maven project and get a hello world application working first.
Questions posted at the end.
Problem description:
When trying to subscribe to the saas registry defined, the following error is given.
Through debug it was confirmed that the endpoint defined in saas-config.json is being called when you press subscribe. However, the onSubscription is never being called. The put request never even reaches the application. this was confirmed by implementing a requestInitialized listener and set it up in the web.xml. this is being called before any of the servlets. meaning that if there was something wrong with the servlet itself it would at least be captured.
Sources used:
Developing Multitenant Applications in the Cloud Foundry Environment
Tutorial: Multitenancy for JCo Applications (Advanced)
Background information:
This java project is based on the following maven project:
For the majority of this the JCO guide is used.
For the approuter the following manifest and xs-secururty,json is used.
Approuter manifest
---
applications:
- name: test-cf-router
host: test-cf-router
routes:
- route: test-cf-router.cfapps.us10.hana.ondemand.com
path: approuter
buildpack: nodejs_buildpack
memory: 128M
env:
SAP_JWT_TRUST_ACL: '[{"clientid":"*","identityzone":"*"}]'
TENANT_HOST_PATTERN: "^(.*)-test-cf-router.cfapps.us10.hana.ondemand.com"
destinations: >
[
{
"name":"test-cf-approuter-destination",
"url":"https://test-cf-application.cfapps.us10.hana.ondemand.com",
"forwardAuthToken": true
}
]
services:
- test-cf-xsuaa
- test-cf-logging
XS-security.json
{
"xsappname" : "test-cf-approuter",
"tenant-mode": "shared",
"scopes": [{
"name": "$XSAPPNAME.Callback",
"description": "With this scope set, the callbacks for tenant onboarding, offboarding and getDependencies can be called.",
"grant-as-authority-to-apps": [
"$XSAPPNAME(application,sap-provisioning,tenant-onboarding)"
]
}]
}
SAAS-config.json
{
"appId": "test-cf-approuter!t13649",
"displayName": "test",
"description": "Cloud Translator",
"tenant-mode": "shared",
"appUrls": {
"onSubscription": "https://test-cf-application.cfapps.us10.hana.ondemand.com/callback/v1.0/tenants/{tenantId}",
"getDependencies": "https://test-cf-application.cfapps.us10.hana.ondemand.com/callback/v1.0/dependencies"
}
}
Multi-tenant Java web application manifest
---
applications:
- name: test-cf-application
host: test-cf-application
routes:
- route: test-cf-application.cfapps.us10.hana.ondemand.com
path: target/test-application.war
memory: 1024M
buildpack: sap_java_buildpack
services:
- test-cf-xsuaa
- test-cf-saas
- test-cf-logging
- test-cf-destination
- test-cf-connectivity
env:
JAVA_OPTS: '-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n'
SET_LOGGING_LEVEL: '{ROOT: INFO, com.sap.cloud.sdk: DEBUG, org.apache.http: DEBUG, org.apache.http.wire: DEBUG, ctx.cf.test
: DEBUG, com.sap.core.connectivity.jco: DEBUG, com.sap.conn.jco: DEBUG, com.sap.xs.security: DEBUG, com.sap.cloud.security: DEBUG, com.sap.xs.env: DEBUG}'
SAP_JWT_TRUST_ACL: '[{"clientid":"*","identityzone":"*"}]'
USE_JCO: true
xsuaa_connectivity_instance_name: "test-cf-xsuaa"
connectivity_instance_name: "test-cf-connectivity"
destination_instance_name: "test-cf-destination"
For the java servlets used and classes are all taken from the jco exemple.
Questions:
Greetings Anil,
yes i was able to resolve it.
in my case it turned out that the back-end should not be subscribed to the router.
in the SAAS config above it was pointing to test-cf-approuter!t13649, instead this should have been pointed to test-cf-application.
At the time i thought, being new at it i though approuter would take care of the routing for both back-end and front end application.
this is what my saas ended up with, instead of appid i went with xsappname.
{
"xsappname": "test-cf-application",
"displayName": "",
"description": "",
"appUrls": {
"onSubscription": "https://test-cf-application.cfapps.us10.hana.ondemand.com/rest/callback/v1.0/tenants/{tenantId}",
"getDependencies": "https://test-cf-application.cfapps.us10.hana.ondemand.com/rest/callback/v1.0/dependencies"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you. Appreciate your quick Response.
I was able to resolve it. In my case I was not returning app id as part of dependencies callback endpoint .
i'm able to subscribe now.
However , facing another problem.I defined a destination in provider and customer subacounts with the same name.
when I all custom destination endpoint using DestinationAccessor.getDestination (with options as subscriber first) i get the destination from provider subaccount.
User | Count |
---|---|
82 | |
11 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.