我将我的程序用maven自带的package功能打包之后传给其他人并写了dockerfile如下
FROM java:8
COPY *.jar /VEEProject-0.0.1-SNAPSHOT.jar
CMD ["--server.port=8099"]
EXPOSE 8099
ENTRYPOINT ["java","-jar","/VEEProject-0.0.1-SNAPSHOT.jar"]
文件在我这运行没有问题,当他那边运行时出现如下错误
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport$AutoConfiguredAnnotationRepositoryConfigurationSource.(AbstractRepositoryConfigurationSourceSupport.java:133)
The following method did not exist:
org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource.(Lorg/springframework/core/type/AnnotationMetadata;Ljava/lang/Class;Lorg/springframework/core/io/ResourceLoader;Lorg/springframework/core/env/Environment;Lorg/springframework/beans/factory/support/BeanDefinitionRegistry;Lorg/springframework/beans/factory/support/BeanNameGenerator;)V
The calling method's class, org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport$AutoConfiguredAnnotationRepositoryConfigurationSource, was loaded from the following location:
jar:file:/Users/matthewwilliams/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.8/spring-boot-autoconfigure-2.7.8.jar!/org/springframework/boot/autoconfigure/data/AbstractRepositoryConfigurationSourceSupport$AutoConfiguredAnnotationRepositoryConfigurationSource.class
The called method's class, org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource, is available from the following locations:
jar:file:/Users/matthewwilliams/.m2/repository/org/springframework/data/spring-data-commons/2.1.2.RELEASE/spring-data-commons-2.1.2.RELEASE.jar!/org/springframework/data/repository/config/AnnotationRepositoryConfigurationSource.class
The called method's class hierarchy was loaded from the following locations:
org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource: file:/Users/matthewwilliams/.m2/repository/org/springframework/data/spring-data-commons/2.1.2.RELEASE/spring-data-commons-2.1.2.RELEASE.jar
org.springframework.data.repository.config.RepositoryConfigurationSourceSupport: file:/Users/matthewwilliams/.m2/repository/org/springframework/data/spring-data-commons/2.1.2.RELEASE/spring-data-commons-2.1.2.RELEASE.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport$AutoConfiguredAnnotationRepositoryConfigurationSource and org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource
请问这样的错误在哪边修改会方便一点,或者我这边不打包,把代码给他,并写一个dockerfile给他,在他那边build能否解决?
FROM java:8 这玩意儿不是没用了吗,换成openjdk 了
他本地用java命令能执行你的jar包么
这个错误是因为程序在运行时找不到正确版本的类,需要调整classpath以包含正确版本的类。
可以尝试检查你的程序的依赖关系,并确保它们与Spring Boot版本兼容。
也可以在Dockerfile中指定更具体的基本镜像,例如:
FROM openjdk:8-jdk-alpine
不知道你这个问题是否已经解决, 如果还没有解决的话: