Jetty is throwing `Unknown module' error when running with --add-to-start - jetty

I am trying to configure Jetty and facing this:
root#jans-dev:~/jetty-base# java -jar $JETTY_HOME/start.jar --add-to-start=http,deploy
ERROR : Unknown module='http'. List available with --list-modules
Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs]
java -jar $JETTY_HOME/start.jar --help # for more information
Background:
Jetty 9.4 installed as root on an lxc container on Ubuntu using sudo apt install jetty9
Jetty service is running and I can access default landing page
Jetty home is set to export JETTY_HOME=/usr/share/jetty
Jetty base is set to export JETTY_BASE=/root/jetty-base
I have executed below command successfully before trying to add modules.
root#jans-dev:~/jetty-base# java -jar $JETTY_HOME/start.jar --create-startd
MKDIR : ${jetty.base}/start.d
INFO : Base directory was modified
Also, when I run --list-modules, it is coming up empty:
root#jans-dev:~/jetty-base# java -jar $JETTY_HOME/start.jar --list-modules
Available Modules:
==================
tags: [-internal]
Enabled Modules:
================
root#jans-dev:~/jetty-base#
I am not sure what am I missing here. How do I make modules available to Jetty? I have also checked this reference

Sounds like your linux distro has mangled the jetty distribution.
Does your /usr/share/jetty directory contain the directories etc/, lib/, and modules/? If not, then that's not a valid ${jetty-home}.
Perhaps your linux distribution put the jetty-home somewhere else?
But that would also be invalid, as the start.jar should be in the same directory as those other directories.
Example of what a proper ${jetty.home} looks like ...
$ ls -la jetty-home-9.4.44.v20210927
total 776
drwxr-xr-x 6 joakim joakim 4096 Sep 27 18:12 ./
drwxr-xr-x 74 joakim joakim 12288 Nov 2 15:32 ../
drwxr-xr-x 2 joakim joakim 4096 Oct 7 10:07 bin/
drwxr-xr-x 4 joakim joakim 4096 Oct 14 07:17 etc/
drwxr-xr-x 14 joakim joakim 4096 Oct 7 10:07 lib/
-rw-r--r-- 1 joakim joakim 30012 Sep 27 18:12 license-eplv10-aslv20.html
drwxr-xr-x 22 joakim joakim 4096 Oct 7 10:07 modules/
-rw-r--r-- 1 joakim joakim 6262 Sep 27 18:12 notice.html
-rw-r--r-- 1 joakim joakim 163958 Sep 27 18:10 start.jar
-rw-r--r-- 1 joakim joakim 550572 Sep 27 17:44 VERSION.txt
In the past, there were Linux Distributions that tried to put the various Jetty libs (The jar files in ${jetty.home}/lib/) in their distribution setup as separate dependencies, but that's not a valid setup for a modular Servlet/Web Container like Jetty. Most distributions have realized this and have reverted to a sane setup now.
The fastest fix for you is to remove this bad Jetty package from your linux distribution and just download and use the official tarball.
https://search.maven.org/artifact/org.eclipse.jetty/jetty-home
https://www.eclipse.org/jetty/download.php

Related

Incompatible version of OpenSSL on Fedora Linux

Am struggling to use ssl with QWebSocket. Get the following error messages:
QML debugging is enabled. Only use this in a safe environment.
qt.tlsbackend.ossl: Incompatible version of OpenSSL (built with OpenSSL 1.x, runtime version is >= 3.x)
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
WSInterface::onError(): Got the web-socket connection error: QAbstractSocket::UnsupportedSocketOperationError
Using Qt 6.4.2 installed from the Qt Installer as binaries (not built from source) on Fedora 37 on Intel with gcc 12.2
QSslSocket::supportsSsl() return false.
/usr/lib64 is holding:
-rwxr-xr-x. 1 root root 430944 Nov 18 08:51 libssl3.so
lrwxrwxrwx. 1 root root 15 Nov 2 00:41 libssl.so -> libssl.so.3.0.5
lrwxrwxrwx. 1 root root 15 Nov 2 00:41 libssl.so.3 -> libssl.so.3.0.5
-rwxr-xr-x. 1 root root 677480 Nov 2 00:41 libssl.so.3.0.5
I can't see any ssl (or even references to libssl using ldd in the Qt directories)
If I add /usr/lib64 to the front of LD_LIBRARY_PATH the application sig faults on:
this->WebSocket = new QWebSocket();
Since the Qt Maintenance Tool provides the source code for OpenSSL 1.1.1q, I downloaded that and built it using the following commands. Build and install was smooth:
sudo dnf group install 'Development Tools' -y
sudo dnf install perl-core zlib-devel -y
cd ~/Qt/Tools/OpenSSL/src
./config --prefix=/usr/lib64 --openssldir=/usr/lib64 shared zlib
make -j8
make test
sudo make install
make install added the following files to /usr/lib64
lrwxrwxrwx. 1 root root 29 Jul 22 02:33 libevent_openssl-2.1.so.7 -> libevent_openssl-2.1.so.7.0.1
-rwxr-xr-x. 1 root root 36840 Jul 22 02:33 libevent_openssl-2.1.so.7.0.1
lrwxrwxrwx. 1 root root 28 Oct 24 18:02 libxmlsec1-openssl.so -> libxmlsec1-openssl.so.1.2.34
lrwxrwxrwx. 1 root root 28 Oct 24 18:02 libxmlsec1-openssl.so.1 -> libxmlsec1-openssl.so.1.2.34
-rwxr-xr-x. 1 root root 304712 Oct 24 18:02 libxmlsec1-openssl.so.1.2.34
-rw-r--r--. 1 root root 10909 Jan 10 18:43 openssl.cnf
-rw-r--r--. 1 root root 10909 Jan 10 18:43 openssl.cnf.dist
ossl-modules:
total 1736
drwxr-xr-x. 2 root root 38 Jan 8 18:32 .
dr-xr-xr-x. 173 root root 118784 Jan 10 18:43 ..
-rwxr-xr-x. 1 root root 1488504 Nov 2 00:41 fips.so
-rwxr-xr-x. 1 root root 120392 Nov 2 00:41 legacy.so
This did not seem to change the result - same error messages when running the application; same sig fault when adding /usr/lib64 in front of LD_LIBRARY_PATH
There seems to no mention on how to proceed in the help. Qt Forum / Bugs and Stackoverflow seem to have lots of articles. Besides the LD_LIBRARY_PATH and building from source the other suggestion seems to be install openssl 1.1.1 from the package manager.
sudo dnf install openssl-1.1.1q-1.fc35.x86_64.rpm
Can't find the .rpm. If I download it from:
https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/35/Everything/x86_64/os/Packages/o/openssl-1.1.1l-2.fc35.x86_64.rpm
then Fedora refuses to install it.
Any guidance would be appreciated.

Synbolik link to aws EFS on web server doesn't work?

I have static folder serving the files on uwsgi.
/user/app/static/
lrwxrwxrwx 1 root root 23 Oct 13 09:40 _out -> /usr/src/app/_mat/_out/
drwxr-xr-x 8 root root 4096 Oct 13 09:49 assets
drwxr-xr-x 8 root root 4096 Oct 13 09:40 pages
in this case, the imagefiles under assets can be appeared correctly,
however the image files under _out can not be accessed.(404 error occurs)
static/assets/test.png is ok
static/_out/test.png returns 404 error
/usr/src/app/_mat/ are on the aws EFS.
I checked the permissions.
Generally speaking, does symbolic link work under web server?

AWS CodeBuild not pausing on breakpoint

Using steps provided here, I kicked off a CodeBuild with the following advanced options checked:
Enable session connection
Allow AWS CodeBuild to modify this service role so it can be used with this build project
The buildspec included a codebuild-breakpoint:
version: 0.2
phases:
pre_build:
commands:
- ls -al
- codebuild-breakpoint
- cd "${SERVICE_NAME}"
- ls -al
- $(aws ecr get-login)
- TAG="$SERVICE_NAME"
build:
commands:
- docker build --tag "${REPOSITORY_URI}:${TAG}" .
post_build:
commands:
- docker push "${REPOSITORY_URI}:${TAG}"
- printf '{"tag":"%s"}' $TAG > ../build.json
artifacts:
files: build.json
The build started and produced the following logs without pausing:
[Container] 2022/02/28 13:49:03 Entering phase PRE_BUILD
[Container] 2022/02/28 13:49:03 Running command ls -al
total 148
drwxr-xr-x 2 root root 4096 Feb 28 13:49 .
drwxr-xr-x 3 root root 4096 Feb 28 13:49 ..
-rw-rw-rw- 1 root root 1818 Feb 28 10:54 user-manager\Dockerfile
-rw-rw-rw- 1 root root 140 Feb 28 10:34 user-manager\body.json
-rw-rw-rw- 1 root root 0 Feb 28 10:54 user-manager\shared-modules\
-rw-rw-rw- 1 root root 4822 Feb 21 14:52 user-manager\shared-modules\config-helper\config.js
-rw-rw-rw- 1 root root 2125 Feb 21 14:52 user-manager\shared-modules\config-helper\config\default.json
-rw-rw-rw- 1 root root 366 Feb 21 14:52 user-manager\shared-modules\config-helper\package.json
-rw-rw-rw- 1 root root 9713 Feb 21 14:52 user-manager\shared-modules\dynamodb-helper\dynamodb-helper.js
-rw-rw-rw- 1 root root 399 Feb 21 14:52 user-manager\shared-modules\dynamodb-helper\package.json
-rw-rw-rw- 1 root root 451 Feb 21 14:52 user-manager\shared-modules\token-manager\package.json
-rw-rw-rw- 1 root root 13885 Feb 21 14:52 user-manager\shared-modules\token-manager\token-manager.js
-rw-rw-rw- 1 root root 44372 Feb 28 10:34 user-manager\src\cognito-user.js
-rw-rw-rw- 1 root root 706 Feb 28 10:34 user-manager\src\package.json
-rw-rw-rw- 1 root root 32734 Feb 28 10:34 user-manager\src\server.js
[Container] 2022/02/28 13:49:03 Running command codebuild-breakpoint
2022/02/28 13:49:03 Build is paused temporarily and you can use codebuild-resume command in the session to resume this build
[Container] 2022/02/28 13:49:03 Running command cd "${SERVICE_NAME}"
/codebuild/output/tmp/script.sh: 4: cd: can't cd to user-manager
My primary question is: Why didn't the build pause and session manager link become available?
Side-quest: The reason I'm trying to debug the session is to try to determine why the process can't CD to the user-manager folder (which clearly exists). Any ideas why?
TLDR: The image on the build machine was too old.
Main quest
The template specified aws/codebuild/ubuntu-base:14.04 as the CodeBuild image. Presumably that image pre-dated the Session Manager functionality (which requires a specific version of the SSM agent to be installed).
I update the agent to aws/codebuild/standard:5.0 and was able to successfully pause on the breakpoint and connect to the session.
Side quest
Once I connected I was able to investigate the cause of the inability to CD to the folder. I can confirm that Tim's shot in the dark was correct! All the entries were in fact files - no folders.
This QuickStart is the gift that keeps on giving! When/if I get all the issues resolved I'll submit a PR to update the project. Those interested in the cause of the file/folder issue can follow up there.
Side quest update
The strange flattening behaviour was due to creating the zip file on a Windows machine and unzipping it on a unix machine (the build agent uses an Ubuntu image). Just zipped it using 7-Zip and that did the job.

What could stop my jetty process at "fixed" times?

I have a service which runs under jetty 9.4.9 on an AWS machine. This service is being stopped every 25 hours at exactly the same time. It's really baffling me how this is possible. See the log files for instance
-rw-rw-r-- 1 jetty jetty 13406811 Jun 27 23:59 2019_06_27.jetty.log
-rw-rw-r-- 1 jetty jetty 8999999 Jun 28 17:14 2019_06_28.jetty.log
-rw-rw-r-- 1 jetty jetty 19008243 Jun 30 19:14 2019_06_30.jetty.log
-rw-rw-r-- 1 jetty jetty 3398645 Jul 1 20:13 2019_07_01.jetty.log
-rw-rw-r-- 1 jetty jetty 7907061 Jul 2 21:14 2019_07_02.jetty.log
-rw-rw-r-- 1 jetty jetty 3067392 Jul 3 22:13 2019_07_03.jetty.log
-rw-rw-r-- 1 jetty jetty 6006241 Jul 4 23:13 2019_07_04.jetty.log
-rw-rw-r-- 1 jetty jetty 3467522 Jul 5 23:59 2019_07_05.jetty.log
-rw-rw-r-- 1 jetty jetty 5862 Jul 6 00:14 2019_07_06.jetty.log
-rw-rw-r-- 1 jetty jetty 8636414 Jul 9 23:59 2019_07_09.jetty.log
-rw-rw-r-- 1 jetty jetty 8110920 Jul 10 04:16 2019_07_10.jetty.log
I do a manual restart every day but at random times, so the actual up time of jetty is never the same. The log file sizes are quite different as you can see.
I checked background processes, cron jobs etc... nothing can explain this behaviour.
Has this ever happened to someone before? any hint as to what I should be looking for?

Google PageSpeed Apache Error log CentOS

I installed the Google PageSpeed module to my CentOS 7.0 DA VPS.
I used this blog, by installing the PageSpeed module: http://www.haloseeker.com/install-go...h-directadmin/
When I check my Apache Error Log, I found the following errors:
[pagespeed:error] [pid 2593] [mod_pagespeed 1.11.33.1-0 #2593] Could not create directories for file /var/cache/mod_pagespeed/v3/domain.com/https,3A/,2Fwww.domain.com/icon_feed.gif,.temp
[pagespeed:error] [pid 2593] [mod_pagespeed 1.11.33.1-0 #2593] /var/cache/mod_pagespeed/v3/domain.com/https,3A/,2Fwww.domain.com/icon_feed.gif,.temp8f2OKe:0: opening temp file: No such file or directory
[pagespeed:error] [pid 2673] [mod_pagespeed 1.11.33.1-0 #2673] Failed to make directory /var/cache/mod_pagespeed/v3/domain.com/https,3A/,www.domain.com/images: Permission denied
How can I solve this problem?
Try to update your directory permission with the following command and let me know if you have any issues.
chmod -R a+w /var/cache/mod_pagespeed
This doesn't have to work. Depending on the Apache configuration (mpm_itk), it's possible that each vhost is served as another user.
So important directories are made under user A, and when another request to host B, user B cannot delete/create subdirectories.
I haven't figured out how to solve this, running CentOS and cPanel as hoster.
-rw-------. 1 tvr86nl tvr86nl 13 Aug 17 23:14 !clean!time!
drwxr-xr-x. 4 tvr86nl tvr86nl 37 Aug 17 00:45 prop_page
drwxr-xr-x. 12 tvr86nl tvr86nl 4.0K Aug 17 12:54 rname
drwxr-xr-x. 3 tvr86nl tvr86nl 22 Aug 16 18:16 v3
root#vps1.sse-ict.nl /var/mod_pagespeed/cache>
so this happens every time when these directories are created :(
perhaps a cron-job would do the trick. But it's a mod_pagespeed
shortcoming!