s3proxy
s3proxy copied to clipboard
SpringBoot 3 integration for S3 Mocking
Hi,
I'm trying to integrate s3Proxy 2.0.0 in a SpringBoot 3 project:
BlobStoreContext context =
ContextBuilder.newBuilder("transient")
.modules(ImmutableList.of(new SLF4JLoggingModule()))
.build(BlobStoreContext.class);
It triggers the following issue:
Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:
1) [Guice/ErrorInCustomProvider]: NoSuchMethodError: 'void ConstructorConstructor.<init>(Map)'
at GsonModule.provideGson(GsonModule.java:99)
\_ installed by: RestModule -> GsonModule
at GsonWrapper.<init>(GsonWrapper.java:38)
\_ for 1st parameter
at GsonWrapper.class(GsonWrapper.java:32)
while locating GsonWrapper
at UtilsImpl.<init>(UtilsImpl.java:52)
\_ for 2nd parameter
at UtilsImpl.class(UtilsImpl.java:52)
while locating UtilsImpl
at ContextImpl.<init>(ContextImpl.java:58)
\_ for 4th parameter
at ContextImpl.class(ContextImpl.java:58)
while locating ContextImpl
while locating Context
at BindProviderMetadataContextAndCredentials.backend(BindProviderMetadataContextAndCredentials.java:84)
at BlobStoreContextImpl.<init>(BlobStoreContextImpl.java:46)
\_ for 1st parameter
at BlobStoreContextImpl.class(BlobStoreContextImpl.java:46)
while locating BlobStoreContextImpl
at LocalBlobStore.<init>(LocalBlobStore.java:127)
\_ for 1st parameter
at LocalBlobStore.class(LocalBlobStore.java:109)
while locating LocalBlobStore
while locating BlobStore
Seems like the new version of com.google.code.gson do not handle a Map constructor anymore. So i tried replace it by an old version:
<dependency>
<groupId>org.gaul</groupId>
<artifactId>s3proxy</artifactId>
<version>2.0.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<scope>test</scope>
</dependency>
it seems to work better, but then i have a new issue when trying to build the S3Proxy :
Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletResponse
at org.gaul.s3proxy.S3Proxy.<init>(S3Proxy.java:80)
at org.gaul.s3proxy.S3Proxy$Builder.build(S3Proxy.java:148)
As the SpringBoot3 is not supporting anymore the 'javax' dependencies
Any idea how to fix this please ?
Can you try 2.1.0-SNAPSHOT?
this works :
<dependency>
<groupId>org.gaul</groupId>
<artifactId>s3proxy</artifactId>
<version>2.1.0-SNAPSHOT</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<scope>test</scope>
</dependency>
Without excluding 'com.google.code.gson' , i still get:
[Guice/ErrorInCustomProvider]: NoSuchMethodError: 'void ConstructorConstructor.<init>(Map)'
Thanks
For me, even with 2.1.0 and the gson workaround above, it still doesn't work. The error is:
java.lang.NoSuchMethodError: 'com.google.inject.Key com.google.inject.Key.withAnnotation(java.lang.annotation.Annotation)'
It seems, like com.google.inject:guice is missing. But when I add that (version 7.0.0), I get tons of errors like:
IllegalArgumentException: AsyncBus is not a binding annotation. Please annotate it with @BindingAnnotation.
or
IllegalArgumentException: location.Provider is not a binding annotation. Please annotate it with @BindingAnnotation.
Makes any version above 1.9.0 unusable for me. And even 1.9.0 only works with the gson workaround shown in the comment above me.
Try 2.2.0 to address the gson issue.