The selection cannot be run on any server
What you are dealing with is a Spring boot
application which has an embedded battle tested Tomcat
server.
To run your application you have to run it as a Java Application
or a Spring Boot App
.
Check out this and this to find out how to deploy Spring boot
app as a war.
Sumit Surana
Experienced full-stack developer with a passion for developing innovative applications that expedite the efficiency and ease of user experience. Well-versed in technology and writing code which is modular, scalable and concise. A Skilled leader who has the proven ability to motivate, educate and manage a team of professionals to build software programs and effectively track changes. A confident communicator, strategic thinker and an innovative creator, who develops software that is customized to meet organizational needs.
Updated on June 04, 2022Comments
-
Sumit Surana almost 2 years
I am trying to learn a bit about spring boot application. Below is the pom.xml file. The problem is that when I try to run the application on server I get the message
The selection cannot be run on server
. Not sure why this is happening.I have checked few similar stack overflow questions listed below "The selection cannot be run on any server" and Eclipse Maven Spring: Server Error when I try to Run As Server (Tomcat 7) but couldn't get a solution.
There are no errors or warnings in the problems tab of STS. Also I have configured STS to use Apache tomcat version 9.
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.blog</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>demo</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.3.RELEASE</version> <relativePath /> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <scope>provided</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
Please suggest what has to be done for running this application on server
-
Abdullah Khan about 7 yearsDid you try running it as a
Spring Boot App / Java Application
? -
Sumit Surana about 7 yearsTried running it by right clicking on project, then clicked on
Run As
and then onSpring Boot Application
. And it ran perfectly. But I require it to be hosted on a server -
Abdullah Khan about 7 yearsPlease create a separate question for it.
-
-
Sumit Surana about 7 yearsthis didn't gave solution but provided the direction in which I should head to. I solved it by simply adding the dependency
spring-boot-starter-web
and then when tried running again as aspring-boot-app
the application started getting hosted on tomcat without any issues. So thanks for pointing in that direction