0

tomcat 9 and 10 war file deployment for one microservice gives "This site can’t be reached The connection was reset." error page

I have successfully deployed three other war files, but the more bulky one (69.5MB) gives me the error above when I click the "Deploy" button after selecting the .war file. Someone suggested I try simply putting the file in the conf/webapps directory under the apache installation folder (Windows 10 OS) and restarting the server, but that doesn't work either. I tried running the 4 microservices from Spring Tool Suite (STS) and they work fine, but I am trying to follow directions for adding a .war file for a tiny web project on Tomcat and running both my 69.5MB microservice and the tiny web project on Tomcat as the instructions say to use port 8080 for both. (and subsequently command line start Tomcat with both projects/microservices running on a non-embedded Tomcat. The 69.5MB microservice and the other three microservices run fine with Spring Boot)

Any ideas on how to proceed?

Michael

  • After putting war inside webapps, start tomcat and check tomcat logs for better information on whats going inside tomcat.. Its not possible to pin point with the information you have provided. – sango May 18 '21 at 14:17
  • I will take a look at the log files but it seems that the answer below answered my query. – Michael Leonida Draganoiu May 24 '21 at 16:14

1 Answers1

0

Tomcat Manager has a 50 MiB limit on attachments, which can not be changed without modifying the deployment descriptor of the Tomcat Manager application: see the following lines of manager/WEB-INF/web.xml:

    <multipart-config>
      <!-- 50MB max -->
      <max-file-size>52428800</max-file-size>
      <max-request-size>52428800</max-request-size>
      <file-size-threshold>0</file-size-threshold>
    </multipart-config>

On the other hand, unless you disabled autoDeploy, you can deploy new applications by:

  • dropping the WAR file to $CATALINA_BASE/webapps (where $CATALINA_BASE is the folder where Tomcat is installed) in Tomcat 9,
  • dropping the WAR file to $CATALINA_BASE/webapps-javaee in Tomcat 10.

The application should be deployed within seconds.

Remark: Tomcat 10 is a Jakarta EE 9 servlet container, so most applications will not work on it out-of-the-box (see e.g. this question), but need to be converted. Dropping them to the folder webapps-javaee does exactly that.

Piotr P. Karwasz
  • 12,857
  • 3
  • 20
  • 43
  • Piotr, thank you so much. That was exactly what the problem was. (so far) Sorry I didn't get to try it sooner. I changed the limit on Apache 9 by adding a 1 in front of the limit in manager/WEB-INF/web.xml, and my microservice was deployed. There is a new problem, however. I have 4 microservices right now: Eureka which keeps track of microservice port numbers, ConfigServer which has configuration, Users microservice (most of data so far) and ApiGateway which filters traffic to Users (and future) microservices. Problem: can't get communication on port #s. What MSs should I deploy on what port#? – Michael Leonida Draganoiu May 24 '21 at 16:16
  • More exactly, they communicate on port #s fine when I run them thru Spring boot, but when I load them all onto Apache Tomcat 9, (in order to run Users microservice and a web project for accepting email registration) the port # structure doesn't work. Should I change all microservices configuration files to same port #? Or maybe all except for Eureka? When deployed to Tomcat 9, Eureka server doesn't show. (or more exactly I'm not sure what port # it would be on. Default is 8761 I believe for Eureka but I specify 8012, neither works for deployed Eureka) – Michael Leonida Draganoiu May 24 '21 at 16:23
  • All the applications deployed on Tomcat use the same ports. What changes is the context path: e.g. Eureka might be under `http://localhost:8080/Eureka`, ConfigServer under `http://localhost:8080/ConfigServer`, etc. – Piotr P. Karwasz May 24 '21 at 16:30
  • Still having trouble deploying the microservices. I think the problem is Eureka can't be found (yet :) when deployed on Tomcat 9 with my current configuration. Here is the application.properties file: #server.port=8012 server.port=8080 spring.application.name=eureka eureka.client.registerWithEureka=true eureka.client.fetchRegistry=false eureka.instance.preferIpAddress=true #eureka.client.serviceUrl.defaultZone = http://localhost:8012/eureka eureka.client.serviceUrl.defaultZone = http://localhost:8080/eureka – Michael Leonida Draganoiu May 27 '21 at 14:26
  • I used to have Eureka on 8012, but I felt I had to change it to 8080 the default Tomcat port. Here is the error when I "mvn install" the war file: INFO 9092 --- [nfoReplicator-0] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8080/eureka/}, exception=java.net.ConnectException: Connection refused: no further information stacktrace=com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: no further information at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.ha – Michael Leonida Draganoiu May 27 '21 at 14:30
  • I tell Eureka to self-register on Eureka as a client (flag set to true) but it doesn't. When the port is 8012, I believe that it still does. (and when run as a Spring boot application) – Michael Leonida Draganoiu May 27 '21 at 14:31
  • Look at the names of the WAR files in the `webapps` folder: Maven probably generates and deploys a file named `eureka-.war`, which means that the service will be under the path `eureka-.war`. Check also which port is Tomcat using. – Piotr P. Karwasz May 27 '21 at 14:45