{"id":91365,"date":"2019-04-29T08:47:40","date_gmt":"2019-04-29T05:47:40","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=91365"},"modified":"2019-05-07T11:14:12","modified_gmt":"2019-05-07T08:14:12","slug":"deploy-spring-boot-application-tomcat","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html","title":{"rendered":"Deploy a Spring Boot Application into Tomcat"},"content":{"rendered":"<p><span style=\"font-size: 20px;\"><b>\u201cI love writing authentication and authorization code.\u201d ~ No Java Developer Ever.<\/b> Tired of building the same login screens over and over? <a href=\"https:\/\/developer.okta.com\/signup\/?utm_campaign=text_website_all_multiple_dev_ciam_spring-boot-tomcat_null&amp;utm_source=jcg&amp;utm_medium=cpc\">Try the Okta API for hosted authentication, authorization, and multi-factor auth.<\/a><\/span><\/p>\n<p>Deploying applications is hard. Often you need console access to the server from which you pull the latest code and then manually instantiate into your container. In this tutorial you\u2019ll see an easier way using Tomcat: you\u2019ll create an authenticated web app and deploy it through the browser using the latest versions of Tomcat, Spring Boot, and Java.<\/p>\n<p>Since version 9, Oracle has decreased the Java release cadence to six months so major version numbers are increasing at a much faster rate than before. The latest release is&nbsp;<strong>Java SE 11<\/strong>&nbsp;(Standard Edition) which came out in September 2018. The biggest licensing change in this new release has led to one clear takeaway: to use the OpenJDK from now on. Open JDK is the free version of Java that you can now also get from Oracle. Also, Java 11 has long term support so this is the version you should be using for new projects going forward.<\/p>\n<h2 class=\"wp-block-heading\" id=\"start-your-java-11-app\">Start Your Java 11 App<\/h2>\n<p>Open up a console and run&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">java -version<\/code>&nbsp;to see what version of Java you are using.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:java\">[karl@localhost demo]$ java -version\nopenjdk version \"1.8.0_111\"\nOpenJDK Runtime Environment (build 1.8.0_111-b16)\nOpenJDK 64-Bit Server VM (build 25.111-b16, mixed mode)\n[karl@localhost demo]$\n<\/pre>\n<p>Java 8 is shown as version&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">1.8.0<\/code>.<\/p>\n<p><a href=\"https:\/\/sdkman.io\/\">SDKMAN<\/a>&nbsp;is a great tool for keeping your development libraries up to date. To install it run<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">$ curl -s \"https:\/\/get.sdkman.io\" | bash<\/pre>\n<p>Note that SDKMAN only works on Linux and Unix-like systems. Windows users will need to&nbsp;<a href=\"https:\/\/stackoverflow.com\/a\/52531093\/4295424\">install the latest Java manually<\/a>.<\/p>\n<p>If SDKMAN installs properly you will see instructions for getting the command to work in your current terminal.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">All done!\n\nPlease open a new terminal, or run the following in the existing one:\n\n\tsource \"\/home\/karl\/.sdkman\/bin\/sdkman-init.sh\"\n\nThen issue the following command:\n\n\tsdk help\n\nEnjoy!!!\n[karl@localhost demo]\n<\/pre>\n<p>Run the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">source<\/code>&nbsp;command shown and the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">sdk<\/code>&nbsp;command should be active.<\/p>\n<p>Now install the latest Java simply with&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">sdk install java<\/code>.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">[karl@localhost demo]$ sdk install java\n\nDownloading: java 11.0.2-open\n\nIn progress...\n<\/pre>\n<p>Once done&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">java -version<\/code>&nbsp;should show&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">11.0.2<\/code>.<\/p>\n<pre class=\"gutter: false;brush:bash\">Done installing!\n\nSetting java 11.0.2-open as default.\n[karl@localhost demo]$ java -version\nopenjdk version \"11.0.2\" 2019-01-15\nOpenJDK Runtime Environment 18.9 (build 11.0.2+9)\nOpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)\n[karl@localhost demo]$\n<\/pre>\n<p><strong>NOTE:<\/strong>&nbsp;If you already have SDKMAN! and Java 11 installed, you can set it as the default using&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">sdk default java 11.0.2-open<\/code>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"create-a-spring-boot-project-for-tomcat\">Create a Spring Boot Project for Tomcat<\/h2>\n<p>The most popular way to start a Spring project is with&nbsp;<a href=\"https:\/\/start.spring.io\/\">Spring Initializr<\/a><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring-initializr-1-1024x664.png\" alt=\"Spring Boot Application\" class=\"wp-image-91367\" width=\"768\" height=\"498\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring-initializr-1-1024x664.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring-initializr-1-300x195.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring-initializr-1-768x498.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring-initializr-1.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>Navigate to start.spring.io in your favorite web browser, then choose your project options:<\/p>\n<ul class=\"wp-block-list\">\n<li>Leave as Maven, Java, and the latest stable Spring Boot (2.1.4)<\/li>\n<li>Change the group and artifact if you wish<\/li>\n<li>Click on&nbsp;<strong>More options<\/strong>&nbsp;and select&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">Java 11<\/code><\/li>\n<li>In the&nbsp;<em>Dependencies<\/em>&nbsp;box, type and choose&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">Web<\/code>,&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">Security<\/code>&nbsp;and&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">Devtools<\/code>. They should appear as&nbsp;<em>Dependencies selected<\/em>&nbsp;on the right<\/li>\n<\/ul>\n<p>Now click&nbsp;<strong>Generate Project<\/strong>&nbsp;and a zip file will download with the project inside. Simply unzip and enter the directory from the command line. If you&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">ls<\/code>&nbsp;you\u2019ll see five files and one directory (<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">src<\/code>).<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">[karl@m14x demo]$ ls\nHELP.md  mvnw  mvnw.cmd  pom.xml  src\n<\/pre>\n<p><code class=\"highlighter-rouge\" style=\"font-size: 13px;\">mvnw<\/code>&nbsp;is a script that allows you to use Maven without installing it globally.&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">mvnw.cmd<\/code>&nbsp;is the Windows version of this script.&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">pom.xml<\/code>&nbsp;describes your project, and&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">src<\/code>&nbsp;has your Java code inside. (Note there\u2019s also a hidden&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">.mvn<\/code>&nbsp;directory where the embedded maven files sit!)<\/p>\n<p>Let\u2019s see what the project does. Type&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">.\/mvnw spring-boot:run<\/code>&nbsp;and press enter. It may take a while for everything to install, but eventually, you should see something like this:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash; wrap-lines:false\">Tomcat started on port(s): 8080 (http) with context path ''\n2019-03-17 19:56:49.342  INFO 10744 --- [  restartedMain] com.karl.demo.DemoApplication        \t: Started DemoApplication in 3.022 seconds (JVM running for 3.56)\n<\/pre>\n<p>Note the message&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">Tomcat started on port(s): 8080<\/code>. Open a browser window to&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">http:\/\/localhost:8080<\/code>&nbsp;and you should see a login page.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring-sign-in-1024x579.png\" alt=\"\" class=\"wp-image-91368\" width=\"768\" height=\"434\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring-sign-in-1024x579.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring-sign-in-300x170.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring-sign-in-768x434.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/spring-sign-in.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>You can authenticate using \u201cuser\u201d for a username and the password that\u2019s been printed to your terminal. After logging in, you\u2019ll see a 404 error page because you haven\u2019t created any code to show a landing page at&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">\/<\/code>.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2 class=\"wp-block-heading\" id=\"add-secure-authentication-to-your-spring-boot-app\">Add Secure Authentication to Your Spring Boot App<\/h2>\n<p>Let\u2019s add authentication with Okta. Why Okta? Because you don\u2019t want to worry about managing your users and hashing their passwords, do you? Friends don\u2019t let friends write authentication &#8211; let the experts at Okta do it for you instead! After all, Okta\u2019s API is built with Java and Spring Boot too!<\/p>\n<p>Once you\u2019ve&nbsp;<a href=\"https:\/\/developer.okta.com\/signup\/?utm_campaign=text_website_all_multiple_dev_ciam_spring-boot-tomcat_null&amp;utm_source=jcg&amp;utm_medium=cpc\">signed up<\/a>&nbsp;for a free account, go to&nbsp;<strong>Applications<\/strong>&nbsp;on your dashboard. Click&nbsp;<strong>Add Application<\/strong>, select&nbsp;<strong>Web<\/strong>, and click&nbsp;<strong>Next<\/strong>.<\/p>\n<p>You should now be in the Application Settings page. Replace the&nbsp;<strong>Login Redirect URIs<\/strong>&nbsp;field with the following:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">http:\/\/localhost:8080\/login\/oauth2\/code\/okta\n<\/pre>\n<p>Click&nbsp;<strong>Done<\/strong>&nbsp;at the bottom. Copy your&nbsp;<strong>Client ID<\/strong>&nbsp;and&nbsp;<strong>Client secret<\/strong>&nbsp;from the Client Credentials section and keep them somewhere safe. Now right at the top click the&nbsp;<strong>API<\/strong>&nbsp;tab (next to&nbsp;<strong>Applications<\/strong>) and then&nbsp;<strong>Authorization Servers<\/strong>. Make note of the&nbsp;<strong>Issuer URI<\/strong>which looks like:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">https:\/\/{yourOktaDomain}\/oauth2\/default\n<\/pre>\n<p>Create a file in your project at&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">src\/main\/resources\/application.yml<\/code>&nbsp;and put those values inside:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:java\">okta:  \n  oauth2:\n    issuer: https:\/\/{yourOktaDomain}\/oauth2\/default  \n    client-id: {clientId}\n    client-secret: {clientSecret}\n<\/pre>\n<p>Now add the Okta Spring Boot Starter library as a dependency in your&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">pom.xml<\/code>.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:xml\">&lt;dependency&gt;\n    &lt;groupId&gt;com.okta.spring&lt;\/groupId&gt;\n    &lt;artifactId&gt;okta-spring-boot-starter&lt;\/artifactId&gt;\n    &lt;version&gt;1.1.0&lt;\/version&gt;\n&lt;\/dependency&gt;\n<\/pre>\n<p>Now edit your main Java entry file \u2013 which is probably somewhere like&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">src\/main\/java\/com\/example\/demo\/DemoApplication.java<\/code>&nbsp;\u2013 and add the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">@RestController<\/code>&nbsp;annotation to the class, as well as a homepage entry point:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:java\">package com.example.demo;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.security.core.Authentication;\nimport org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.ResponseBody;\nimport org.springframework.web.bind.annotation.RestController;\n\n@RestController\n@SpringBootApplication\npublic class DemoApplication {\n\n    public static void main(String[] args) {\n   \t SpringApplication.run(DemoApplication.class, args);\n    }\n\n    @GetMapping\n    @ResponseBody\n    public String currentUserName(Authentication authentication) {\n    \tDefaultOidcUser userDetails = (DefaultOidcUser) authentication.getPrincipal();\n    \treturn \"Hello, \" + userDetails.getFullName();\n    }\n}\n<\/pre>\n<p>Restart your app using&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">.\/mvnw spring-boot:run<\/code>&nbsp;or use your IDE to run it.<\/p>\n<p>Now when you visit&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">http:\/\/localhost:8080<\/code>&nbsp;you should see the Okta login screen.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/okta-login.png\" alt=\"Spring Boot Application\" class=\"wp-image-91369\" width=\"400\" height=\"492\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/okta-login.png 800w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/okta-login-244x300.png 244w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/okta-login-768x944.png 768w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/figure>\n<\/div>\n<p>Once you\u2019ve entered in the details of an attached Okta user (you can use the same login as your Okta developer account here) you should see a welcome message with the full name you entered when you registered:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/hello-world-1024x521.png\" alt=\"Spring Boot Application\" class=\"wp-image-91370\" width=\"768\" height=\"391\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/hello-world-1024x521.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/hello-world-300x153.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/hello-world-768x391.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/hello-world.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p><strong>Hot Tip:<\/strong>&nbsp;Logging out of an OAuth2 session is&nbsp;<a href=\"https:\/\/stackoverflow.com\/q\/12909332\">more nuanced<\/a>&nbsp;than one might first imagine. To keep testing the login process, I recommend you use private browsing windows to ensure the login screen returns; close them down when you are finished.<\/p>\n<p>Stop your Spring Boot app so you can run Tomcat on its default port of 8080.<\/p>\n<h2 class=\"wp-block-heading\" id=\"set-up-tomcat-9-for-your-spring-boot-app\">Set up Tomcat 9 for Your Spring Boot App<\/h2>\n<p>Getting Tomcat up and running couldn\u2019t be easier. Start by&nbsp;<a href=\"https:\/\/tomcat.apache.org\/download-90.cgi\">downloading the binary<\/a>&nbsp;compatible with your platform. Make sure to use the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">.zip<\/code>&nbsp;or&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">.tar.gz<\/code>&nbsp;file and not the installer. Extract to a location and inside the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">bin<\/code>&nbsp;directory run the startup script &#8211;&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">startup.sh<\/code>&nbsp;for Linux\/Mac and&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">startup.bat<\/code>&nbsp;for Windows.<\/p>\n<pre class=\"gutter: false;brush:bash\">[karl@m14x bin]$ .\/startup.sh\nUsing CATALINA_BASE:   \/home\/karl\/Downloads\/apache-tomcat-9.0.19\nUsing CATALINA_HOME:   \/home\/karl\/Downloads\/apache-tomcat-9.0.19\nUsing CATALINA_TMPDIR: \/home\/karl\/Downloads\/apache-tomcat-9.0.19\/temp\nUsing JRE_HOME:    \t\/home\/karl\/.sdkman\/candidates\/java\/current\nUsing CLASSPATH:   \t\/home\/karl\/Downloads\/apache-tomcat-9.0.19\/bin\/bootstrap.jar:\/home\/karl\/Downloads\/apache-tomcat-9.0.19\/bin\/tomcat-juli.jar\nTomcat started.\n[karl@m14x bin]$\n<\/pre>\n<p><strong>Hot Tip:<\/strong>&nbsp;You can also use&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">.\/catalina.sh run<\/code>&nbsp;to start your app. This command will print the logs to your terminal so you don\u2019t need to tail them to see what\u2019s happening.<\/p>\n<p>Browse to&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">http:\/\/localhost:8080<\/code>&nbsp;and you should see the Tomcat installation page.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/hello-tomcat-1024x783.png\" alt=\"Spring Boot Application\" class=\"wp-image-91371\" width=\"768\" height=\"587\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/hello-tomcat-1024x783.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/hello-tomcat-300x229.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/hello-tomcat-768x587.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/hello-tomcat.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"create-a-war-file-from-your-spring-boot-project\">Create a WAR File from Your Spring Boot Project<\/h2>\n<p>You now need to create a WAR file from your Spring Boot application. Add the following just after the&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">&lt;description&gt;<\/code>&nbsp;node in your&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">pom.xml<\/code>.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:xml\">&lt;packaging&gt;war&lt;\/packaging&gt;\n<\/pre>\n<p>Remove the embedded Tomcat server by adding the following to your dependencies list:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:xml\">&lt;dependency&gt;\n   &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n   &lt;artifactId&gt;spring-boot-starter-tomcat&lt;\/artifactId&gt;\n   &lt;scope&gt;provided&lt;\/scope&gt;\n&lt;\/dependency&gt;\n<\/pre>\n<p>Finally enable your application as a servlet by extending your main class with <code class=\"highlighter-rouge\" style=\"font-size: 13px;\">SpringBootServletInitializer<\/code>:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:java\">import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;\n\n@SpringBootApplication\npublic class DemoApplication extends SpringBootServletInitializer {\n    ...\n}\n<\/pre>\n<p>Now clean and package your application with the following command:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">.\/mvnw clean package<\/pre>\n<p>You should see a message like the following:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">[INFO] Building war: \/home\/karl\/tst\/demo\/target\/demo-0.0.1-SNAPSHOT.war<\/pre>\n<p>Take note where your new&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">.war<\/code>&nbsp;lives.<\/p>\n<h2 class=\"wp-block-heading\" id=\"deploy-a-war-to-tomcat-from-the-browser\">Deploy a WAR to Tomcat from the Browser<\/h2>\n<p>You may have noticed that on the right-hand side of the Tomcat welcome screen was three buttons:&nbsp;<strong>Server Status<\/strong>,&nbsp;<strong>Manager App<\/strong>, and&nbsp;<strong>Host Manager<\/strong>. You can deploy a WAR from&nbsp;<strong>Manager App<\/strong>&nbsp;but it needs authentication (and there are no users defined by default).<\/p>\n<p>Add the following to&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">conf\/tomcat-users.xml<\/code>&nbsp;in your Tomcat directory:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:xml\">&lt;user username=\"karl\" password=\"secret\" roles=\"manager-gui\" \/&gt;\n<\/pre>\n<p>You\u2019ll need to restart Tomcat for this change to take effect. Because you started it directly you need to stop the process yourself. Find the process id using&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">ps aux | grep tomcat<\/code>.<\/p>\n<pre class=\"gutter: false;brush:bash\">[karl@m14x bin]$ ps aux | grep tomcat\nkarl \t11813  180  1.9 7389172 159596 pts\/0  Sl   09:44   0:07 \/home\/karl\/.sdkman\/candidates\/java\/current\/bin\/java -Djava.util.logging.config.file=\/home\/karl\/Downloads\/apache-tomcat-9.0.19\/conf\/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath \/home\/karl\/Downloads\/apache-tomcat-9.0.19\/bin\/bootstrap.jar:\/home\/karl\/Downloads\/apache-tomcat-9.0.19\/bin\/tomcat-juli.jar -Dcatalina.base=\/home\/karl\/Downloads\/apache-tomcat-9.0.19 -Dcatalina.home=\/home\/karl\/Downloads\/apache-tomcat-9.0.19 -Djava.io.tmpdir=\/home\/karl\/Downloads\/apache-tomcat-9.0.19\/temp org.apache.catalina.startup.Bootstrap start\nkarl \t11881  0.0  0.0   6268  2280 pts\/0\tS+   09:44   0:00 grep tomcat\n[karl@m14x bin]$\n<\/pre>\n<p>Here my process ID is 11813. Use the kill command to kill it.<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:bash\">kill 11813<\/pre>\n<p>Restart the server by using&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">startup.sh<\/code>&nbsp;as before. When you click on the&nbsp;<strong>Manager App<\/strong>&nbsp;button the user details you entered above should get you to the manager screen.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/tomcat-manager-1024x708.png\" alt=\"Spring Boot Application\" class=\"wp-image-91372\" width=\"768\" height=\"531\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/tomcat-manager-1024x708.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/tomcat-manager-300x207.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/tomcat-manager-768x531.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/tomcat-manager.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>Scroll to the bottom to the&nbsp;<strong>WAR file to deploy<\/strong>&nbsp;section. Click&nbsp;<strong>Browse\u2026<\/strong>&nbsp;and select the WAR file from before. Click&nbsp;<strong>Deploy<\/strong>.<\/p>\n<p>If you scroll up you should see something like&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">\/demo-0.0.1-SNAPSHOT<\/code>&nbsp;listed in the&nbsp;<strong>Applications<\/strong>&nbsp;section. Click on this will take us to&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">http:\/\/localhost:8080\/demo-0.0.1-SNAPSHOT<\/code>&nbsp;which is where Tomcat is serving our application from. You\u2019ll see a Bad Request error.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/bad-request-1024x748.png\" alt=\"Spring Boot Application\" class=\"wp-image-91373\" width=\"768\" height=\"561\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/bad-request-1024x748.png 1024w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/bad-request-300x219.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/bad-request-768x561.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/04\/bad-request.png 1600w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<p>This is because the redirect URL is now wrong in our Okta app configuration &#8211; everything should be prepended with&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">demo-0.0.1-SNAPSHOT<\/code>. That name is a bit cumbersome. To change it rename your WAR file to&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">demo.war<\/code>&nbsp;(you can do this permanently by adding&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">&lt;finalName&gt;demo&lt;\/finalName&gt;<\/code>&nbsp;to the build section of your&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">pom.xml<\/code>). Now click&nbsp;<strong>Undeploy<\/strong>&nbsp;next to your app name in the manager window, and redeploy the WAR. Now the app should be under&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">\/demo<\/code>.<\/p>\n<p>Now in your Okta application config prepend all the URLs with&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">\/demo<\/code>, e.g.&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">http:\/\/localhost:8080\/demo\/login\/oauth2\/code\/okta<\/code>&nbsp;(you do this by clicking&nbsp;<strong>Edit<\/strong>&nbsp;and then&nbsp;<strong>Save<\/strong>). Now clicking on your&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">\/demo<\/code>&nbsp;app in the manager (or browsing to&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">http:\/\/localhost:8080\/demo<\/code>) should show you the welcome screen as before.<\/p>\n<p><strong>Hot Tip:<\/strong>&nbsp;To ensure your local development setup matches the machine you are deploying to, make sure the embedded Tomcat version is the same as your external server by adding the following to your&nbsp;<code class=\"highlighter-rouge\" style=\"font-size: 13px;\">pom.xml<\/code>:<\/p>\n<pre class=\"wp-block-preformatted gutter: false;brush:xml\">&lt;properties&gt;\n    &lt;tomcat.version&gt;9.0.19&lt;\/tomcat.version&gt;\n&lt;\/properties&gt;\n<\/pre>\n<h2 class=\"wp-block-heading\" id=\"learn-more-about-tomcat-spring-boot-and-java-11\">Learn More About Tomcat, Spring Boot, and Java 11<\/h2>\n<p>Well done &#8211; you\u2019ve remotely deployed a Spring Boot 2.1 application to Tomcat 9, all backed by Java 11!<\/p>\n<p>I hope you found this tutorial useful. You can find the GitHub repo for this example at&nbsp;<a href=\"https:\/\/github.com\/oktadeveloper\/okta-spring-boot-tomcat-example\">oktadeveloper\/okta-spring-boot-tomcat-example<\/a>.<\/p>\n<p>Check out some of these links below for more information:<\/p>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.okta.com\/blog\/2019\/02\/25\/java-i18n-internationalization-localization?utm_campaign=text_website_all_multiple_dev_ciam_spring-boot-tomcat_null&amp;utm_source=jcg&amp;utm_medium=cpc\">i18n in Java 11, Spring Boot, and JavaScript<\/a><\/li>\n<li><a href=\"https:\/\/developer.okta.com\/blog\/2018\/11\/26\/spring-boot-2-dot-1-oidc-oauth2-reactive-apis?utm_campaign=text_website_all_multiple_dev_ciam_spring-boot-tomcat_null&amp;utm_source=jcg&amp;utm_medium=cpc\">Spring Boot 2.1: Outstanding OIDC, OAuth 2.0, and Reactive API Support<\/a><\/li>\n<li><a href=\"https:\/\/developer.okta.com\/blog\/2019\/03\/05\/spring-boot-migration?utm_campaign=text_website_all_multiple_dev_ciam_spring-boot-tomcat_null&amp;utm_source=jcg&amp;utm_medium=cpc\">Migrate Your Spring Boot App to the Latest and Greatest Spring Security and OAuth 2.0<\/a><\/li>\n<li><a href=\"https:\/\/developer.okta.com\/blog\/2018\/09\/24\/reactive-apis-with-spring-webflux?utm_campaign=text_website_all_multiple_dev_ciam_spring-boot-tomcat_null&amp;utm_source=jcg&amp;utm_medium=cpc\">Build Reactive APIs with Spring WebFlux<\/a><\/li>\n<li><a href=\"https:\/\/developer.okta.com\/blog\/2019\/02\/21\/reactive-with-spring-boot-mongodb?utm_campaign=text_website_all_multiple_dev_ciam_spring-boot-tomcat_null&amp;utm_source=jcg&amp;utm_medium=cpc\">Build a Reactive App with Spring Boot and MongoDB<\/a><\/li>\n<li><a href=\"https:\/\/www.baeldung.com\/tomcat-deploy-war\">Baeldung\u2019s How to Deploy a WAR File to Tomcat<\/a><\/li>\n<\/ul>\n<p>Like what you learned today? Follow us&nbsp;<a href=\"https:\/\/twitter.com\/oktadev\">on Twitter<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/www.youtube.com\/channel\/UC5AMiWqFVFxF1q9Ya1FuZ_Q\">subscribe to our YouTube channel<\/a>.<\/p>\n<p><a href=\"https:\/\/developer.okta.com\/blog\/2019\/04\/16\/spring-boot-tomcat?utm_campaign=text_website_all_multiple_dev_ciam_spring-boot-tomcat_null&amp;utm_source=jcg&amp;utm_medium=cpc\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">\u201cDeploy a Spring Boot Application into Tomcat\u201d<\/a>&nbsp;was originally published on the Okta developer blog on April 16, 2019. <\/p>\n<p><span style=\"font-size: 20px;\"><b>\u201cI love writing authentication and authorization code.\u201d ~ No Java Developer Ever.<\/b> Tired of building the same login screens over and over? <a href=\"https:\/\/developer.okta.com\/signup\/?utm_campaign=text_website_all_multiple_dev_ciam_microservice-architecture-spring-boot-kubernetes_null&amp;utm_source=jcg&amp;utm_medium=cpc\">Try the Okta API for hosted authentication, authorization, and multi-factor auth.<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u201cI love writing authentication and authorization code.\u201d ~ No Java Developer Ever. Tired of building the same login screens over and over? Try the Okta API for hosted authentication, authorization, and multi-factor auth. Deploying applications is hard. Often you need console access to the server from which you pull the latest code and then manually &hellip;<\/p>\n","protected":false},"author":1259,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[32,30,854],"class_list":["post-91365","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-apache-tomcat","tag-spring","tag-spring-boot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Deploy a Spring Boot Application into Tomcat - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about Spring Boot Application? Check our article explaining thouroughly how to Deploy a Spring Boot Application into Tomcat\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deploy a Spring Boot Application into Tomcat - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about Spring Boot Application? Check our article explaining thouroughly how to Deploy a Spring Boot Application into Tomcat\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-29T05:47:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-07T08:14:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Karl Penzhorn\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Karl Penzhorn\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html\"},\"author\":{\"name\":\"Karl Penzhorn\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b7d5b3c13395a3b3d95784883f33d1ee\"},\"headline\":\"Deploy a Spring Boot Application into Tomcat\",\"datePublished\":\"2019-04-29T05:47:40+00:00\",\"dateModified\":\"2019-05-07T08:14:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html\"},\"wordCount\":1703,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Apache Tomcat\",\"Spring\",\"Spring Boot\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html\",\"name\":\"Deploy a Spring Boot Application into Tomcat - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2019-04-29T05:47:40+00:00\",\"dateModified\":\"2019-05-07T08:14:12+00:00\",\"description\":\"Interested to learn about Spring Boot Application? Check our article explaining thouroughly how to Deploy a Spring Boot Application into Tomcat\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/deploy-spring-boot-application-tomcat.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Deploy a Spring Boot Application into Tomcat\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b7d5b3c13395a3b3d95784883f33d1ee\",\"name\":\"Karl Penzhorn\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7fc38a77fd25da6c8d89302edb4da6a84625f62b3fb059848a6545812eedcbb?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7fc38a77fd25da6c8d89302edb4da6a84625f62b3fb059848a6545812eedcbb?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f7fc38a77fd25da6c8d89302edb4da6a84625f62b3fb059848a6545812eedcbb?s=96&d=mm&r=g\",\"caption\":\"Karl Penzhorn\"},\"sameAs\":[\"https:\\\/\\\/stormpath.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/karl-penzhorn\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Deploy a Spring Boot Application into Tomcat - Java Code Geeks","description":"Interested to learn about Spring Boot Application? Check our article explaining thouroughly how to Deploy a Spring Boot Application into Tomcat","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html","og_locale":"en_US","og_type":"article","og_title":"Deploy a Spring Boot Application into Tomcat - Java Code Geeks","og_description":"Interested to learn about Spring Boot Application? Check our article explaining thouroughly how to Deploy a Spring Boot Application into Tomcat","og_url":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-04-29T05:47:40+00:00","article_modified_time":"2019-05-07T08:14:12+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Karl Penzhorn","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Karl Penzhorn","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html"},"author":{"name":"Karl Penzhorn","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b7d5b3c13395a3b3d95784883f33d1ee"},"headline":"Deploy a Spring Boot Application into Tomcat","datePublished":"2019-04-29T05:47:40+00:00","dateModified":"2019-05-07T08:14:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html"},"wordCount":1703,"commentCount":1,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Apache Tomcat","Spring","Spring Boot"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html","url":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html","name":"Deploy a Spring Boot Application into Tomcat - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2019-04-29T05:47:40+00:00","dateModified":"2019-05-07T08:14:12+00:00","description":"Interested to learn about Spring Boot Application? Check our article explaining thouroughly how to Deploy a Spring Boot Application into Tomcat","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/deploy-spring-boot-application-tomcat.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Deploy a Spring Boot Application into Tomcat"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b7d5b3c13395a3b3d95784883f33d1ee","name":"Karl Penzhorn","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f7fc38a77fd25da6c8d89302edb4da6a84625f62b3fb059848a6545812eedcbb?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f7fc38a77fd25da6c8d89302edb4da6a84625f62b3fb059848a6545812eedcbb?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f7fc38a77fd25da6c8d89302edb4da6a84625f62b3fb059848a6545812eedcbb?s=96&d=mm&r=g","caption":"Karl Penzhorn"},"sameAs":["https:\/\/stormpath.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/karl-penzhorn"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/91365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/1259"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=91365"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/91365\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=91365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=91365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=91365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}