Giter Site home page Giter Site logo

sap-samples / cloud-objectstore-java-sample Goto Github PK

View Code? Open in Web Editor NEW
15.0 7.0 15.0 395 KB

The Object Store reference application aims to provide a single-code line application, which can be run in SAP BTP, Cloud Foundry environment, consuming Object Store service with different IaaS providers underneath - e.g. AWS, GCS, Azure.

License: Apache License 2.0

Rich Text Format 1.20% Java 98.80%
sample java objectstore sample-code cloud-foundry sap-cloud-platform sap-btp sap-btp-cloud-foundry

cloud-objectstore-java-sample's Introduction

Object Store Reference Application

REUSE status

Object Store reference application is built to showcase the method of developing a single code-line multi cloud application consuming Object Store Service of SAP Business Technology Platform (SAP BTP) Cloud Foundry Environment.

Description

Object Store service enables the storage and management of objects, which involves creation, upload, download, and deletion of objects. SAP provides Object Store Service on its SAP Business Technology Platform running on different IaaS providers like Amazon Web Service, Azure, Google Cloud Platform. Please click here for more information on Object Store Service.

Though the Object Store Service is provided by SAP on multiple IaaS providers, the way to connect to and use the service varies for each IaaS provider due to changes in the structure of credentials and in the configurations. Writing a single code-line application that works seamlessly on all these IaaS providers is a challenge that many developers face.

We have developed a single code line reference application that can work with Object Store Service on SAP Business Technology Platform Cloud Foundry Environment hosted on multiple IaaS providers. This application performs operations like upload, download, delete and listing of files. It is a spring boot application that uses Apache jclouds library which provides a multi-cloud toolkit that gives a developer the freedom to create applications that are portable across IaaS providers.

Features of the Application

• The application provides RESTful endpoints to upload, download, delete and list files.

• It calls jclouds library's API endpoints to perform the above operations on the files in Object Store Service. JClouds abstracts the code to perform these operation on the different providers like AWS S3, Google Cloud Storage and Azure Storage.

Architecture

Alt text

A single REST controller accepts the request (GET, POST, DELETE).

Separate service implementations and configuration classes are provided for each of the Object Store Service provider. The right service implementation and configuration is loaded by spring boot based on the IaaS provider that the application is deployed on.

A single DAO (Data Access Object)/repository class calls the jclouds api’s to perform upload, download, delete operations on the Object Store.

Referenced Libraries

Following jclouds dependencies are used in the application.

    <!-- jclouds dependencies -->
    <dependency>
      <groupId>org.apache.jclouds.provider</groupId>
      <artifactId>aws-s3</artifactId>
      <version>2.3.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jclouds.provider</groupId>
      <artifactId>google-cloud-storage</artifactId>
      <version>2.3.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jclouds.provider</groupId>
      <artifactId>azureblob</artifactId>
      <version>2.3.0</version>
    </dependency>

The size of each of the jclouds dependencies are as follows:

    Dependency                Size
    -------------             -------
    aws-s3                    29kb
    google-cloud-storage      158kb
    azureblob                 138kb

Besides spring-boot and jclouds the other dependencies used in the application are:

• jackson-databind: to parse json file

• commons-fileupload: to upload files

For more information about the dependencies please refer pom.xml file.

Requirements

Download and Installation

Build the Application

  • Clone the application cloud-objectstore-java-sample to your system

    Clone URL : https://github.com/SAP-samples/cloud-objectstore-java-sample.git

  • Navigate to the root folder of the application and run the below maven command to build the application:

    mvn clean install
    

Deploy the Application on Cloud Foundry

  1. Logon to the Cloud Foundry environment using the following commands on the command prompt:

    cf api <api>
    cf login
    

    api - URL of the Cloud Foundry landscape that you are trying to connect to.

    Enter username, password, org and space when prompted to. Please click here for more information.

    Check if the Cloud Foundry Space you will be deploying the application has the following entitlements:

    Landscape Service Plan Number of Instances
    AWS objectstore s3-standard 1
    GCP objectstore gcs-standard 1
    Azure objectstore azure-standard 1
  2. Create the Cloud Foundry Object Store Service Instance

    • To run the application on AWS landscape, create a service by executing the below command:

      cf create-service objectstore s3-standard objectstore-service

    • To run the application on GCP landscape, create a service by executing the below command:

      cf create-service objectstore gcs-standard objectstore-service

    • To run the application on Azure landscape, create a service by executing the below command:

      cf create-service objectstore azure-standard objectstore-service

  3. Edit manifest.yml file. Replace the <unique_id> placeholder with any unique string. You can use your SAP User ID so that the application name is unique in the CF landscape. You can find your SAP User ID in your sap.com profile.

  ---
  applications:
  - name: <unique_id>-objectstore-sample-svc
    memory: 2G
    buildpack: sap_java_buildpack
    path: target/objectstore-sample-1.1.1.jar
    env:
      JBP_CONFIG_COMPONENTS: "jres: ['com.sap.xs.java.buildpack.jdk.SAPMachineJDK']"
      JBP_CONFIG_SAP_MACHINE_JRE: '{ jre: { version: "11.+" } }'
      SERVICE_LABEL: "objectstore"
    services:
      - objectstore-service
  1. To deploy the application, navigate to the root of the application and execute the below command:
    cf push
    

