Trying to brushup on my j2ee so downloaded a Spring initializr zipped folder and imported in IntelliJ.
I am getting below error while trying to run it as Java Application.
2019-11-04 12:50:35.702 INFO 5900 --- [ main] com.example.spring.demo.DemoApplication : Starting DemoApplication on DESKTOP-OPAMEU4 with PID 5900 (C:\JavaWS\demo\demo\target\classes started by hemis in C:\JavaWS\demo\demo)
2019-11-04 12:50:35.705 INFO 5900 --- [ main] com.example.spring.demo.DemoApplication : No active profile set, falling back to default profiles: default
2019-11-04 12:50:36.413 INFO 5900 --- [ main] com.example.spring.demo.DemoApplication : Started DemoApplication in 1.24 seconds (JVM running for 2.4)
Process finished with exit code 0
Below is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example.spring</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>13.0.1</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Any clues?
Given that your project is just generated from spring initializer it doesn't really do anything yet, and you'll have to add some functionality for it to not exit immediately.
If you expect it to start as a webapp you'll have to add a dependency on
spring-boot-starter-web
.If you prefer
tomcat
as your container, you're good to go with the above dependency, but if you prefer something else - likejetty
you'll have to excludetomcat
fromspring-boot-starter-web
Then you'll get something close to this when starting running
DemoApplication