I have two classes
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
package com.example;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
#RestController
public class SampleController {
#RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}
}
I want to make a springboot application that uses maven and tomcat. I want to see output in localhost page.
I use 8282 port, when i click run, it opens that page but it is empty.
So i created a war artifact. Web applicatin exploded but this time it says can not create artifact and it doesnot open that web page.
Why does it show an empty page? I was seeing the output before integrating tomcat.
This is output
/opt/tomcat/bin/catalina.sh run
05-Mar-2016 18:20:58.401 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.32
05-Mar-2016 18:20:58.408 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Feb 2 2016 19:34:53 UTC
05-Mar-2016 18:20:58.408 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.32.0
05-Mar-2016 18:20:58.408 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
05-Mar-2016 18:20:58.408 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.2.0-30-generic
05-Mar-2016 18:20:58.409 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
05-Mar-2016 18:20:58.413 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-8-oracle/jre
05-Mar-2016 18:20:58.413 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_74-b02
05-Mar-2016 18:20:58.413 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
05-Mar-2016 18:20:58.413 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/caneraydin/.IntelliJIdea16/system/tomcat/Unnamed_HelloW
05-Mar-2016 18:20:58.413 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /opt/tomcat
05-Mar-2016 18:20:58.417 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/caneraydin/.IntelliJIdea16/system/tomcat/Unnamed_HelloW/conf/logging.properties
05-Mar-2016 18:20:58.417 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
05-Mar-2016 18:20:58.417 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
05-Mar-2016 18:20:58.437 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
05-Mar-2016 18:20:58.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
05-Mar-2016 18:20:58.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
05-Mar-2016 18:20:58.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
05-Mar-2016 18:20:58.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/opt/tomcat/endorsed
05-Mar-2016 18:20:58.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/caneraydin/.IntelliJIdea16/system/tomcat/Unnamed_HelloW
05-Mar-2016 18:20:58.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
05-Mar-2016 18:20:58.440 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
05-Mar-2016 18:20:58.441 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /home/caneraydin/Downloads/idea-IU-144.4199.23/bin::/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
05-Mar-2016 18:20:59.036 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8282"]
05-Mar-2016 18:20:59.084 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
05-Mar-2016 18:20:59.099 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
05-Mar-2016 18:20:59.102 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
05-Mar-2016 18:20:59.107 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1787 ms
05-Mar-2016 18:20:59.218 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
05-Mar-2016 18:20:59.221 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.32
05-Mar-2016 18:20:59.236 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8282"]
05-Mar-2016 18:20:59.336 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
05-Mar-2016 18:20:59.353 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 245 ms
Connected to server
05-Mar-2016 18:21:09.252 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/manager
05-Mar-2016 18:21:09.732 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/manager has finished in 479 ms
warning no artifacts configured
Select Artifacts from left, choose Web Application: Exploded (JAR is default?),then the warning disappeared, just for your reference,
Related
If I run my spring app from Intellij with Tomcat Server it gives me:
HTTP Status 404 – Not Found
Type Status Report
Message The requested resource [/] is not available
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
Apache Tomcat/9.0.52
But If I put my app.war in tomcat/webapps/ as ROOT.war it works perfectly.
I have problems only when try to run from Intellij
This is the configuration:
This is the deployment:
And this is the output:
C:\apache-tomcat-9.0.52\bin\catalina.bat run
[2021-08-24 02:50:39,974] Artifact myappname:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE: "C:\Users\Main\AppData\Local\JetBrains\IntelliJIdea2021.2\tomcat\f74e8856-a9b4-4e50-9d59-c901731f3dc7"
Using CATALINA_HOME: "C:\apache-tomcat-9.0.52"
Using CATALINA_TMPDIR: "C:\apache-tomcat-9.0.52\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk-10.0.2"
Using CLASSPATH: "C:\apache-tomcat-9.0.52\bin\bootstrap.jar;C:\apache-tomcat-9.0.52\bin\tomcat-juli.jar"
Using CATALINA_OPTS: ""
24-Aug-2021 14:50:40.602 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.52
24-Aug-2021 14:50:40.603 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jul 31 2021 04:12:17 UTC
24-Aug-2021 14:50:40.603 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.52.0
24-Aug-2021 14:50:40.603 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
24-Aug-2021 14:50:40.603 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
24-Aug-2021 14:50:40.603 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
24-Aug-2021 14:50:40.603 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk-10.0.2
24-Aug-2021 14:50:40.603 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 10.0.2+13
24-Aug-2021 14:50:40.603 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: "Oracle Corporation"
24-Aug-2021 14:50:40.603 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\Main\AppData\Local\JetBrains\IntelliJIdea2021.2\tomcat\f74e8856-a9b4-4e50-9d59-c901731f3dc7
24-Aug-2021 14:50:40.603 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\apache-tomcat-9.0.52
24-Aug-2021 14:50:40.604 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
24-Aug-2021 14:50:40.604 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
24-Aug-2021 14:50:40.604 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
24-Aug-2021 14:50:40.604 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
24-Aug-2021 14:50:40.604 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
24-Aug-2021 14:50:40.604 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\Main\AppData\Local\JetBrains\IntelliJIdea2021.2\tomcat\f74e8856-a9b4-4e50-9d59-c901731f3dc7\conf\logging.properties
24-Aug-2021 14:50:40.604 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
24-Aug-2021 14:50:40.604 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
24-Aug-2021 14:50:40.604 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
24-Aug-2021 14:50:40.605 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
24-Aug-2021 14:50:40.605 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.password.file=C:\Users\Main\AppData\Local\JetBrains\IntelliJIdea2021.2\tomcat\f74e8856-a9b4-4e50-9d59-c901731f3dc7\jmxremote.password
24-Aug-2021 14:50:40.605 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.access.file=C:\Users\Main\AppData\Local\JetBrains\IntelliJIdea2021.2\tomcat\f74e8856-a9b4-4e50-9d59-c901731f3dc7\jmxremote.access
24-Aug-2021 14:50:40.605 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
24-Aug-2021 14:50:40.605 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
24-Aug-2021 14:50:40.605 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
24-Aug-2021 14:50:40.605 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
24-Aug-2021 14:50:40.605 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\Main\AppData\Local\JetBrains\IntelliJIdea2021.2\tomcat\f74e8856-a9b4-4e50-9d59-c901731f3dc7
24-Aug-2021 14:50:40.605 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\apache-tomcat-9.0.52
24-Aug-2021 14:50:40.605 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\apache-tomcat-9.0.52\temp
24-Aug-2021 14:50:40.607 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [1.2.30] using APR version [1.7.0].
24-Aug-2021 14:50:40.607 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [true].
24-Aug-2021 14:50:40.607 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
24-Aug-2021 14:50:40.610 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1k 25 Mar 2021]
24-Aug-2021 14:50:40.750 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
24-Aug-2021 14:50:40.763 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [279] milliseconds
24-Aug-2021 14:50:40.804 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
24-Aug-2021 14:50:40.804 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.52]
24-Aug-2021 14:50:40.812 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
24-Aug-2021 14:50:40.823 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [59] milliseconds
Connected to server
[2021-08-24 02:50:41,210] Artifact myappname:war exploded: Artifact is being deployed, please wait...
24-Aug-2021 14:50:45.369 INFO [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[2021-08-24 02:50:45,523] Artifact myappname:war exploded: Artifact is deployed successfully
[2021-08-24 02:50:45,523] Artifact myappname:war exploded: Deploy took 4,313 milliseconds
24-Aug-2021 14:50:50.816 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\apache-tomcat-9.0.52\webapps\manager]
24-Aug-2021 14:50:50.851 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\apache-tomcat-9.0.52\webapps\manager] has finished in [35] ms
I want to run my app from the root: localhost:8080/.
Why I receive 404 - Not Found from Tomcat? And how to fix it?
If you need more details please tell me.
Version of Intellij IDEA: 2021.2 Ultimate Edition
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.5.3</version>
</dependency>
P.S.: I think something is not deployed right. Because after deploy, in console don't appears that big SPRING logo and logs about initializing. Or this is not necessarily?
I found the solution for my problem.
My problem was solved by removing everything from Run/Debug Configuration -> Before Launch
Also instead of what was there I added maven clean install command.
I have issue while deploying my Spring boot application in Linux server.
I built the project as war file and renamed it to ROOT.war.
After placing the ROOT.war in webapps folder and starting tomcat service, It got stuck at this stage and nothing happens.
09-Jan-2019 09:27:10.503 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/home/tomcat/webapps/ROOT.war]
I checked possible solution over web and also added the -Djava.security.egd=file:/dev/./urandom property.
I got dump from the jstack. But I am not able to understand what could be the issue here.
Here is the output after I started the tomcat server
09-Jan-2019 09:26:51.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.35
09-Jan-2019 09:26:52.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Nov 3 2018 17:39:20 UTC
09-Jan-2019 09:26:52.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.35.0
09-Jan-2019 09:26:52.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
09-Jan-2019 09:26:52.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-862.11.6.el7.x86_64
09-Jan-2019 09:26:52.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
09-Jan-2019 09:26:52.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/java/jdk1.8.0_191-amd64/jre
09-Jan-2019 09:26:52.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_191-b12
09-Jan-2019 09:26:52.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
09-Jan-2019 09:26:52.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/tomcat
09-Jan-2019 09:26:52.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /home/tomcat
09-Jan-2019 09:26:52.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/tomcat/conf/logging.properties
09-Jan-2019 09:26:52.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
09-Jan-2019 09:26:52.007 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
09-Jan-2019 09:26:52.007 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.security.egd=file:/dev/./urandom
09-Jan-2019 09:26:52.008 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
09-Jan-2019 09:26:52.008 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.security.egd=file:/dev/./urandom
09-Jan-2019 09:26:52.008 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
09-Jan-2019 09:26:52.008 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
09-Jan-2019 09:26:52.008 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms512M
09-Jan-2019 09:26:52.009 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx1024M
09-Jan-2019 09:26:52.009 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseParallelGC
09-Jan-2019 09:26:52.009 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
09-Jan-2019 09:26:52.010 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/tomcat
09-Jan-2019 09:26:52.010 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/home/tomcat
09-Jan-2019 09:26:52.011 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/tomcat/temp
09-Jan-2019 09:26:52.011 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
09-Jan-2019 09:27:00.000 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-80"]
09-Jan-2019 09:27:00.595 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Jan-2019 09:27:01.317 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
09-Jan-2019 09:27:01.576 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Jan-2019 09:27:01.577 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 31920 ms
09-Jan-2019 09:27:06.322 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
09-Jan-2019 09:27:06.322 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.35
09-Jan-2019 09:27:10.503 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/home/tomcat/webapps/ROOT.war]
For jstack logs, Please check here https://textuploader.com/1aoh0
UPDATE
<build> from pom.xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
I don't think this is anywhere related to running the war file as ROOT. You should be able to fix this issue by making one small change in catalina.sh
Open catalina.sh file in the bin folder of Tomcat.
Search for JAVA_OPTS and add the following,
-Djava.security.egd=file:/dev/./urandom
Eg:, JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom"
Save catalina.sh and restart tomcat.
Hopefully you should not face the same issue now.
We are migrating our application from tomcat 7 to tomcat 8. All wars are deploying successfully in tomcat 8. But only one war is not deploying. Tomcat 8 starts deploying the war and then stuck there. No logs are printing in Catalina.out and Error.log.
Please find below logs.
23-May-2018 04:14:55.314 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.31
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Apr 27 2018 20:24:25 UTC
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.31.0
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-693.21.1.el7.x86_64
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/java/jdk1.8.0_60/jre
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_60-b27
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /opt/apache-tomcat-8.5.31
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /opt/apache-tomcat-8.5.31
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
23-May-2018 04:14:55.330 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
23-May-2018 04:14:55.330 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
23-May-2018 04:14:55.330 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
23-May-2018 04:14:55.330 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
23-May-2018 04:14:55.330 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
23-May-2018 04:14:55.644 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
23-May-2018 04:14:55.675 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
23-May-2018 04:14:55.706 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
23-May-2018 04:14:55.708 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
23-May-2018 04:14:55.720 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1282 ms
23-May-2018 04:14:55.755 WARNING [main] org.apache.tomcat.jdbc.pool.ConnectionPool.checkPoolConfiguration maxIdle is smaller than minIdle, setting maxIdle to: 5
23-May-2018 04:14:57.653 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
23-May-2018 04:14:57.654 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.31
23-May-2018 04:14:57.711 INFO [localhost-startStop-1] **org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/apache-tomcat-8.5.31/webapps/llas.war]**
This is last line in Catalina.out.
In case you still need help.
If you are using a VM, try to set Djava.security.egd=file:/dev/./urandomns in the file setenv.sh
source:
https://serverfault.com/questions/658502/tomcat-8-hangs-on-startup-while-deploying-webapp-possibly-related-to-entropy-ge?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
I am trying to run Tomcat using NetBeans on Mac. When I execute startup.sh in bin folder and then access http://localhost:8080 everything looks great. Then I tried running my JAVA project in NetBeans, but it said that port 8080 is already in use. So I found which process is running on this port using lsof -i :8080 and killed it (or executed shutdown.sh in bin folder, it is the same).
Then I tried to run my project in NetBeans and after over 3 minutes of waiting it says this
.../WebApplication/nbproject/build-impl.xml:1045: Deployment error: Starting of Tomcat failed.
There is log:
09-Feb-2018 01:07:06.183 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/9.0.4
09-Feb-2018 01:07:06.196 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jan 18 2018 19:42:17 UTC
09-Feb-2018 01:07:06.199 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 9.0.4.0
09-Feb-2018 01:07:06.200 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Mac OS X
09-Feb-2018 01:07:06.201 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.13.1
09-Feb-2018 01:07:06.201 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: x86_64
09-Feb-2018 01:07:06.201 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre
09-Feb-2018 01:07:06.201 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_161-b12
09-Feb-2018 01:07:06.201 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
09-Feb-2018 01:07:06.201 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /Users/patrikbujna/lib/Apache-Tomcat-Netbeans/9.0.4
09-Feb-2018 01:07:06.202 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /Users/patrikbujna/lib/apache-tomcat-9.0.4
09-Feb-2018 01:07:06.203 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/Users/patrikbujna/lib/Apache-Tomcat-Netbeans/9.0.4/conf/logging.properties
09-Feb-2018 01:07:06.203 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
09-Feb-2018 01:07:06.203 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.nonProxyHosts=localhost|127.0.0.1|Patriks-MacBook-Pro.local
09-Feb-2018 01:07:06.204 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
09-Feb-2018 01:07:06.204 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
09-Feb-2018 01:07:06.205 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
09-Feb-2018 01:07:06.206 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/Users/patrikbujna/lib/Apache-Tomcat-Netbeans/9.0.4
09-Feb-2018 01:07:06.207 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/Users/patrikbujna/lib/apache-tomcat-9.0.4
09-Feb-2018 01:07:06.208 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/Users/patrikbujna/lib/Apache-Tomcat-Netbeans/9.0.4/temp
09-Feb-2018 01:07:06.208 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/patrikbujna/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
09-Feb-2018 01:07:06.579 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
09-Feb-2018 01:07:06.619 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Feb-2018 01:07:06.637 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
09-Feb-2018 01:07:06.638 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Feb-2018 01:07:06.641 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1337 ms
09-Feb-2018 01:07:06.709 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
09-Feb-2018 01:07:06.709 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/9.0.4
09-Feb-2018 01:07:06.719 INFO [main] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [/Users/patrikbujna/lib/Apache-Tomcat-Netbeans/9.0.4/conf/Catalina/localhost/manager.xml]
09-Feb-2018 01:07:07.121 INFO [main] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [/Users/patrikbujna/lib/Apache-Tomcat-Netbeans/9.0.4/conf/Catalina/localhost/manager.xml] has finished in [401] ms
09-Feb-2018 01:07:07.121 INFO [main] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [/Users/patrikbujna/lib/Apache-Tomcat-Netbeans/9.0.4/conf/Catalina/localhost/ROOT.xml]
09-Feb-2018 01:07:07.142 INFO [main] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [/Users/patrikbujna/lib/Apache-Tomcat-Netbeans/9.0.4/conf/Catalina/localhost/ROOT.xml] has finished in [21] ms
09-Feb-2018 01:07:07.147 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
09-Feb-2018 01:07:07.156 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
09-Feb-2018 01:07:07.159 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 515 ms
Can you guys help me? I do not know what to solve this several days...
From the Comments:
In Netbeans, go to Tools -> Options -> and select No Proxy (if you're not behind the proxy server) - Shashanth
To resume this for both Mac OS and Windows:
on Mac: Go to Netbreans Preferences, and there choose "No Proxy".
on Windows, Go to Tools, then Options, and there choose "No Proxy".
I'm answering this so other users with the same problem can easily determine the answer that was provided.
You can try installing XAMPP for mac it explicitly runs the server for you to run your application or you can try with Apache Tomee server.
XAMPP: https://www.apachefriends.org/download.html
TOMEE: http://tomee.apache.org/downloads.html
I had the same problem.
What my problem was I was using wrong jdk version for netbeans. For example, I was using jdk version java-1.8 with netbeans 12. I changed the JDK version to the latest and tried running tomcat again and it started working.
It took me a week to figure this thing out. All the other options didn't work for me.
I had my tomcat working for my environment from eclipse working the other day. Today It is not even running the basic tomcat from the command line. Here is what I am getting
04-Aug-2017 10:08:41.397 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.45
04-Aug-2017 10:08:41.399 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 26 2017 20:06:07 UTC
04-Aug-2017 10:08:41.399 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.45.0
04-Aug-2017 10:08:41.399 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
04-Aug-2017 10:08:41.399 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
04-Aug-2017 10:08:41.400 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
04-Aug-2017 10:08:41.400 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk1.8.0_141\jre
04-Aug-2017 10:08:41.400 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_141-b15
04-Aug-2017 10:08:41.400 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
04-Aug-2017 10:08:41.400 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\apache-tomcat-8.0.45
04-Aug-2017 10:08:41.400 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\apache-tomcat-8.0.45
04-Aug-2017 10:08:41.401 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\apache-tomcat-8.0.45\conf\logging.properties
04-Aug-2017 10:08:41.401 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
04-Aug-2017 10:08:41.401 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
04-Aug-2017 10:08:41.401 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
04-Aug-2017 10:08:41.401 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:\apache-tomcat-8.0.45\endorsed
04-Aug-2017 10:08:41.401 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\apache-tomcat-8.0.45
04-Aug-2017 10:08:41.402 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\apache-tomcat-8.0.45
04-Aug-2017 10:08:41.403 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\apache-tomcat-8.0.45\temp
04-Aug-2017 10:08:41.404 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.12 using APR version 1.5.2.
04-Aug-2017 10:08:41.405 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
04-Aug-2017 10:08:41.927 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2k 26 Jan 2017)
04-Aug-2017 10:08:42.034 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
04-Aug-2017 10:08:42.044 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
04-Aug-2017 10:08:42.045 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 980 ms
04-Aug-2017 10:08:42.069 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
04-Aug-2017 10:08:42.070 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.45
04-Aug-2017 10:08:42.079 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.45\webapps\ROOT
04-Aug-2017 10:08:42.704 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
04-Aug-2017 10:08:42.805 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\apache-tomcat-8.0.45\webapps\ROOT has finished in 725 ms
04-Aug-2017 10:08:42.809 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
04-Aug-2017 10:08:42.821 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
04-Aug-2017 10:08:42.828 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 782 ms
I am getting a 404 error. I am using localhost8080
thanks for the help.