Reputation: 2994
I'm trying to add a RESTful web service to an existing Java application. My technology stack is Spring( Web services & Boot), Gradle build, and Tomcat 10 Web server, finally all on Windows 10.
In order:
1) Here is my Gradle:
plugins {
id 'org.springframework.boot' version '2.6.2'
id 'java'
}
sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
if (!hasProperty('mainClass')) {
ext.mainClass = 'oaisclientnew.Main'
}
repositories {
mavenCentral()
}
task fatJarLib(type: Jar) {
manifest {
}
baseName = 'oais_restful_server'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.10'
//implementation name: 'libs/oais_if_prototype_lib.jar'
compile fileTree(dir: 'libs', include: '*.jar')
// https://mvnrepository.com/artifact/org.springframework.ws/spring-ws
implementation 'org.springframework.ws:spring-ws:3.1.1'
// https://mvnrepository.com/artifact/org.springframework/spring-web
implementation 'org.springframework:spring-web:5.3.14'
// https://mvnrepository.com/artifact/org.springframework/spring-core
implementation 'org.springframework:spring-core:5.3.14'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web
implementation 'org.springframework.boot:spring-boot-starter-web:2.6.2'
}
When I input: http://localhost:9090/
, Tomcat's welcome page is displayed.
2)
Below is the Main & SpringApplication.run
(relevant snippet no imports):
@SpringBootApplication
@Configuration
@EnableAutoConfiguration
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
}
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return args -> {
System.out.println("Spring boot!");
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
};
}
}
3) Controller: (Relevant code only)
@RestController
public class PDS4FrontCrontroller {
//@RequestMapping(value="/pds4_injest")
@GetMapping(value="/pds4_injest")
public PDS4MetaData greeting() {
return new PDS4MetaData("C:\\Users\\anaim\\Desktop\\MIST\\for_ary\\A0087_0014_597774923_597783273_181207004231_eu.xml", "https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1B10.xsd");
}
}
Im able to build the project using gradle clean build
.
However, I cant deploy the project and/or Spring Boot when I issue the command gradlew bootRun
, it taking Gradle over 20 hours to start Spring Boot! See below:
<
==========---> 80% EXECUTING [3m 7s]onfigure.web.ServerProperties
servletWebServerFactoryCustomizer
simpleControllerHandlerAdapter
<==========---> 80% EXECUTING [20h 33m 25s]nfigure.info.ProjectInfoProperties
<==========---> 80% EXECUTING [20h 33m 54s]oconfigure.jackson.JacksonProperties
spring.lifecycle-org.springframework.boot.autoconfigure.context.LifecycleProperties
Terminate batch job (Y/N)? NG [20h 33m 26s]figure.web.servlet.WebMvcProperties
spring.servlet.multipart-org.springframework.boot.autoconfigure.web.servlet.MultipartProperties
spring.sql.init-org.springframework.boot.autoconfigure.sql.init.SqlInitializationProperties
spring.task.execution-org.springframework.boot.autoconfigure.task.TaskExecutionProperties
spring.task.scheduling-org.springframework.boot.autoconfigure.task.TaskSchedulingProperties
spring.web-org.springframework.boot.autoconfigure.web.WebProperties
standardJacksonObjectMapperBuilderCustomizer
<==========---> 80% EXECUTING [11s]
taskExecutorBuilder
taskSchedulerBuilder
<==========---> 80% EXECUTING [3m 4s]
tomcatServletWebServerFactory
<==========---> 80% EXECUTING [14s]izer
tomcatWebServerFactoryCustomizer
viewControllerHandlerMapping
viewNameTranslator
viewResolver
webServerFactoryCustomizerBeanPostProcessor
websocketServletWebServerCustomizer
welcomePageHandlerMapping
<==========---> 80% EXECUTING [10s]
> :bootRun
After some searching, It seems Im actually having the same issue as this: Spring Boot - Run project error: Waiting to acquire shared lock on daemon addresses registry , however there doesn't seem to be any single or coherent solution.
Any suggestions?
Thanks
Upvotes: 1
Views: 1808
Reputation: 2506
Try to downgrade to Tomcat 9 since Tomcat 10 and Spring 5 are not compatible due to the package being named differently, jakarata replaced javax packages.
Upvotes: 1