본문 바로가기

intellij +springboot/오류정리

httpclient 사용 시 메이븐 war 파일 빌드 안될때

 

 

로컬에서는 잘 실행 되는데 빌드만 하면 에러.. 기존 httpclient -4.5.2.jar 를 사용중 이었는데 maven 에서 뭐가 맘에 안드는지 의존성을 따로 추가해 줘야 빌드가 된다

 

 

java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@2be21396 testClass =
 com.raresoft.vc.RaresoftApplicationTests, locations = [], classes = [com.raresoft.vc.RaresoftApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties =
 ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers =
 [org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@528c868,
 org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@31c7528f,
 org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0,
 org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@2f16c6b3,
 org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory
$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@
0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@33308786, 
org.springframework.boot.test.context.SpringBootTestAnnotation@24e205a7], resourceBasePath = "src/main/webapp", contextLoader = 
org.springframework.boot.test.context.SpringBootContextLoader, parent = null] at 
org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.
java:143) ~[spring-test-6.0.13.jar:6.0.13] at or

 

 

맞는 버전으로 추가하고 빌드하면 된다

 

		<groupId>org.apache.httpcomponents</groupId>
		<artifactId>httpclient</artifactId>
			<version>4.5.2</version>
			</dependency>
		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpmime</artifactId>
			 <version>4.5.2</version>
		 </dependency>
		 <dependency>
			 <groupId>org.apache.httpcomponents</groupId>
			 <artifactId>httpcore</artifactId>
			 <version>4.4.4</version>
		</dependency>

 

 

 

출처 : https://arcsit.tistory.com/entry/JAVA-%EC%95%84%ED%8C%8C%EC%B9%98%EC%97%90%EC%84%9C-%EC%A0%9C%EA%B3%B5%ED%95%98%EB%8A%94-HttpComponents%EB%A1%9C-Http-Client-%EB%A7%8C%EB%93%A4%EA%B8%B0