I am trying to upload files to oracle Object Storage using Spring Boot 3.0 and Java 17. I am getting the following exception

java.util.NoSuchElementException: No http provider available; add dependency on one of the oci-java-sdk-common-httpclient-* choices, e.g. oci-java-sdk-common-httpclient-jersey

The dependency I used:

   <dependencies>
      <dependency>
         <groupId>com.oracle.oci.sd`your text`k</groupId>
         <artifactId>oci-java-sdk-objectstorage</artifactId>
      </dependency>
   </dependencies>`
<dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.oracle.oci.sdk</groupId>
        <artifactId>oci-java-sdk-bom</artifactId>
        <version>3.1.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

I was able to upload files to Object storage with Spring Boot 2.x.x and Java 11 with the above dependency.

2

There are 2 answers

1
Rashid On BEST ANSWER

Thank you @devwebcl. oci-java-sdk-common-httpclient-jersey was required but it wasn't sufficient. I had to add following dependency additionally.

    <dependency>
        <groupId>com.oracle.oci.sdk</groupId>
        <artifactId>oci-java-sdk-addons-resteasy-client-configurator</artifactId>
    </dependency>

So if someone want to upload files to object storage from Spring Boot 3, include the three dependencies below.

<dependencies>

    <dependency>
        <groupId>com.oracle.oci.sdk</groupId>
        <artifactId>oci-java-sdk-addons-resteasy-client-configurator</artifactId>
    </dependency>

    <dependency>
        <groupId>com.oracle.oci.sdk</groupId>
        <artifactId>oci-java-sdk-objectstorage</artifactId>
    </dependency>

    <dependency>
        <groupId>com.oracle.oci.sdk</groupId>
        <artifactId>oci-java-sdk-common-httpclient-jersey</artifactId>
    </dependency>

</dependencies>

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.oracle.oci.sdk</groupId>
      <artifactId>oci-java-sdk-bom</artifactId>
      <version>3.1.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
    <dependency>
      <groupId>com.oracle.oci.sdk</groupId>
      <artifactId>oci-java-sdk-common-httpclient-jersey</artifactId>
      <version>3.1.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

    
0
devwebcl On

Just add the dependency suggested in the exception's message:

<dependency>
    <groupId>com.oracle.oci.sdk</groupId>
    <artifactId>oci-java-sdk-common-httpclient-jersey</artifactId>
    <version>3.2.0</version>
</dependency>

to your pom.xml file