docker after run image 404. Tomcat - requested resource is not available - java

I need to collect a simple Java application on Tomcat in docker container, but after the launch we have error:
HTTP Status 404 - /docker-test-02-1.0-SNAPSHOT
type Status report
message /docker-test-02-1.0-SNAPSHOT
description The requested resource is not available.
Apache Tomcat/8.0.41
Project:
Dockerfile:
FROM tomcat:8.0.41-jre8
MAINTAINER Sergii D
# fixed path for copying
COPY docker-test-02-1.0-SNAPSHOT.war /usr/local/tomcat/webapps/ROOT.war
# Routine for me - optional for your case
EXPOSE 8080
# And run tomcat
CMD ["/usr/local/tomcat/bin/catalina.sh", "run"]
docker build -t yourname .
docker run --rm -it -p 8080:8080 yourname
user#pc MINGW64 /d/docker-dir
$ docker build -t hello-docker-01 .
Sending build context to Docker daemon 103.4 kB
Step 1/5 : FROM tomcat:8.0.41-jre8
---> f1fc1ce9e0ab
Step 2/5 : MAINTAINER Sergii D
---> Using cache
---> 538a59db8c27
Step 3/5 : COPY docker-test-02-1.0-SNAPSHOT.war /usr/local/tomcat/webapps/ROOT.w
ar
---> 3fdcd3813c43
Removing intermediate container af956ac954a9
Step 4/5 : EXPOSE 8080
---> Running in 7bef72073fa8
---> bc5e2f1a9bf1
Removing intermediate container 7bef72073fa8
Step 5/5 : CMD /usr/local/tomcat/bin/catalina.sh run
---> Running in c51d453b3752
---> f742d6cd3cf5
Removing intermediate container c51d453b3752
Successfully built f742d6cd3cf5
SECURITY WARNING: You are building a Docker image from Windows against a non-Win
dows Docker host. All files and directories added to build context will have '-r
wxr-xr-x' permissions. It is recommended to double check and reset permissions f
or sensitive files and directories.
user#pc MINGW64 /d/docker-dir
$ docker --rm -it -p 8080:8080 hello-docker-01
flag provided but not defined: --rm
See 'C:\Program Files\Docker Toolbox\docker.exe --help'.
user#pc MINGW64 /d/docker-dir
$ docker run --rm -it -p 8080:8080 hello-docker-01
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/java-8-openjdk-amd64/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin
/tomcat-juli.jar
31-Jan-2017 14:14:10.330 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Server version: Apache Tomcat/8.0.41
31-Jan-2017 14:14:10.344 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Server built: Jan 18 2017 22:19:39 UTC
31-Jan-2017 14:14:10.344 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Server number: 8.0.41.0
31-Jan-2017 14:14:10.344 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log OS Name: Linux
31-Jan-2017 14:14:10.344 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log OS Version: 4.4.43-boot2docker
31-Jan-2017 14:14:10.345 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Architecture: amd64
31-Jan-2017 14:14:10.346 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Java Home: /usr/lib/jvm/java-8-openjdk-amd64/jre
31-Jan-2017 14:14:10.346 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log JVM Version: 1.8.0_111-8u111-b14-2~bpo8+1-b14
31-Jan-2017 14:14:10.347 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log JVM Vendor: Oracle Corporation
31-Jan-2017 14:14:10.347 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log CATALINA_BASE: /usr/local/tomcat
31-Jan-2017 14:14:10.347 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log CATALINA_HOME: /usr/local/tomcat
31-Jan-2017 14:14:10.348 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tom
cat/conf/logging.properties
31-Jan-2017 14:14:10.348 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.Cl
assLoaderLogManager
31-Jan-2017 14:14:10.348 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
31-Jan-2017 14:14:10.349 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catali
na.webresources
31-Jan-2017 14:14:10.349 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Command line argument: -Djava.endorsed.dirs=/usr/local/tomcat/endorse
d
31-Jan-2017 14:14:10.349 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
31-Jan-2017 14:14:10.350 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
31-Jan-2017 14:14:10.350 INFO [main] org.apache.catalina.startup.VersionLoggerLi
stener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
31-Jan-2017 14:14:10.350 INFO [main] org.apache.catalina.core.AprLifecycleListen
er.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.10 using APR
version 1.5.1.
31-Jan-2017 14:14:10.351 INFO [main] org.apache.catalina.core.AprLifecycleListen
er.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters
[false], random [true].
31-Jan-2017 14:14:10.381 INFO [main] org.apache.catalina.core.AprLifecycleListen
er.initializeSSL OpenSSL successfully initialized (OpenSSL 1.1.0c 10 Nov 2016)
31-Jan-2017 14:14:10.748 INFO [main] org.apache.coyote.AbstractProtocol.init Ini
tializing ProtocolHandler ["http-apr-8080"]
31-Jan-2017 14:14:10.769 INFO [main] org.apache.coyote.AbstractProtocol.init Ini
tializing ProtocolHandler ["ajp-apr-8009"]
31-Jan-2017 14:14:10.772 INFO [main] org.apache.catalina.startup.Catalina.load I
nitialization processed in 2074 ms
31-Jan-2017 14:14:10.860 INFO [main] org.apache.catalina.core.StandardService.st
artInternal Starting service Catalina
31-Jan-2017 14:14:10.861 INFO [main] org.apache.catalina.core.StandardEngine.sta
rtInternal Starting Servlet Engine: Apache Tomcat/8.0.41
31-Jan-2017 14:14:10.958 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployWAR Deploying web application archive /usr/local/tomcat/webap
ps/ROOT.war
31-Jan-2017 14:14:11.884 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployWAR Deployment of web application archive /usr/local/tomcat/w
ebapps/ROOT.war has finished in 921 ms
31-Jan-2017 14:14:11.893 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deploying web application directory /usr/local/tomc
at/webapps/manager
31-Jan-2017 14:14:11.988 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deployment of web application directory /usr/local/
tomcat/webapps/manager has finished in 95 ms
31-Jan-2017 14:14:11.988 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deploying web application directory /usr/local/tomc
at/webapps/host-manager
31-Jan-2017 14:14:12.051 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deployment of web application directory /usr/local/
tomcat/webapps/host-manager has finished in 63 ms
31-Jan-2017 14:14:12.052 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deploying web application directory /usr/local/tomc
at/webapps/docs
31-Jan-2017 14:14:12.093 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deployment of web application directory /usr/local/
tomcat/webapps/docs has finished in 41 ms
31-Jan-2017 14:14:12.101 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deploying web application directory /usr/local/tomc
at/webapps/examples
31-Jan-2017 14:14:12.812 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deployment of web application directory /usr/local/
tomcat/webapps/examples has finished in 712 ms
31-Jan-2017 14:14:12.823 INFO [main] org.apache.coyote.AbstractProtocol.start St
arting ProtocolHandler ["http-apr-8080"]
31-Jan-2017 14:14:12.839 INFO [main] org.apache.coyote.AbstractProtocol.start St
arting ProtocolHandler ["ajp-apr-8009"]
31-Jan-2017 14:14:12.844 INFO [main] org.apache.catalina.startup.Catalina.start
Server startup in 2071 ms
Then I open the link in a browser
http://192.168.99.100:8080/docker-test-02-1.0-SNAPSHOT
and I see an errorThe requested resource is not available.
How can I fix that?
PS: If open 192.168.99.100:8080 there will be sample TomCat page, so all ok with TomCat
.png

