๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ๋ฐœ์ƒํ™œ/์ด์Šˆ ๋ฐœ์ƒ

google cloudresourcemanager, guava ๋ฒ„์ „ ์ถฉ๋Œ ์ด์Šˆ ์ฒ˜๋ฆฌ - NoSuchMethodError directExecutor

by cocococo331 2023. 4. 27.

๋„๋ฉ”์ธ ์„ฑ๊ฒฉ์— ๋งž์ง€ ์•Š๋Š” ์ฝ”๋“œ๋ฅผ ๋‹ค๋ฅธ๋ฐ๋กœ ์˜ฎ๊ธฐ๋Š” ์ž‘์—…์„ ์ง„ํ–‰ํ–ˆ๋‹ค.

๊ตฌ๊ธ€ ํ”„๋กœ์ ํŠธ๋“ค์„ ๊ฐ€์ ธ์™€์„œ ์ธ์ฆ์„ ๋ฐ›์•„ credential์„ ์ƒ์„ฑ ํ›„ api๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๋ฐฉ์‹์ธ๋ฐ 

ํ”„๋กœ์ ํŠธ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๋Š”๋ฐ ํ•ด๋‹น dependency๋ฅผ ์‚ฌ์šฉํ–ˆ๊ณ 

<dependency>
	<groupId>com.google.apis</groupId>
	<artifactId>google-api-services-cloudresourcemanager</artifactId>
	<version>v1-rev497-1.23.0</version>
</dependency>

 

์ธ์ฆ์„ ๋ฐ›๊ธฐ์œ„ํ•ด oauth2 dependency๋ฅผ ์‚ฌ์šฉํ–ˆ๋‹ค.

<dependency>
	<groupId>com.google.auth</groupId>
	<artifactId>google-auth-library-oauth2-http</artifactId>
	<version>1.7.0</version>
</dependency>


๊ธฐ์กด์—๋Š” ์‚ฌ์‹ค ๋‹ค๋ฅธ ๋ฆฌ์†Œ์Šค dependeny์— ๋‚ด์žฅ๋˜์–ด์žˆ๋˜ oauth2๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์—ˆ๊ณ  ๋ฒ„์ „์„ ๋งž์ถฐ์„œ ์ข€ ๋‚ฎ๊ธดํ•˜์ง€๋งŒ ์ผ๋‹จ ์ •์ƒ์ ์œผ๋กœ ์ฝ”๋“œ๊ฐ€ ๋™์ž‘ํ•˜๋Š”๊ฒŒ ๋ชฉ์ ์ด์—ˆ์œผ๋‹ˆ 1.7.0์œผ๋กœ ๋˜‘๊ฐ™์ด ๊ฐ€์ ธ์™”๋‹ค.
๊ทธ์น˜๋งŒ ์˜์กด์„ฑ๋“ค ์ถ”๊ฐ€ ํ›„ ์ฝ”๋“œ๋ฅผ ๋‹ค ์˜ฎ๊ธฐ๊ณ  ์‹คํ–‰์„ ์‹œ์ผฐ๋Š”๋ฐ ์•ˆ๋จ

์œ„์˜ ์—๋Ÿฌ ๋กœ๊ทธ ํ…์ŠคํŠธ

๋”๋ณด๊ธฐ


Apr 27, 2023 2:12:54 AM org.apache.catalina.core.StandardWrapperValve invoke
์‹ฌ๊ฐ: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: co m.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;] with root cause
java.lang.NoSuchMethodError: co m.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor; 
at co m.google.auth.oauth2.OAuth2Credentials.refreshIfExpired(OAuth2Credentials.java:191) 
  ....

๋ฉ”์„œ๋“œ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค๊ณ  ์ต์…‰์…˜์ด ๊ณ„์† ๋ฐœ์ƒํ•œ๋‹ค.
๊ตฌ๊ธ€๋ง์„ ์ข€ ํ•ด๋ณด๋‹ˆ guava ๋ฒ„์ „์ด ์•ˆ๋งž์œผ๋ฉด ์ด๋Ÿฐ ์ต์…‰์…˜์ด ๋‚  ์ˆ˜ ์žˆ๋‹ค๊ณ  ํ•˜์—ฌ ๊ธฐ์กด์— ์‚ฌ์šฉํ•˜๋˜ ๋ฒ„์ „์— ๋งž์ถฐ์„œ <version>31.1-jre</version>๋ฅผ pom์— ์ถ”๊ฐ€ํ•ด์คฌ๋‹ค.

<!--https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
	<groupId>com.google.guava</groupId>
	<artifactId>guava</artifactId>
	<version>31.1-jre</version>
</dependency>

 

๊ตฌ์•„๋ฐ” ๋ฒ„์ „๋„ ์กฐ์ •์„ ํ•ด์คฌ๋Š”๋ฐ๋„ ์—ฌ์ „ํžˆ ๋ฉ”์„œ๋“œ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค๊ณ  ์ต์…‰์…˜์ด ๋‚œ๋‹ค.
๋ณด์•„ํ•˜๋‹ˆ.. ํ”„๋กœ์ ํŠธ ์กฐํšŒ๋ฅผ ์œ„ํ•ด cloudresourcemanager๋ฅผ ์‚ฌ์šฉํ•˜๋Š”๋ฐ ์—ฌ๊ธฐ์„œ ์‚ฌ์šฉํ•˜๋Š” guava-jdk5์™€ ๋ฒ„์ „ ์ถฉ๋Œ์ด ๋‚œ๋‹ค๊ณ  ํ•œ๋‹ค.
๊ทธ๋ž˜์„œ resourcemanager ์ถ”๊ฐ€ํ•˜๋Š”๋ฐ์— ํ•ด๋‹น ๊ตฌ์•„๋ฐ” ๋ฒ„์ „์„ ์ œ๊ฑฐํ•˜๊ณ  ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ฒ˜๋ฆฌ ์™„๋ฃŒ ์ž˜๋œ๋‹น

<dependency>
	<groupId>com.google.apis</groupId>
	<artifactId>google-api-services-cloudresourcemanager</artifactId>
	<version>v1-rev497-1.23.0</version>
	<exclusions>
		<exclusion>
			<groupId>co m.google.guava </groupId>
			<artifactId>guava-jdk5</artifactId>
		</exclusion>
	</exclusions>
</dependency>