Tomcat starting but not serving default page on 8081 - linux

Tomcat starting but not serving default page on 8081.
Apache tomcat
Server version: Apache Tomcat/7.0.69
Server built: Aug 25 2016 13:23:17 UTC
Server number: 7.0.69.0
OS Name: Linux
OS Version: 3.10.0-514.2.2.el7.x86_64
Architecture: amd64
JVM Version: 1.8.0_111-b15
JVM Vendor: Oracle Corporation
JBoss and tomcat using the same default port 8080, decided to chage the tomcat port 8081 it is not serving the page when we access it: <server's IP>:8081, but when we do <server's IP>:8080 it is serving jboss page.

Related

Apache - High CPU usage after upgrading to Amazon Linux 2

Amazon Linux 1:
Server version: Apache/2.4.54 (Amazon)
Server built: Jul 11 2022 21:47:38
Server's Module Magic Number: 20120211:124
Server loaded: APR 1.6.3, APR-UTIL 1.5.4, PCRE 8.21 2011-12-12
PHP 7.3.30 (cli) (built: Oct 6 2021 20:34:22) ( NTS )
Amazon Linux 2:
Server version: Apache/2.4.54 ()
Server built: Jun 30 2022 11:02:23
Server's Module Magic Number: 20120211:124
Server loaded: APR 1.7.0, APR-UTIL 1.6.1, PCRE 8.32 2012-11-30
PHP 7.4.30 (cli) (built: Jun 23 2022 20:19:00) ( NTS )
The server's are configured via automation and loaded into ALB/ASG's.
Instance size is m4.large (2x vCPU, 8GiB Memory)
Auto-Scaling group is configured with Min:4 Max:8
This is what my httpd.conf file looks like:
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxConnectionsPerChild 4000
</IfModule>
On Amazon Linux 1, the site works as expected. The ASG spawns 4 instances and they each hover at 40-60% CPU utilization during peak hours.
The same build on Amazon Linux 2 yields wildly different results. All instances immediately get bombarded by a huge number of httpd processes.
The ASG scales up to 8 instances with every single one at 90%+ CPU usage. The instances start to lock up which causes the target group to mark them as "unhealthy" and the ASG to rotate them out endlessly. The website obviously does not work.
What could be causing them to behave so differently? What steps can I take to try and mitigate this? I'm honestly pretty new to all this so I don't know where to start.

docker networking not working after installing Docker Desktop in Ubuntu