You are copying your war file as Root. war when you copy it in docker file. Copy it as /usr/local/tomcat/webapps/ instead. Or try with context ROOT.

Related

How do I automatically execute war files at Jenkins?

I am going to use Jenkins to execute the project automatically. The project is uploaded to github and succeeded in building War files using Jenkins. War file were moved to Tomcat's Webapps file, and Tomcat built it, but Tomcat runs properly, but projects don't run the project.
Setting
init_server.sh
echo "> Check the currently running spring server pid "
CURRENT_PID=$(ps -ef | grep java | grep tomcat | awk '{print $2}')
echo "$CURRENT_PID"
if [ -z $CURRENT_PID ]; then
echo "> No applications are currently running and will not be shut down."
else
echo "> kill -9 $CURRENT_PID"
kill -9 $CURRENT_PID
sleep 10
fi
rm -rf /usr/local/tomcat9/webapps/ji**t /usr/local/tomcat9/webapps/ji**t .war
echo nohup mv /root/jenkinsproject/deploy/*.war /usr/local/tomcat9/webapps/jinheeproject.war >> /root/jenkinsproject/logs/springtestprojectSys.log &
mv /root/jenkinsproject/deploy/*.war /usr/local/tomcat9/webapps/ji**t.war
sleep 10
cd /usr/local/tomcat9/bin
./startup.sh
echo "Execution complete."
application.yml
Run build in Jenkins, Follow the instructions in the Shell file, turn off the old Tomcat, and run the new Tomcat. And I type 'serverIP:8080' and the Tomcat server starts. But if I type 'serverIP:8080/helloworld', I see 404 error.
NOTE: I tested my project in the local environment. It was successful.
example: localhost:8080/helloworld
server.xml in cloud server
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true" >
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
<Context path="" docBase="ji**t" reloadable="false" />
</Host>
my catalina logs
03-Mar-2020 16:55:23.226 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.31
03-Mar-2020 16:55:23.229 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Feb 5 2020 19:32:12 UTC
03-Mar-2020 16:55:23.230 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.31.0
03-Mar-2020 16:55:23.230 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
03-Mar-2020 16:55:23.230 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.4.0-59-generic
03-Mar-2020 16:55:23.230 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
03-Mar-2020 16:55:23.230 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-8-openjdk-amd64/jre
03-Mar-2020 16:55:23.231 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_242-8u242-b08-0ubuntu3~16.04-b08
03-Mar-2020 16:55:23.231 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Private Build
03-Mar-2020 16:55:23.232 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat9
03-Mar-2020 16:55:23.232 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat9
03-Mar-2020 16:55:23.233 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat9/conf/logging.properties
03-Mar-2020 16:55:23.233 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
03-Mar-2020 16:55:23.233 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
03-Mar-2020 16:55:23.233 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
03-Mar-2020 16:55:23.234 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
03-Mar-2020 16:55:23.234 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
03-Mar-2020 16:55:23.234 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat9
03-Mar-2020 16:55:23.234 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat9
03-Mar-2020 16:55:23.235 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat9/temp
03-Mar-2020 16:55:23.235 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/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
03-Mar-2020 16:55:23.451 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
03-Mar-2020 16:55:23.498 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [518] milliseconds
03-Mar-2020 16:55:23.528 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
03-Mar-2020 16:55:23.528 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.31]
03-Mar-2020 16:55:27.202 INFO [main] 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.
03-Mar-2020 16:55:27.296 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat9/webapps/host-manager]
03-Mar-2020 16:55:27.328 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat9/webapps/host-manager] has finished in [31] ms
03-Mar-2020 16:55:27.328 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat9/webapps/manager]
03-Mar-2020 16:55:27.352 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat9/webapps/manager] has finished in [24] ms
03-Mar-2020 16:55:27.352 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat9/webapps/ROOTBEFORE]
03-Mar-2020 16:55:27.365 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat9/webapps/ROOTBEFORE] has finished in [12] ms
03-Mar-2020 16:55:27.365 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat9/webapps/docs]
03-Mar-2020 16:55:27.379 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat9/webapps/docs] has finished in [14] ms
03-Mar-2020 16:55:27.383 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
03-Mar-2020 16:55:27.391 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [3,892] milliseconds
There was something I was missing. I forgot to inherit SpringBootServletInitializer and set it up.
application.java
#SpringBootApplication
public class Application extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

NetBeans can not start Tomcat on mac

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.

Could not contact localhost:8005. Tomcat may not be running error while shutdown tomcat

Hi I am trying to shutdown and startup tomcat server. But i am getting below error while running shutdown.sh. Please check below error and suggest me to complete.
Error:
Using CATALINA_BASE: /opt/tomcat8
Using CATALINA_HOME: /opt/tomcat8
Using CATALINA_TMPDIR: /opt/tomcat8/temp
Using JRE_HOME: /usr/java/jdk1.8.0_74
Using CLASSPATH: /opt/tomcat8/bin/bootstrap.jar:/opt/tomcat8/bin/tomcat-ju li.jar
Jul 24, 2017 11:01:47 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact localhost:8005. Tomcat may not be running.
Jul 24, 2017 11:01:48 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.ja va:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocket Impl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java :188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
Also please find log:
24-Jul-2017 23:48:28.884 SEVERE [main] org.apache.catalina.core.StandardServer.await StandardServer.await: create[localhost:8005]:
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:420)
at org.apache.catalina.startup.Catalina.await(Catalina.java:717)
at org.apache.catalina.startup.Catalina.start(Catalina.java:663)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
24-Jul-2017 23:48:28.884 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8082"]
24-Jul-2017 23:48:28.884 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
24-Jul-2017 23:48:28.884 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
24-Jul-2017 23:48:28.988 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8082"]
24-Jul-2017 23:48:28.990 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8082"]
24-Jul-2017 23:48:28.992 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
24-Jul-2017 23:48:28.992 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
There is some Application running on port 8005 due to which tomcat is not able to bind network on the port. Your shutdown.sh will throw exception because server is not started yet (as there was an issue in starting the server)
Solution 1(Recommended): Change the port from 8005 to 8006 in /opt/tomcat8/conf/server.xml
Solution 2: Please check which application is using 8005 by netstat -tulnp | grep 8005 and turn it off.
if the timestamps are correct, it suggests that your tomcat startup failed around 23:00 and you tried to shutdown a non existing tomcat service at 11:00 hours
You can try to add
export JRE_HOME=$JAVA_HOME/jre
in /etc/profile,then run
source /etc/profile
it is avalible for me.
http://blog.51cto.com/zero01/2053974. I meet the same problem today. When i want to execute shudown.sh, the log shows that tomcat may not be running, and the connection to port 8005 is refused. When i use netstat -atunp, i find there is no process listening port 8005. So tomcat should fail to start. I search,and find the answer in the link showed below. The key is to change $JAVA_HOME/jre/lib/security/java.security. The data to change is to add char 'u' before 'random':
securerandom.source=file:/dev/urandom
Or set -Dsecurerandom.source=file:/dev/./urandom in Tomcat's CATALINA_OPTS.
and it works. This helps in a specific scenario of an incomplete Tomcat start up resulting from some operation blocking in '/dev/random' reads in the event of low system entropy. The Tomcat shutdown port is only listening after a full start up, so if a start attempt hangs in a '/dev/random' read or due to any other issue, the shutdown port is not listening and a shutdown attempt relying on it fails with the connection refused error. If start up hangs in '/dev/random', then the urandom change addresses this as /dev/urandom never blocks and hangs waiting for system entropy.
A CATALINA_PID may be set to shutdown Tomcat using a pid file and OS signal without issue in this event instead of the shutdown port.
try to start from ./catalina.sh run
is every thing is ok then it will come on screen
or it will show some error
like in my case
[root#localhost bin]# ./catalina.sh run
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
Invalid maximum heap size: -Xmx512MB
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
change memory heap size then it will definately work
[root#localhost bin]# ./catalina.sh run
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
10-Oct-2017 02:28:13.782 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.23
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Sep 28 2017 10:30:11 UTC
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.23.0
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-123.el7.x86_64
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /root/Desktop/jdk1.8.0_144/jre
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_144-b01
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
10-Oct-2017 02:28:13.810 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.810 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.810 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/root/Desktop/tomcat/apache-tomcat-8.5.23/conf/logging.properties
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.812 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/root/Desktop/tomcat/apache-tomcat-8.5.23/temp
10-Oct-2017 02:28:13.812 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]
10-Oct-2017 02:28:15.306 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:28:15.518 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
10-Oct-2017 02:28:15.551 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:28:15.558 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
10-Oct-2017 02:28:15.568 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 4756 ms
10-Oct-2017 02:28:15.869 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
10-Oct-2017 02:28:15.870 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.23
10-Oct-2017 02:28:16.072 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/ROOT]
10-Oct-2017 02:28:18.435 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/ROOT] has finished in [2,362] ms
10-Oct-2017 02:28:18.436 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/docs]
10-Oct-2017 02:28:18.540 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/docs] has finished in [89] ms
10-Oct-2017 02:28:18.541 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/examples]
10-Oct-2017 02:28:20.151 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/examples] has finished in [1,611] ms
10-Oct-2017 02:28:20.152 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/host-manager]
10-Oct-2017 02:28:20.320 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/host-manager] has finished in [168] ms
10-Oct-2017 02:28:20.321 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/manager]
10-Oct-2017 02:28:20.438 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/manager] has finished in [117] ms
10-Oct-2017 02:28:20.461 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:28:20.540 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:28:20.547 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 4978 ms
^C10-Oct-2017 02:29:29.604 INFO [Thread-5] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:29:29.695 INFO [Thread-5] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:29:29.748 INFO [Thread-5] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
10-Oct-2017 02:29:30.063 INFO [Thread-5] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:29:30.069 INFO [Thread-5] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:29:30.077 INFO [Thread-5] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:29:30.094 INFO [Thread-5] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
[root#localhost bin]# ./startup.sh
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
Tomcat started.
then again try to shutdown
from /bin# ./shutdown
[root#localhost bin]# ./shutdown.sh
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
good luck

IntelliJ IDEA: Tomcat 8.5.13 and 9.0.0.M19 — Error during artifact deployment. See server log for details

I can't understand what happened. There was no problem 2 days ago and now I can't deploy my applications. Any of it. The only thing I've done regarding network was plugging my laptop in other socket in the house using ethernet wire, nothing else. I tried almost every solution I found here and nothing helped.
Logs:
C:\servers\apache-tomcat-8.5.13\bin\catalina.bat run
[2017-04-11 06:19:51,636] Artifact TestJEE:war exploded: Server is not connected. Deploy is not available.
Using CATALINA_BASE: "C:\Users\wojci\.IntelliJIdea2016.3\system\tomcat\Tomcat_8_5_13_TestJEE"
Using CATALINA_HOME: "C:\servers\apache-tomcat-8.5.13"
Using CATALINA_TMPDIR: "C:\servers\apache-tomcat-8.5.13\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_112"
Using CLASSPATH: "C:\servers\apache-tomcat-8.5.13\bin\bootstrap.jar;C:\servers\apache-tomcat-8.5.13\bin\tomcat-juli.jar"
11-Apr-2017 18:19:54.084 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.13
11-Apr-2017 18:19:54.087 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Mar 27 2017 14:25:04 UTC
11-Apr-2017 18:19:54.087 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.13.0
11-Apr-2017 18:19:54.088 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
11-Apr-2017 18:19:54.088 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
11-Apr-2017 18:19:54.088 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
11-Apr-2017 18:19:54.088 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk1.8.0_112\jre
11-Apr-2017 18:19:54.088 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_112-b15
11-Apr-2017 18:19:54.089 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
11-Apr-2017 18:19:54.089 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\wojci\.IntelliJIdea2016.3\system\tomcat\Tomcat_8_5_13_TestJEE
11-Apr-2017 18:19:54.090 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\servers\apache-tomcat-8.5.13
11-Apr-2017 18:19:54.090 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\wojci\.IntelliJIdea2016.3\system\tomcat\Tomcat_8_5_13_TestJEE\conf\logging.properties
11-Apr-2017 18:19:54.090 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
11-Apr-2017 18:19:54.091 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
11-Apr-2017 18:19:54.091 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
11-Apr-2017 18:19:54.091 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
11-Apr-2017 18:19:54.091 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
11-Apr-2017 18:19:54.092 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
11-Apr-2017 18:19:54.092 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
11-Apr-2017 18:19:54.092 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
11-Apr-2017 18:19:54.092 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\wojci\.IntelliJIdea2016.3\system\tomcat\Tomcat_8_5_13_TestJEE
11-Apr-2017 18:19:54.092 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\servers\apache-tomcat-8.5.13
11-Apr-2017 18:19:54.092 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\servers\apache-tomcat-8.5.13\temp
11-Apr-2017 18:19:54.093 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.12 using APR version 1.5.2.
11-Apr-2017 18:19:54.093 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
11-Apr-2017 18:19:54.093 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
11-Apr-2017 18:19:55.187 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2k 26 Jan 2017)
11-Apr-2017 18:19:55.560 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
11-Apr-2017 18:19:55.691 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
11-Apr-2017 18:19:55.745 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
11-Apr-2017 18:19:55.763 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
11-Apr-2017 18:19:55.802 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 2418 ms
11-Apr-2017 18:19:55.982 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
11-Apr-2017 18:19:55.983 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.13
11-Apr-2017 18:19:56.185 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
11-Apr-2017 18:19:56.250 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
11-Apr-2017 18:19:56.382 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 578 ms
[2017-04-11 06:19:56,404] Artifact TestJEE:war exploded: Artifact is being deployed, please wait...
Connected to server
[2017-04-11 06:19:56,493] Artifact TestJEE:war exploded: Error during artifact deployment. See server log for details.
11-Apr-2017 18:20:06.205 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\wojci\.IntelliJIdea2016.3\system\tomcat\Tomcat_8_5_13_TestJEE\conf\Catalina\localhost\ROOT.xml
11-Apr-2017 18:20:06.968 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\wojci\.IntelliJIdea2016.3\system\tomcat\Tomcat_8_5_13_TestJEE\conf\Catalina\localhost\ROOT.xml has finished in 762 ms
11-Apr-2017 18:20:06.973 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\servers\apache-tomcat-8.5.13\webapps\manager
11-Apr-2017 18:20:07.084 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\servers\apache-tomcat-8.5.13\webapps\manager has finished in 112 ms
Disconnected from server
When i attempt to connect to "localhost:8080" i get a message about connection being REJECTED and "Disconnected from server" message in logs.
There is nothing useful in the logs (no warnings/errors).
This issue is in EVERY of my JEE applications.
As I said a tried many solutions from here EXCEPT the one with changing the value of %JAVA_OPTS% env var because I've got no 'setenv.bat' file anywhere in Tomcat directory and in Catalina.bat this variable seems to be set properly.
I'm quite new to this kind of technology and I am a little afraid to start tweaking around in stuff I don't know.
What could be causing this issue? What are the possible solutions?
There appears to a be a deployment issue with the most recent Tomcat versions from IntelliJ IDEA. We have an open bug for that with the patched files attached that you can use to workaround the problem:
IDEA-171174 Tomcat 9.0.0.M19: failed to deploy simple WAR artifact
You can find the patched jar of IntelliJ IDEA Tomcat plug-in, replace <IDEA_HOME>/plugins/Tomcat/lib/tomcatIntegration.jar with it.
The original issue is caused by this Tomcat bug:
Bug 60949 - unable to deploy/undeploy war file using the manager
This bug is resolved in the following Tomcat versions:
8.5.14 and later
9.0.0.M20 and later
It's recommended to either wait for/install the fixed Tomcat versions or to revert back to the versions which are not affected by the bug (5.8.12 and 9.0.0.M18), since the workaround for IntelliJ IDEA uses some dirty hacks to make it work with Tomcat 5.8.13 and 9.0.0.M19 which are affected by Bug 60949 (broken JMX).
I was using Spring application and deploying with Tomcat. What was solved my problem is to put this annotation to SpringApplication class which app starts from that class.
#SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
The issue got fixed for me by downgrading IntelliJ to 2019.2.4

Can't deploy war on Tomcat

I've a Spring Messaging app that I've developed inside of eclipse using a local instance of Tomcat 8. This works perfectly fine from inside eclipse, however when I create a war and deploy it inside the webapps directory of Tomcat it doesn't work.
These are the steps that I've done till now.
I'm using a gradle build system, on a windows machine. Thus I ran gradlew build.
This generated a war file inside root/build/lib
I went to the bin directory of my local tomcat and ran start.bat
This set Tomcat running, then I copied the war to the webapps directory of tomcat.
All I get is a 404.
This is my catalina.log
07-Sep-2016 10:32:21.857 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.36
07-Sep-2016 10:32:21.858 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 9 2016 13:55:50 UTC
07-Sep-2016 10:32:21.859 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.36.0
07-Sep-2016 10:32:21.859 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 8.1
07-Sep-2016 10:32:21.859 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 6.3
07-Sep-2016 10:32:21.859 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
07-Sep-2016 10:32:21.859 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk1.8.0_91\jre
07-Sep-2016 10:32:21.859 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_91-b14
07-Sep-2016 10:32:21.860 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
07-Sep-2016 10:32:21.860 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Tomcat\v8\apache-tomcat-8.0.36
07-Sep-2016 10:32:21.860 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\Tomcat\v8\apache-tomcat-8.0.36
07-Sep-2016 10:32:21.860 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
07-Sep-2016 10:32:21.860 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Tomcat\v8\apache-tomcat-8.0.36\conf\logging.properties
07-Sep-2016 10:32:21.860 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
07-Sep-2016 10:32:21.861 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:\Tomcat\v8\apache-tomcat-8.0.36\endorsed
07-Sep-2016 10:32:21.861 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Tomcat\v8\apache-tomcat-8.0.36
07-Sep-2016 10:32:21.861 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Tomcat\v8\apache-tomcat-8.0.36
07-Sep-2016 10:32:21.862 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Tomcat\v8\apache-tomcat-8.0.36\temp
07-Sep-2016 10:32:21.862 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: C:\Program Files\Java\jdk1.8.0_91\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\AccuRev\bin;C:\common;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;%MAVEN_HOME/bin%;C:\Program Files\Apache\apache-maven-3.3.9\bin;C:\Dev\gradle-2.13\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Users\SG047329\AppData\Roaming\npm;.
07-Sep-2016 10:32:22.029 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
07-Sep-2016 10:32:22.094 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
07-Sep-2016 10:32:22.096 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
07-Sep-2016 10:32:22.104 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
07-Sep-2016 10:32:22.105 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 524 ms
07-Sep-2016 10:32:22.130 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
07-Sep-2016 10:32:22.130 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.36
07-Sep-2016 10:32:22.223 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\opl-ws-webui-0.1.0.war
07-Sep-2016 10:32:29.090 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.
07-Sep-2016 10:32:33.793 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\opl-ws-webui-0.1.0.war has finished in 11,570 ms
07-Sep-2016 10:32:33.795 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\docs
07-Sep-2016 10:32:33.826 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\docs has finished in 30 ms
07-Sep-2016 10:32:33.826 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\examples
07-Sep-2016 10:32:34.734 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\examples has finished in 908 ms
07-Sep-2016 10:32:34.735 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\host-manager
07-Sep-2016 10:32:34.775 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\host-manager has finished in 40 ms
07-Sep-2016 10:32:34.776 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\manager
07-Sep-2016 10:32:34.811 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\manager has finished in 35 ms
07-Sep-2016 10:32:34.811 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\ROOT
07-Sep-2016 10:32:34.835 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Tomcat\v8\apache-tomcat-8.0.36\webapps\ROOT has finished in 24 ms
07-Sep-2016 10:32:34.839 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
07-Sep-2016 10:32:34.856 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
07-Sep-2016 10:32:34.871 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 12765 ms
I've a few questions here,
How do I deploy the war and get it to run inside Tomcat.
When I run inside eclipse, I don't see any war actually being created inside build/lib, so how is eclipse using Tomcat to run my webapp anyway?
1.- Actually the way yo start a clean Tomcat instance is:
Stop Tomcat Server
Clean logs, temp and work folders
Copy your .war file to the webapps folder
Start Tomcat
If this process does not work you can see the files generated in the tomcat logs files to see why this is not starting
2.- Eclipse as well as other IDE's like IDEA use directly the webapp, build folder of your application, not the .war file.
The war file contains inside this webapp folder which is unzipped when you start just tomcat.

Categories

Resources