0
votes

I've been using SpringBoot to develop a webapp - running it on localhost works fine, both using a jar and war to run it from terminal such that:

 mvn install && java -jar target/Eeeeek-0.0.1-SNAPSHOT.jar 

and

java -jar target/Eeeeek-1.3.2.BUILD-SNAPSHOT.war

both work fine, I'm now only packaging as a war file.

The site is visible at http://localhost:8080

I'm now trying to deploy it to my tomcat manager hosted by digitalOcean.

visiting the ip of the droplet http://46.101.2.91:8080 shows the tomcat manager which is great, I then deploy using the manager but encounter errors when I try and access it.

Ideally I'd like the app to eb the landing page of the ipaddress. Any help is appreciated, thank you.

The url when I click the link in manager is http://46.101.2.91:8080/Eeeeek%2D1%2E3%2E2%2EBUILD%2DSNAPSHOT/ which doesn't look right...

enter image description here enter image description here

EDIT: As per the answer given I've deleted the .war and filter from webapps, ran a mvn clean package. Then used the manager to upload the new shiny war. During the upload the page crashed with an error at URL http://46.101.2.91/manager/html/upload?org.apache.catalina.filters.CSRF_NONCE=846E819F21EFBBE715AFBFA39F349E34

I returned to the main and found that the app had been uploaded. Checking webapps dir also confirmed but the same error persisted.

2

2 Answers

1
votes

Does your main class extend the good class? It was my problem. Here an example:

@SpringBootApplication
public class DeployTestApplication extends SpringBootServletInitializer{

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(DeployTestApplication.class);
}

public static void main(String[] args) {
    SpringApplication.run(DeployTestApplication.class, args);
}
}

Also I had to add this to Maven

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
0
votes

Check Your web apps directory is this war file or any folder

(Eeeeek-1.3.2.BUILD-SNAPSHOT) is already there.

if it is so then delete it and reinstall using maven or copy the war file to the webapps directory and restart the Tomcat.

If again problem occurs then check ur web.xml otherwise another issue what i found in my project deploement was Major minor version Exception Problem.

I can't say exactly but u should try these solutions may work for you..

Thanks