Test the Application

Postman Client can be used to test / access the REST API endpoints.

Replace the <application URL> placeholder in the below steps with the URL of the application you deployed.

Upload a file / object

POST

To upload a file / object set the below request body and hit the endpoint url.

EndPoint URL : <application URL>/objectstorage.svc/api/v1/storage/

Request Body : form-data with key-value pair. Pass the name of the key as file and the value is the path of the file.

For the file upload, we have provided a test file in the documents folder which you can use if needed for the upload testing.

Alt text

A successful upload operation gives the following response :

Status: 202

Response Body: <file-name> is successfully uploaded.

List all the files / objects

GET

To get the list of a files / objects set the content-type and hit the below endpoint url.

EndPoint URL : https://<application URL>/objectstorage.svc/api/v1/storage/

Content-Type : application/json

A successful GET operation gives the following response :

Status: 200

Response Body:

[
    {
        "etag": "CIjak4uDxeACEAE=",
        "bucket": "sap-cp-osaas-a78345d3-e45d-42eb-9c03-c47393d0d436",
        "name": "SampleFile.pdf",
        "url": "https://www.googleapis.com/storage/v1/b/sap-cp-osaas-a78345d3-e45d-42eb-9c03-c47393d0d436/o/SampleFile.pdf",
        "lastModified": "Mon Feb 18 15:30:22 IST 2019",
        "size": "245.7 KB",
        "contentType": "application/pdf",
        "userMetadata": {
            "description": "sample content"
        }
    },
    {
        "etag": "COf+0p7uxOACEAE=",
        "bucket": "sap-cp-osaas-a78345d3-e45d-42eb-9c03-c47393d0d436",
        "name": "SampleImage.jpg",
        "url": "https://www.googleapis.com/storage/v1/b/sap-cp-osaas-a78345d3-e45d-42eb-9c03-c47393d0d436/o/SampleImage.jpg",
        "lastModified": "Mon Feb 18 13:57:06 IST 2019",
        "size": "46.1 KB",
        "contentType": "image/jpeg",
        "userMetadata": {
            "description": "sample content"
        }
    }
  ...

]
Download a file / object

GET

Please open any browser and hit the below endpoint url to download a file / object rather than using Postman to test it.

EndPoint URL : https://<application URL>/objectstorage.svc/api/v1/storage/{file-name}

Delete a file / object

DELETE

To delete a file / object hit the below endpoint url by appending the file / object name in postman.

EndPoint URL : https://<application URL>/objectstorage.svc/api/v1/storage/{file-name}

A successful upload operation gives the following response :

Status: 200

Response Body: <file-name> is successfully deleted.

How to obtain support

In case you find a bug, or you need additional support, please open an issue here in GitHub.

Known Issues

  • Using InpuStream instead of ByteArray to upload large files to make the read operation faster causes issues. For more information see here.

License

Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSEfile.

cloud-objectstore-java-sample's People

Contributors

balajimurugesan2016 avatar biswaranjanray avatar btbernard avatar dependabot[bot] avatar jonathanbaker7 avatar singhabhi1999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-objectstore-java-sample's Issues

500 Internal Server Error: injection from VCAP_SERVICES not working

Hi, I keep getting the same 500 error when I send a request to the service.

This is the response I get

  "timestamp": "2021-12-14T14:38:37.085+0000",
  "status": 500,
  "error": "Internal Server Error",
  "message": "identity",
  "path": "/objectstorage.svc/api/v1/storage"
}

