I have a springboot app and its builds fine, but when I am trying to run it as springboot app in STS its giving the following error... I am not sure what is happening.
Here is the pom.xml
I am using
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.ge.aviation.det</groupId>
<artifactId>spcsa-scenario-service</artifactId>
<version>1.0.218</version>
<packaging>jar</packaging>
<name>spcsa-scenario-service</name>
<description>SPCSA Scenario management services</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<build.number>SNAPSHOT</build.number>
<aws.sdk.version>1.11.710</aws.sdk.version>
</properties>
And this the main class:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* This is the main class of scenario services
*
* @author 385220
*/
//@SpringBootApplication(scanBasePackages="com.ge.aviation.det")
@Configuration
@EnableAutoConfiguration
@ComponentScan({"com.ge.aviation.det"})
@ImportResource({"classpath*:META-INF/spring/security-context.xml", "classpath*:META-INF/spring/sfdc-quote-config.xml"})
@EnableTransactionManagement
@EnableAsync
@RestController
public class DetQuoteServiceApplication {
public static void main(String[] args) {
SpringApplication.run(DetQuoteServiceApplication.class, args);
}
@Bean
public HealthIndicator quoteHealthIndicator() {
return () -> Health.up().withDetail("spcsa-quote-service", "up").build();
}
@RequestMapping(value ="/check", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> getCheckStatus() {
return new ResponseEntity<>("success", HttpStatus.OK);
}
}
And the error when I run it as an app in local
Error:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
[32m :: Spring Boot :: [39m [2m (v1.3.3.RELEASE)[0;39m
[2m2024-10-29 14:46:48.132[0;39m [32m INFO[0;39m [35m93476[0;39m [2m---[0;39m [2m[ main][0;39m [36mc.g.a.det.DetQuoteServiceApplication [0;39m [2m:[0;39m Starting DetQuoteServiceApplication on G2B3G9Y3E with PID 93476 (C:\Users\502622018\cpq-workspace\spcsa-quote-service\target\classes started by 502622018 in C:\Users\502622018\cpq-workspace\spcsa-quote-service)
[2m2024-10-29 14:46:48.135[0;39m [32m INFO[0;39m [35m93476[0;39m [2m---[0;39m [2m[ main][0;39m [36mc.g.a.det.DetQuoteServiceApplication [0;39m [2m:[0;39m The following profiles are active: local
[2m2024-10-29 14:46:48.168[0;39m [32m INFO[0;39m [35m93476[0;39m [2m---[0;39m [2m[ main][0;39m [36mationConfigEmbeddedWebApplicationContext[0;39m [2m:[0;39m Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2e4b8173: startup date [Tue Oct 29 14:46:48 EDT 2024]; root of context hierarchy
[2m2024-10-29 14:46:49.369[0;39m [31mERROR[0;39m [35m93476[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.s.boot.SpringApplication [0;39m [2m:[0;39m Application startup failed
java.util.ConcurrentModificationException: null
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:966) ~[na:1.8.0_371]
at java.util.LinkedList$ListItr.next(LinkedList.java:888) ~[na:1.8.0_371]
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:421) ~[spring-context-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:175) ~[spring-context-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306) ~[spring-context-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239) ~[spring-context-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) ~[spring-context-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) ~[spring-context-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606) ~[spring-context-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462) ~[spring-context-4.1.0.RELEASE.jar:4.1.0.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at com.ge.aviation.det.DetQuoteServiceApplication.main(DetQuoteServiceApplication.java:34) [classes/:na]
[2m2024-10-29 14:46:49.370[0;39m [32m INFO[0;39m [35m93476[0;39m [2m---[0;39m [2m[ main][0;39m [36m.b.l.ClasspathLoggingApplicationListener[0;39m [2m:[0;39m Application failed to start with classpath:
The Stacktrace catching the checkCoModification Exception
spcsa-quote-service - DetQuoteServiceApplication [Spring Boot App]
com.ge.aviation.det.DetQuoteServiceApplication at localhost:61216
Thread [main] (Suspended (exception ConcurrentModificationException))
owns: Object (id=41)
LinkedList$ListItr.checkForComodification() line: 966 [local variables unavailable]
LinkedList$ListItr.next() line: 888 [local variables unavailable]
ConfigurationClassParser.processDeferredImportSelectors() line: 421
ConfigurationClassParser.parse(Set<BeanDefinitionHolder>) line: 175
ConfigurationClassPostProcessor.processConfigBeanDefinitions(BeanDefinitionRegistry) line: 306
ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(BeanDefinitionRegistry) line: 239
PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(Collection<BeanDefinitionRegistryPostProcessor>, BeanDefinitionRegistry) line: 254
PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory, List<BeanFactoryPostProcessor>) line: 94
AnnotationConfigEmbeddedWebApplicationContext(AbstractApplicationContext).invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory) line: 606
AnnotationConfigEmbeddedWebApplicationContext(AbstractApplicationContext).refresh() line: 462
AnnotationConfigEmbeddedWebApplicationContext(EmbeddedWebApplicationContext).refresh() line: 118
SpringApplication.refresh(ApplicationContext) line: 766
SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 361
SpringApplication.run(String...) line: 307
SpringApplication.run(Object[], String[]) line: 1191
SpringApplication.run(Object, String...) line: 1180
DetQuoteServiceApplication.main(String[]) line: 36
C:\Program Files\Java\jdk-1.8\bin\javaw.exe (Oct 29, 2024, 10:02:16 PM) [pid: 26548]
From the stacktrace, I can deduct that you're using Spring 4.1.0 (due to spring-context-4.1.0.RELEASE.jar
). There's two problems with that:
Since Spring Boot 1.3.3 by default comes with Spring 4.2.5, there's likely a conflicting dependency (or you're overriding the version by yourself). The easiest way to investigate this is by checking the dependency tree. This can be done using the following command:
mvn dependency:tree
Once you resolve that issue, the ConcurrentModificationException
should also disappear.