我正在开发一个spring boot应用程序,它使用spring aws集成定期轮询S3存储桶,并处理来自S3的轮询对象。在尝试从另一个S3存储桶中读取已处理的对象时,我遇到了异常
java.lang.NoSuchMethodError: com.amazonaws.services.s3.model.S3ObjectInputStream.readAllBytes()[B
at com.app.controller.AppController.viewImage(AppController.java:79) ~[classes!/:0.0.1-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) ~[spring-web-5.0.3.RELEASE.jar!/:5.0.3.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-5.0.3.RELEASE.jar!/:5.0.3.RELEASE]只有当我部署为ec2应用程序时,它才会在java实例中发生,但在本地不会发生。考虑到这可能是因为amazon-linux ami中的jars类加载冲突,我尝试在ubuntu实例中部署,但错误重复出现。
只是我的pom.xml中相关的一小段
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk -1</artifactId>
<version>1.11.133</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.integration/spring-integration-aws -->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-aws</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>有人能帮我解决这个问题吗?另外,请告诉我除了所提到的以外,是否还需要任何其他细节。
发布于 2019-01-08 01:43:49
realAllBytes是父类InputStream的方法。这个方法是从Java9开始添加到InputStream中的。
https://stackoverflow.com/questions/54079180
复制相似问题