On the logs I can see that some value that should be mapped from the VCAP_SERVICES is giving a NullPointerException.

   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT 2021-12-14 14:38:37.076 ERROR 8 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException: identity] with root cause
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT java.lang.NullPointerException: identity
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:897) ~[guava-27.1-jre.jar:na]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at org.jclouds.ContextBuilder.credentials(ContextBuilder.java:259) ~[jclouds-core-2.3.0.jar:2.3.0]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at com.sap.refapps.objectstore.config.AmazonWebServiceConfiguration.getBlobStoreContext(AmazonWebServiceConfiguration.java:49) ~[classes/:na]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at com.sap.refapps.objectstore.service.AWSObjectStoreService.listObjects(AWSObjectStoreService.java:43) ~[classes/:na]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at com.sap.refapps.objectstore.controller.ObjectstoreController.listFiles(ObjectstoreController.java:54) ~[classes/:na]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_312]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_312]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_312]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_312]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:888) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
   2021-12-14T14:38:37.07+0000 [APP/PROC/WEB/0] OUT     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
[...]

I did change the name of the objectstore service that the app uses on manifest.yml and on AmazonWebServiceConfiguration.java, but it still gives the same error

manifest.yml

---
applications:
- name: test-objectstore-svc
  host: test-objectstore-svc
  memory: 1G
  buildpack: https://github.com/cloudfoundry/java-buildpack.git
  path: target/objectstore-sample-1.0.0.jar
  services:
    - test-objectstore

AmazonWebServiceConfiguration.java

/**
 * This is AWS Credentials Configuration class
 *
 */

@Profile("cloud-aws")
@Configuration
@ConfigurationProperties(prefix = "vcap.services.test-objectstore.credentials")
public class AmazonWebServiceConfiguration {
	...

I also checked and the objectstore instance exists and is binded to the app

image

I don't see why it is not working? Did I miss something?

404 Not Found error for POST request

HI developers. I must be doing something wrong, and I hope you can tell me what.
Here is my modified manifest.yaml:

---
applications:
- name: objectstore-sample-svc
  host: i826690-objectstore-sample-svc
  memory: 2G
  buildpack: https://github.com/cloudfoundry/java-buildpack.git
  path: target/objectstore-sample-1.0.0.jar
  services:
    - objectstore-service

Here is my application after deployment (cf a)

name                     requested state   processes           routes
objectstore-sample-svc   started           web:1/1, task:0/0   objectstore-sample-svc.cfapps.us21.hana.ondemand.com

And the route definition (cf routes):

space    host                     domain                          port   path   protocol   apps
Helium   objectstore-sample-svc   cfapps.us21.hana.ondemand.com                 http       objectstore-sample-svc

Using Postman, I try to POST to this URL:

https://i826690-objectstore-sample-svc.cfapps.us21.hana.ondemand.com/objectstorage.svc/api/v1/storage/

But the response is "404 Not Found: Requested route ('i826690-objectstore-sample-svc.cfapps.us21.hana.ondemand.com') does not exist."

Any ideas please?

Is there any admin page to manage blob storage?

Dear expert.

Thanks for sharing this excellent sample.
Regarding to using object store in scp, I have few questions as below.
1. Will one object store service instance have one corresponded container(blob storage) ?
If yes, what if I delete the service instance, will all blobs be deleted also?
2. Is there any admin page to manage blob storage? not using codes to do it.

Thanks a lot.

upload is failing - 500 internal server error

Screen Shot 2020-06-26 at 3 59 21 PM

I'm getting 500 internal server error. Here is the log
cf log app_name

Any help where I'm doing wrong.

C02Z2D46LVCG:cloud-objectstore-java-sample i302342$ cf logs objectstore-sample-svc
Retrieving logs for app objectstore-sample-svc in org in-demos-org / space demos as [email protected]...

2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT 2020-06-26 10:24:14.996 ERROR 6 --- [nio-8080-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException: identity] with root cause
2020-06-26T15:54:14.99+0530 [RTR/4] OUT i302342-objectstore-sample-svc.cfapps.eu10.hana.ondemand.com - [2020-06-26T10:24:13.463510818Z] "POST /objectstorage.svc/api/v1/storage/ HTTP/1.1" 500 155045 154 "-" "PostmanRuntime/7.25.0" "-" "10.0.138.188:61037" x_forwarded_for:"-" x_forwarded_proto:"https" vcap_request_id:"0c1375a1-a8e0-41b0-450b-1f12f0785211" response_time:1.536086 gorouter_time:0.000189 app_id:"b6990b82-d375-40c7-ace1-a5840d74309c" app_index:"0" x_correlationid:"-" tenantid:"-" x_scp_request_id:"cf67bb70-e4e4-427d-abc2-cc0a032daec4-5EF5CCCC-B36EF5" x_cf_app_instance:"-" x_b3_traceid:"3a7889186484db24" x_b3_spanid:"3a7889186484db24" x_b3_parentspanid:"-" b3:"3a7889186484db24-3a7889186484db24"
2020-06-26T15:54:14.99+0530 [RTR/4] OUT
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT java.lang.NullPointerException: identity
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:895) ~[guava-27.0.1-jre.jar:na]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.jclouds.ContextBuilder.credentials(ContextBuilder.java:259) ~[jclouds-core-2.2.0.jar:2.2.0]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at com.sap.refapps.objectstore.config.AmazonWebServiceConfiguration.getBlobStoreContext(AmazonWebServiceConfiguration.java:53) ~[classes/:na]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at com.sap.refapps.objectstore.service.AWSObjectStoreService.uploadFile(AWSObjectStoreService.java:35) ~[classes/:na]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at com.sap.refapps.objectstore.controller.ObjectstoreController.uploadFile(ObjectstoreController.java:84) ~[classes/:na]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_252]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_252]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_252]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_252]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:888) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.cloudfoundry.router.ClientCertificateMapper.doFilter(ClientCertificateMapper.java:79) ~[client_certificate_mapper-1.11.0_RELEASE.jar:na]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:747) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_252]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_252]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.30.jar:9.0.30]
2020-06-26T15:54:14.99+0530 [APP/PROC/WEB/0] OUT at java.lang.Thread.run(Thread.java:748) [na:1.8.0_252]

