cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Linux - Tomcat - Port 80

pshashipreetham
17-Peridot

Linux - Tomcat - Port 80

Hi,

 

I have changed the port to 80 in the server.xml:

pshashipreetham_1-1723574715379.png

 

When I looked into the Catalina.out, I get the below error:

pshashipreetham_0-1723574676289.png

 

Does anyone know the solution?

 

Thanks,

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.
ACCEPTED SOLUTION

Accepted Solutions

Hi, 

 

I found the solution to this issue.

 

Below are the commands I have used to fix this issue:

Here are the steps to Java run on privileged ports in Linux:

NOTE: $SPECROOT is /usr/Spectrum (you may have installed Spectrum in a different directory)

1. The setcap sets the capabilities of each specified filename to the capabilities specified. In this case, allow java to bind on privileged ports:

$ sudo setcap cap_net_bind_service+ep /usr/Spectrum/Java/bin/java
OR
# setcap cap_net_bind_service+ep /usr/Spectrum/Java/bin/java (logged as root)

2. The getcap gets the current setting of the specified filename:
$ sudo getcap /usr/Spectrum/Java/bin/java
OR
# getcap /usr/Spectrum/Java/bin/java (logged as root)

Expected output:
/usr/Spectrum/Java/bin/java = cap_net_bind_service+ep

The Tomcat service fails to start with this error message: 

$ cat /usr/Spectrum/tomcat/logs/catalina.out
/usr/Spectrum/Java/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

You will get the same error message if you run: "java -version" logged as Spectrum Install Owner account:

$ /usr/Spectrum/Java/bin/java -version

/usr/Spectrum/Java/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

The above error means that after setting setcap, it breaks how java looks for its library to run. To fix this, we need to symlink the library it’s looking for into /usr/lib, then run ldconfig.

3.  Find the location of the libjli.s file under $SPECROOT/directory.
$ find -name libjli.so

4.  Create the symlink based on the path of the above file (for Spectrum 21.2.x):
$ sudo ln -s /usr/Spectrum/Java/lib/amd64/jli/libjli.so /usr/lib/
OR
# ln -s /usr/Spectrum/Java/lib/amd64/jli/libjli.so /usr/lib/ (logged as root)
(for Spectrum 23.3.x)

$ sudo ln -s /usr/Spectrum/Java/lib/libjli.so /usr/lib/
OR
# ln -s /usr/Spectrum/Java/lib/libjli.so /usr/lib/ (logged as root)

5.  Confirm the symlink created (for Spectrum 21.2.x):
# ls -lar /usr/lib/libjli.so
lrwxrwxrwx  1 root root     42 Sep 21 18:05 libjli.so -> /usr/Spectrum/Java/lib/amd64/jli/libjli.so

(for Spectrum 23.3.x)

# ls -lar /usr/lib/libjli.so

lrwxrwxrwx  1 root root     42 May 19 18:05 libjli.so -> /usr/Spectrum/Java/lib/libjli.so

6. Run ldconfig:

# sudo ldconfig
OR
# ldconfig (logged as root)

7. Now test Java again:
$ /usr/Spectrum/Java/bin/java -version (logged as Spectrum Install Owner account)

openjdk version "1.8.0_302"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (Temurin)(build 25.302-b08, mixed mode)

8. Start the Spectrum Tomcat service.
$SPECROOT/tomcat/bin/startTomcat.sh

 

Thanks,

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.

View solution in original post

2 REPLIES 2

Hi, 

 

I found the solution to this issue.

 

Below are the commands I have used to fix this issue:

Here are the steps to Java run on privileged ports in Linux:

NOTE: $SPECROOT is /usr/Spectrum (you may have installed Spectrum in a different directory)

1. The setcap sets the capabilities of each specified filename to the capabilities specified. In this case, allow java to bind on privileged ports:

$ sudo setcap cap_net_bind_service+ep /usr/Spectrum/Java/bin/java
OR
# setcap cap_net_bind_service+ep /usr/Spectrum/Java/bin/java (logged as root)

2. The getcap gets the current setting of the specified filename:
$ sudo getcap /usr/Spectrum/Java/bin/java
OR
# getcap /usr/Spectrum/Java/bin/java (logged as root)

Expected output:
/usr/Spectrum/Java/bin/java = cap_net_bind_service+ep

The Tomcat service fails to start with this error message: 

$ cat /usr/Spectrum/tomcat/logs/catalina.out
/usr/Spectrum/Java/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

You will get the same error message if you run: "java -version" logged as Spectrum Install Owner account:

$ /usr/Spectrum/Java/bin/java -version

/usr/Spectrum/Java/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

The above error means that after setting setcap, it breaks how java looks for its library to run. To fix this, we need to symlink the library it’s looking for into /usr/lib, then run ldconfig.

3.  Find the location of the libjli.s file under $SPECROOT/directory.
$ find -name libjli.so

4.  Create the symlink based on the path of the above file (for Spectrum 21.2.x):
$ sudo ln -s /usr/Spectrum/Java/lib/amd64/jli/libjli.so /usr/lib/
OR
# ln -s /usr/Spectrum/Java/lib/amd64/jli/libjli.so /usr/lib/ (logged as root)
(for Spectrum 23.3.x)

$ sudo ln -s /usr/Spectrum/Java/lib/libjli.so /usr/lib/
OR
# ln -s /usr/Spectrum/Java/lib/libjli.so /usr/lib/ (logged as root)

5.  Confirm the symlink created (for Spectrum 21.2.x):
# ls -lar /usr/lib/libjli.so
lrwxrwxrwx  1 root root     42 Sep 21 18:05 libjli.so -> /usr/Spectrum/Java/lib/amd64/jli/libjli.so

(for Spectrum 23.3.x)

# ls -lar /usr/lib/libjli.so

lrwxrwxrwx  1 root root     42 May 19 18:05 libjli.so -> /usr/Spectrum/Java/lib/libjli.so

6. Run ldconfig:

# sudo ldconfig
OR
# ldconfig (logged as root)

7. Now test Java again:
$ /usr/Spectrum/Java/bin/java -version (logged as Spectrum Install Owner account)

openjdk version "1.8.0_302"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (Temurin)(build 25.302-b08, mixed mode)

8. Start the Spectrum Tomcat service.
$SPECROOT/tomcat/bin/startTomcat.sh

 

Thanks,

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.
Announcements


Top Tags