how to deploy Spring Cloud war to old container - spring

I had a Spring Cloud project which was deployed in embeded tomcat. Now I modify the project add web.xml and make the Application class extends SpringBootServletInitializer. I followed the instruction of 81.5 Deploying a WAR in an Old (Servlet 2.5) Container in below link. But I found that the application.properties was not loaded. And the server port listed in application.properties was not listened.
[http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html#howto-servlet-2-5]
Deploying a WAR in an Old (Servlet 2.5) Container
application.properties
spring.application.name=api-gateway
server.port=5555
# routes to serviceId
zuul.routes.api-a.path=/api-a/**
zuul.routes.api-a.serviceId=service-A
zuul.routes.api-b.path=/api-b/**
zuul.routes.api-b.serviceId=service-B
# routes to url
zuul.routes.api-a-url.path=/api-a-url/**
zuul.routes.api-a-url.url=http://localhost:2222/
eureka.client.serviceUrl.defaultZone=http://localhost:9999/eureka/

Related

Start spring boot jar file as part of tomcat start

There is a way I can start the spring boot jar file as part of tomcat start(catalina.bat start).
I have a spring cloud api gateway which does not support war file deployment.
In a bare metal box, I have installed the tomcat, and as part of deployment I have converted all microservice into war file and able to deploy it into tomcat/webapp folder and up and running.
As spring cloud api gateway does not support war file, I kept this application with embed tomcat.
Now I need this jar file as well get started along with the tomcat [catalina.bat start].
In tomcat I have seen there is something shared.loader option in catalina.properties file.
I have kept the jar file in below path as shown below and when I try to start it, jar file is not getting picked up.
Need to know if there is a way to start the spring boot application [jar file] as part of tomcat [catalina.bat start] start.

Control order of WAR file deployment in JBoss EAP 7.2.0

I have developed two Spring Boot applications, one is Cloud Config Server and the other is a Spring Boot application that fetches property from Config Server. I have deployed the two applications as WAR files in JBoss EAP. I am deploying the WAR files in sequence, deploying the Config Server before the other application. Problem is happening after I restart the server, the second war file is getting deployed before the war file for Config Server.
I Jboss EAP 7.2.0, how will I ensure that the WAR file for Config Server is always deployed before the WAR file of the other application?
You can control the startup order of deployment by using jboss-all.xml deployment descriptor to declare dependencies between the deployments.
Example:
If you want foo.ear is deployed before bar.ear then you can create an bar.ear/META-INF/jboss-all.xml file like this:
<jboss xmlns="urn:jboss:1.0">
<jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
<dependency name="foo.ear" />
</jboss-deployment-dependencies>
</jboss>
[1] https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/configuration_guide/deploying_applications#control_order_deployments
[2] https://access.redhat.com/solutions/88763

How to start multiple spring-boot applications using Maven, say Client on port 8081 and API on port 8080

I have a multi-module project developed using Spring Boot managed by Maven. There are two spring boot applications, say the API which runs on port 8081 and the thymeleaf client which runs on port 8080. I would want to bootrun both the applications in a single maven command from the root project. Currently, I am explicitly starting each of the application class. How do I achieve this using Maven.?
The project folder structure is as below.
1 RootProject - pom.xml
1.1--API(Spring Boot Project) with port 8080- pom.xml
1.2--Client(Spring Boot Project) with port 8081 - pom.xml
Thanks,
KR

Deploying a spring boot war on jetty9.4.6 with no URI in the war available

I follow the spring boot reference document to make an executable and deployable war in 2 steps:
in pom file, make a war package and make spring-boot-starter-tomcat scope
provided
make the Application class extends
SpringBootServletInitializer and override configure method.
then copy the war file to {jetty_home}/webapps.
I tried restart the jetty server and it seems the war was loaded with below info
2017-07-24 11:16:35.740:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext#6e1ec318{/abc-0.1,file:///tmp/jetty-0.0.0.0-8080-abc-0.1.war-_abc-0.1-any-4452702112804908874.dir/webapp/,AVAILABLE}{/abc-0.1.war}
Visitin {jetty_server_ip}:8080/abc-0.1 shows "Directory: /abc-0.1/" while visit any URL in the war returns a 404 error.
What am I doing wrong? Please guide.
The WebApp's "context path" is set to /abc-0.1 in your deployed instance.
You will only be able to access that webapp on {host}/abc-0.1/.
Assuming that you have no other contexts (webapps) deployed, then you have nothing answering at {host}/abc/ and will always get 404 for {host}/abc/ prefixed URLs.

Spring Boot and Jboss wildfly setting the context root

I am trying to set the context root of my spring boot application. I'm deploying my application as a war file to Jboss.
i've tried to set the contextPath of what I'd like my root URL to be when deploying it to JBoss/Wildfly but it seems to get ignored. Unless I add a jboss-web.xml file setting a contex-root variable, my deployment url is always based on the war file name:
e.g. : myapp.war always deploys as : localhost:8080/myapp unless I use jboss-web. I've tried setting the contextPath in the server.properties file and it doesn't seem to work.
My question is should I be able to? I'm using the latest Spring Boot.
In other words, add your jboss-web.xml
file in this directory : /src/main/webapp/WEB-INF
Content of your jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/</context-root>
</jboss-web>
All of the server.* properties that Spring Boot supports only apply to the configuration of the embedded servlet container (Tomcat, Jetty, or Undertow). If you're deploying your Spring Boot app to a standalone server then you'll need to configure that server using whatever mechanisms it provides.

Resources