Linux Centos6.8 安装配置Tomcat-7.0.79
程序员文章站
2024-03-11 10:36:37
...
1:下载Tomcat
wget http://apache.fayea.com/tomcat/tomcat-7/v7.0.79/bin/apache-tomcat-7.0.79.tar.gz
2:解压Tomcat
tar -xzvf apache-tomcat-7.0.79.tar.gz
3:配置开启8080端口
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
保存service iptables save
重启防火墙service iptables restart
你可能会遇到这些问题
1:在关闭Tomcat的时候遇到一个问题
SEVERE: Could not contact localhost:8005. Tomcat may not be running.
Jul 31, 2017 7:46:47 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.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)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:499)
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.stopServer(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430)
原因:8005端口没有启动 (其实是启动很慢 下边这篇文章有很详细的解释) 解决办法 打开$JAVA_HOME/jre/lib/security/Java.security这个文件,找到securerandom.source配置项 修改为 securerandom.source=file:/dev/./urandom
2:如果你是Centos7.0以上的版本 你的8080端口开启方式与这篇文章讲的不同
推荐你一篇文章 centos 7中防火墙配置