OPGG-HACKTHON / gameflix

Game showcase for gamers
https://opgg-hackthon.github.io/gameflix/
3 stars 1 forks source link

ARM cpu 에서 package 실행이 실패하는 현상 #33

Closed raeperd closed 3 years ago

raeperd commented 3 years ago

현상

gradle jib 과정에서 amd architecture 의 이미지만 빌드하기 때문에 다른 architecture 환경에서는 실행이 실패하는 것을 확인

❯ docker run --rm -p 8080:8080 ghcr.io/opgg-hackthon/gameflix:main
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.5.2)

... 

2021-08-29 04:13:59.952  WARN 1 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gameRestController' defined in file [/app/classes/gg/op/gameflix/application/web/GameRestController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'igdbGameRepository' defined in class path resource [gg/op/gameflix/infrastructure/igdb/IGDBConfiguration.class]: Unsatisfied dependency expressed through method 'igdbGameRepository' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'igdbClient' defined in class path resource [gg/op/gameflix/infrastructure/igdb/IGDBConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [gg.op.gameflix.infrastructure.igdb.IGDBWebClient]: Factory method 'igdbClient' threw exception; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.ClassFormatError-->Illegal class name "java/lang/Class[]" in class file gg/op/gameflix/infrastructure/igdb/IGDBConfiguration$$FastClassBySpringCGLIB$$f8cb726b
2021-08-29 04:13:59.954  INFO 1 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-08-29 04:13:59.955  INFO 1 --- [           main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
2021-08-29 04:14:00.009  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2021-08-29 04:14:00.051  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2021-08-29 04:14:00.075  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2021-08-29 04:14:00.188  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-08-29 04:14:00.362 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gameRestController' defined in file [/app/classes/gg/op/gameflix/application/web/GameRestController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'igdbGameRepository' defined in class path resource 

docker image 가 아니라, 로컬에서 직접 빌드해서보면 해당 의존성에는 문제가 없고 잘 실행되는 것을 확인할 수 있다. class path 가 architecture 마다 다를 수 있는가? container registry 에서 해당 architecture 를 지원하면 문제 없는 것은 확인할 수 있었음

해결방안

build.gradle.kts 내부에서 gradle jib 설정 변경

raeperd commented 3 years ago

참고 ! jib/faq.md at master · GoogleContainerTools/jib