0

I need to convert an application to war and run it via Tomcat. I made the application war with maven. But when I upload this war file to tomcat and try to run it on localhost, I get an error like this.

1

Can you help me with this?

The application link https://github.com/spring-projects/spring-petclinic

My operating system is Debian.

In tomcat-users.xml I added

<user username="war-deployer" password="maven-tomcat-plugin"
                roles="manager-gui, manager-script, manager-jmx" />

In maven settings.xml I added

<server>
    <id>maven-tomcat-war-deployment-server></id>
    <username>war-deployer</username>
    <password>maven-tomcat-plugin</password>
</server>

In pom.xml i added

  ...
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.springframework.samples</groupId>
  <artifactId>spring-petclinic</artifactId>
  <version>2.7.0-SNAPSHOT</version>
  <packaging>war</packaging>
  ...

        <!-- Configure the Tomcat Maven plugin -->
<plugin>
  <groupId>org.apache.tomcat.maven</groupId>
  <artifactId>tomcat7-maven-plugin</artifactId>
  <version>2.0</version>
  <configuration>
    <url>http://localhost:9090/manager/text</url>
    <path>/rps</path>
  </configuration>
</plugin>

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-tomcat</artifactId>
  <scope>provided</scope> <!-- This is important. -->
</dependency>

I'm typing this command via terminal inside of webapps/ folder to get .war

mvn clean package

vimuth
  • 5,064
  • 33
  • 79
  • 116
  • I dropped TomCat version then its worked. – Deniz Bedel Aug 30 '22 at 06:16
  • Ah yes, in the 404 screenshot we can see you tried to run spring boot 2.x on tomcat 10. But only spring boot 3.x can run on tomcat 10. This has to do with the Java EE to Jakarta EE migration. You can answer your own question to mark it as solved if you’d like to. – slindenau Aug 30 '22 at 09:38
  • Oh okay, ^_^ thank you so much slindenau, i forgot marked for solved question. – Deniz Bedel Aug 31 '22 at 17:55

0 Answers0