When is the plan to support for azure blob storage via jcloud?

Hi All

We wanted to use object-store for persisting .tar/.mtar content. For now, our services are available on aws and azure landscape. We wanted to avoid writing native queries for each of the IaaS providers and hence wanted to use jcloud for doing the same.

Since, jcloud already support sas-token way of authentication in azure blob-storage. So we wanted to do POC via jcloud on azure blob-storage as well as aws s3. But we are not sure, if jcloud would work for azure. If you guys can confirm, we will use jcloud for both.

We followed this document, but we could not get support of jcloud for azure.
https://developers.sap.com/tutorials/cp-objectstore-mc-java-app.html

Thanks
Swati

Streaming support for upload/download content from/to object store

Dear colleagues,

One of the known issues mentioned in this github page is that 'there are connection issues with using input streams instead of byte array'. Since the issue still remains unsolved, is it recommended to only transact with the objectstore as byte array (and not use streaming at all)? Or is it ok to use input/output streams? For files larger in size, I guess, streaming would result in a sizable performance gain. Can you please advice us on this?

To be more specific, BlobBuilder has an overloaded payload method - taking either InputStream or byte[] as an argument. Can we use the InputStream one without any side effects?

For downloading content, since the example provided uses InputStream, I guess there are no problems with it, right?

Regards,
Raghu

Using JClouds with Spring 2.7.* throws an exception

The following exception is thrown when trying to create a context

Caused by: NoSuchMethodError: 'void ConstructorConstructor.<init>(Map)' at GsonModule.provideGson(GsonModule.java:130) at GsonModule$$FastClassByGuice$$1633583.GUICE$TRAMPOLINE(<generated>) at GsonModule$$FastClassByGuice$$1633583.apply(<generated>) .....

this happens because spring updated the API to use gson 2.9.1 and Jclouds isn't compatible with it yet
here is a some details regarding that issue https://issues.apache.org/jira/browse/JCLOUDS-1620

any idea how to fix the issue ?

Unable to Create File

Hi,

Was able to push the app to a space in CF successfully but while testing the url in POST mode to place a file - I am getting a response as [] with the Status 200.

objectstore

Any comments or suggestions are welcome!

Thanks!

return HTTP Status 400 – Bad Request for any request

HI Team,

I am working on a tutorial on using Object Store, but any type of request to the deployed application returns HTTP Status 400 - Bad Request.
Here is my modified manifest.yaml:

---
applications:
- name: objectstore-sample-svc_4585
  random-route: true
  memory: 2G
  buildpack: https://github.com/cloudfoundry/java-buildpack.git
  path: target/objectstore-sample-1.0.0.jar
  services:
    - objectstore-service

Here is my application after deployment (cf a)

name:              objectstore-sample-svc_4585
requested state:   started
routes:           *******.com
last uploaded:     Tue 16 Nov 16:04:23 JST 2021
stack:             cflinuxfs3
buildpacks:        
        name                                                 version                                                              detect output   buildpack name
        https://github.com/cloudfoundry/java-buildpack.git   11e457b-https://github.com/cloudfoundry/java-buildpack.git#11e457b   java            java