after I installed Docker Desktop on my linux machine, my docker containers don't work any more. The containers can't communicate with each others or connect to the internet.
I found the Self-diagnose tool. And when running this I get:
➜ ~ /opt/docker-desktop/bin/com.docker.diagnose check
[2022-10-21T21:53:23.963576537Z][com.docker.diagnose][I] set path configuration to OnHost
Starting diagnostics
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0031: does the Docker API work?
[PASS] DD0013: is the $PATH ok?
[PASS] DD0034: is Context set to a Docker Desktop context?
[PASS] DD0003: is the Docker CLI working?
[FAIL] DD0014: are the backend processes running? 2 errors occurred:
* querying com.docker.backend process: is it running as a different user?: readlink /proc/22636/exe: permission denied
* querying com.docker.backend process: is it running as a different user?: readlink /proc/22654/exe: permission denied
[PASS] DD0007: is the backend responding?
[PASS] DD0008: is the native API responding?
[PASS] DD0009: is the vpnkit API responding?
[PASS] DD0010: is the Docker API proxy responding?
[FAIL] DD0012: is the VM networking working? network checks failed: failed to ping host: exit status 1
[2022-10-21T21:53:24.648095036Z][com.docker.diagnose][I] ipc.NewClient: 4c9ff8fa-diagnose-network -> diagnosticd.sock diagnosticsd
[common/pkg/diagkit/gather/diagnose.runIsVMNetworkingOK()
[ common/pkg/diagkit/gather/diagnose/network.go:34 +0xd9
[common/pkg/diagkit/gather/diagnose.(*test).GetResult(0x11754a0)
[ common/pkg/diagkit/gather/diagnose/test.go:46 +0x43
[common/pkg/diagkit/gather/diagnose.Run.func1(0x11754a0)
[ common/pkg/diagkit/gather/diagnose/run.go:17 +0x5a
[common/pkg/diagkit/gather/diagnose.walkOnce.func1(0x2?, 0x11754a0)
[ common/pkg/diagkit/gather/diagnose/run.go:142 +0x77
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x1, 0x11754a0, 0xc000223728)
[ common/pkg/diagkit/gather/diagnose/run.go:151 +0x87
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x0, 0x11755a0, 0xc000223728)
[ common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkOnce(0xb0fde0?, 0xc00035f890)
[ common/pkg/diagkit/gather/diagnose/run.go:137 +0xcc
[common/pkg/diagkit/gather/diagnose.Run(0x11755a0, 0x7fbd50ef6300?, {0xc00035fb20, 0x1, 0x1})
[ common/pkg/diagkit/gather/diagnose/run.go:16 +0x1d4
[main.checkCmd({0xc00012e010?, 0x6?, 0x4?}, {0x0, 0x0})
[ common/cmd/com.docker.diagnose/main.go:133 +0x105
[main.main()
[ common/cmd/com.docker.diagnose/main.go:99 +0x2a7
[2022-10-21T21:53:24.648917178Z][com.docker.diagnose][I] (c88fef01) 4c9ff8fa-diagnose-network C->S diagnosticsd POST /check-network-connectivity: {"ips":["169.254.5.211","169.254.5.199","192.168.86.22"]}
[2022-10-21T21:53:25.180233483Z][com.docker.diagnose][W] (c88fef01) 4c9ff8fa-diagnose-network C<-S d6792b26-diagnosticsd POST /check-network-connectivity (531.701612ms): failed to ping host: exit status 1
[SKIP] DD0030: is the image access management authorized?
[PASS] DD0037: is the virtiofs setup correct?
[PASS] DD0036: is the credentials store configured correctly?
[PASS] DD0033: does the host have Internet access?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0031: does the Docker API work?
[PASS] DD0032: do Docker networks overlap with host IPs?
Please investigate the following 2 issues:
1 : The test: are the backend processes running?
Failed with: 2 errors occurred:
* querying com.docker.backend process: is it running as a different user?: readlink /proc/22636/exe: permission denied
* querying com.docker.backend process: is it running as a different user?: readlink /proc/22654/exe: permission denied
Not all of the backend processes are running.
2 : The test: is the VM networking working?
Failed with: network checks failed: failed to ping host: exit status 1
VM seems to have a network connectivity issue. Check your host firewall and anti-virus settings in case they are blocking the VM.
Docker version:
➜ ~ docker version
Client: Docker Engine - Community
Cloud integration: v1.0.29
Version: 20.10.20
API version: 1.41
Go version: go1.18.7
Git commit: 9fdeb9c
Built: Tue Oct 18 18:20:18 2022
OS/Arch: linux/amd64
Context: desktop-linux
Experimental: true
Server: Docker Desktop 4.13.0 (89412)
Engine:
Version: 20.10.20
API version: 1.41 (minimum version 1.12)
Go version: go1.18.7
Git commit: 03df974
Built: Tue Oct 18 18:18:35 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
The issues are right there, but I have no clue on how to fix this.

mod_jk not able to connect Apache and tomcat

I am not able to connect my Apache to tomcat servers. Below are the version details.
mod_jk/1.2.39
Apache-2.4.41
tomcat-9.0.31
I have created Workers.properties file and mentioned my hostname and AJP port i.e. 8009 and also enabled Ajp connectors from tomcat side. Issue I am facing is mod_jk is not connecting to host that I have provided in workers.properties file. Instead of that it is connecting to 0.0.0.0. Below is the error from mod_jk.log
[Wed May 27 12:52:00 2020] [6902:140379841652544] [info] init_jk::mod_jk.c (3383): mod_jk/1.2.39 initialized
[Wed May 27 12:52:00 2020] [6903:140379841652544] [info] init_jk::mod_jk.c (3383): mod_jk/1.2.39 initialized
[Wed May 27 12:53:20 2020] [6906:140379663890176] [info] jk_open_socket::jk_connect.c (735): connect to 0.0.0.0:8009 failed (errno=111)
[Wed May 27 12:53:20 2020] [6906:140379663890176] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1019): Failed opening socket to (0.0.0.0:8009) (errno=111)
[Wed May 27 12:53:20 2020] [6906:140379663890176] [error] ajp_send_request::jk_ajp_common.c (1659): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
I have checked I can access my tomcat servers and it's running fine. Below is the Ajp connectors from tomcat server
<Connector protocol="AJP/1.3"
address="::1"
port="8009"
redirectPort="8443" />
Is there anything I am missing or is it some kind of fat bug involve with this version of mod_jk?
Any kind of Suggestion and Help will be appreciated.
Thanks,
Anshu
Start tomcat server on IP address instead of 0.0.0.0.
<Connector protocol="AJP/1.3"
address="IP-address"
port="8009"
redirectPort="8443" />
Use tomcat-adress and Port in worker.properties. Restart tomcat and Apache service. Also make sure that port 8009 is open between Apache and tomcat server.

JBOSS not running

I'm from Linux server background and very new to JBOSS. I'm trying to setup a IoT application server which requires JBOSS service to provide
a web interface for the application server.
But when i check the JBOSS server state it is showing 'starting', i need this to be 'running'.
# /opt/cgms/bin/jboss-cli.sh --connect controller=127.0.0.1 ":read- attribute(name=server-state)"
{
"outcome" => "success",
"result" => "starting"
}
I can see that the deployment is getting failed when i start JBOSS using the script standalone.sh. I've increased the deployment-timeout
up to 6000 seconds in standalone.xml, still the deployment is failing with the following message in /opt/cgms/standalone/deployments/cgms.ear.failed,
""JBAS015052: Did not receive a response to the deployment operation within the allowed timeout period [6000 seconds].
Check the server configuration file and the server logs to find more about the status of the deployment."
Here is my JBOSS setup details,
[root#app-server ~]# /opt/cgms/bin/jboss-cli.sh --connect
[standalone#localhost:9999 /] version
JBoss Admin Command-line Interface
JBOSS_HOME: /opt/cgms
JBoss AS release: 7.3.0.Final-redhat-14 "Janus"
JBoss AS product: EAP 6.2.0.GA
JAVA_HOME: null
java.version: 1.8.0_65
java.vm.vendor: Oracle Corporation
java.vm.version: 25.65-b01
os.name: Linux
os.version: 3.10.0-229.el7.x86_64
When i check the server.log, it is stuck at,
# tailf /opt/cgms/server/cgms/log/server.log
624: app-server: Aug 12 2017 05:45:01.506 +0000: %IOTFND-6-UNSPECIFIED: %[ch=StdSchedulerFactory][sev=INFO][tid=MSC service thread 1-1]: Quartz scheduler 'CgnmsQuartz' initialized from an externally provided properties instance.
625: app-server: Aug 12 2017 05:45:01.506 +0000: %IOTFND-6-UNSPECIFIED: %[ch=StdSchedulerFactory][sev=INFO][tid=MSC service thread 1-1]: Quartz scheduler version: 2.2.1
It will not go further from here.
I've tried with java 1.7, but the script standalone.sh failed with a java error,
java.lang.UnsupportedClassVersionError: com/cisco/cgms/loglayout/LogHandler : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:345)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:423)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76)
Here are my server details,
OS - Red Hat Enterprise Linux Server release 7.1 (Maipo) - runs on Oracle VM VirtualBox
kernel - app-server 3.10.0-229.el7.x86_64 #1 SMP Thu Jan 29 18:37:38 EST 2015 x86_64 x86_64 x86_64 GNU/Linux
When i check netstat, port 80 and 443 are listening.
Please help to fix this problem.

UWSGI https configuration for ubuntu

I have django app that is running using the following uwsgi configuration in redhat 7.3:
[uwsgi]
project = helloworld
base = %d
chdir=%(base)
module=helloworld.wsgi:application
plugins = router_redirect
route-if = equal:${HTTPS};on addheader:Strict-Transport-Security: max-age=31536000
master = true
processes = 1
enable-threads = true
threads = 1
max-requests = 2000
shared-socket = 0.0.0.0:443
https = =0,cert/hello.crt,cert/hello.key,HIGH
pidfile = hello_uwsgi.pid
vacuum = true
die-on-term = true
However, when I run it on Ubuntu 16.04.1 LTS, I got the following error:
your processes number limit is 31283
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
Python version: 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609]
Python main interpreter initialized at 0x1dfabe0
python threads support enabled
The -s/--socket option is missing and stdin is not a socket.
VACUUM: pidfile removed.
Does the error means that uwsgi fail to bind the port?
Is there a special way of using "shared-socket" in ubuntu?
I need to have this running on both port 443 and 8443. I have tried the above configuration for both port 443 and 8443 without success.
Thanks in advance.
I got this to work in ubuntu by reinstalling the python 3.5.2 from source.
I am guessing that there is some issue/incompatibility installing python 3.5.2 using apt-get.

Resources