type:           web
sidecars:       
instances:      1/1
memory usage:   2048M
     state     since                  cpu    memory         disk           details
#0   running   2021-11-16T07:04:49Z   0.6%   284.8M of 2G   148.3M of 1G

Using Postman, I try to POST to this URL:

https://objectstore-sample-svc_4585-grateful-dog-on.cfapps.eu10.hana.ondemand.com/objectstorage.svc/api/v1/storage/
But the response is "HTTP Status 400 – Bad Request"

cf logs when post a file:
2021-11-16T16:33:25.41+0900 [RTR/37] OUT *******.com - [2021-11-16T07:33:25.234238693Z] "POST /objectstorage.svc/api/v1/storage/ HTTP/1.1" 400 23772 435 "-" "PostmanRuntime/7.28.4" "-" "10.0.202.4:61025" x_forwarded_for:"-" x_forwarded_proto:"https" vcap_request_id:"3bb39507-5746-4175-72cb-4700949fd2a7" response_time:0.173022 gorouter_time:0.082832 app_id:"6aeecd61-714a-4a95-8699-a9dc27e7fd7e" app_index:"0" instance_id:"5254fd73-c646-4c0d-6f5b-8593" x_cf_routererror:"-" x_correlationid:"-" tenantid:"-" sap_passport:"-" x_scp_request_id:"264eea94-08f1-4542-9f3e-f675a6435370-61935E90-E77C24" 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_b3_traceid:"424919723e7170b8" x_b3_spanid:"424919723e7170b8" x_b3_parentspanid:"-" b3:"424919723e7170b8-424919723e7170b8"

Could you please tell me the cause?

Thanks.

Unable to upload file in GCP landscape

jcloud google-cloud-storage version: 2.2.1
Hi Team
We are going live on GCP, But we got into following issue while uploading to object-store. Can anyone help us?

This is the error we are getting when we are trying to upload to gcp:
org.jclouds.http.HttpResponseException: Error parsing input: while trying to invoke the method org.jclouds.json.gson.internal.JsonReaderInternalAccess.promoteNameToValue(com.google.gson.stream.JsonReader) of a null object loaded from static field org.jclouds.json.gson.internal.JsonReaderInternalAccess.INSTANCE\n{statusCode=200, message=OK, headers={Server=[UploadServer], X-GUploader-UploadID=[ADPycds3vHs9Ra-oE-ERMmpOy-Kq2khl1a4CaXqrE9L87owcxvHiJF3m1cGgY4Ax_8SRRRSJD8_yV9XhQ9m958z4RRrSuUNJ5g], Vary=[X-Origin, Origin], Date=[Wed, 01 Dec 2021 10:30:39 GMT]}, payload=[content=true, contentMetadata=[cacheControl=private, max-age=0, must-revalidate, no-transform, contentDisposition=null, contentEncoding=null, contentLanguage=null, contentLength=1591, contentMD5=null, contentType=application/json; charset=UTF-8, expires=Wed Dec 01 10:30:39 UTC 2021], written=false, isSensitive=false]}",
"\tat org.jclouds.http.functions.ParseJson.apply(ParseJson.java:67)",
"\tat org.jclouds.http.functions.ParseJson.apply(ParseJson.java:41)",
"\tat org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)",
"\tat org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)",
"\tat org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)",
"\tat org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117)",
"\tat com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87)",
"\tat com.sun.proxy.$Proxy174.listObjects(Unknown Source)",
"\tat org.jclouds.googlecloudstorage.blobstore.GoogleCloudStorageBlobStore.list(GoogleCloudStorageBlobStore.java:189)",
"\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 com.google.inject.internal.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:37)",
"\tat com.sun.proxy.$Proxy103.list(Unknown Source)",
"\tat com.sap.bpm.pfs.objectstore.repository.ObjectStoreRepository.listFiles(ObjectStoreRepository.java:112)",
"\tat com.sap.bpm.pfs.objectstore.service.GCPObjectStoreService.listObjects(GCPObjectStoreService.java:62)",
"\tat com.sap.bpm.pfs.objectstore.service.GCPObjectStoreService.uploadFile(GCPObjectStoreService.java:50)",
"\tat com.sap.bpm.pfs.core.api.impl.DTPackageServiceImpl.persistFile(DTPackageServiceImpl.java:468)",

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.