Error: Could not find or load main class $JAVA_OPTS

Hello,

I tried to setup my first ciphermail on an CetOS 7 based virtual
machine, like described here:
https://www.ciphermail.com/documents/quick-install-guide.txt

If I try to start tomcat the following error occurred:

Jun 26 16:26:24 vml000127 systemd: Starting Apache Tomcat Web
Application Container...
Jun 26 16:26:24 vml000127 systemd: Started Apache Tomcat Web
Application Container.
Jun 26 16:26:24 vml000127 server: Java virtual machine used:
/usr/lib/jvm/jre/bin/java
Jun 26 16:26:24 vml000127 server: classpath used:
/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.ja
r:/usr/share/java/commons-daemon.jar
Jun 26 16:26:24 vml000127 server: main class used:
org.apache.catalina.startup.Bootstrap
Jun 26 16:26:24 vml000127 server: flags used: $JAVA_OPTS
- -Djava.awt.headless=true -Xmx128M
Jun 26 16:26:24 vml000127 server: options used:
- -Dcatalina.base=/usr/share/tomcat -Dcatalina.home=/usr/share/tomcat
- -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat/temp
- -Djava.util.logging.config.file=/usr/share/tomcat/conf/logging.propertie
s
- -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Jun 26 16:26:24 vml000127 server: arguments used: start
Jun 26 16:26:24 vml000127 server: Error: Could not find or load main
class $JAVA_OPTS
Jun 26 16:26:24 vml000127 systemd: tomcat.service: main process
exited, code=exited, status=1/FAILURE
Jun 26 16:26:24 vml000127 server: Java virtual machine used:
/usr/lib/jvm/jre/bin/java
Jun 26 16:26:24 vml000127 server: classpath used:
/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.ja
r:/usr/share/java/commons-daemon.jar
Jun 26 16:26:24 vml000127 server: main class used:
org.apache.catalina.startup.Bootstrap
Jun 26 16:26:24 vml000127 server: flags used: $JAVA_OPTS
- -Djava.awt.headless=true -Xmx128M
Jun 26 16:26:24 vml000127 server: options used:
- -Dcatalina.base=/usr/share/tomcat -Dcatalina.home=/usr/share/tomcat
- -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat/temp
- -Djava.util.logging.config.file=/usr/share/tomcat/conf/logging.propertie
s
- -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Jun 26 16:26:24 vml000127 server: arguments used: stop
Jun 26 16:26:24 vml000127 server: Error: Could not find or load main
class $JAVA_OPTS
Jun 26 16:26:24 vml000127 systemd: tomcat.service: control process
exited, code=exited status=1
Jun 26 16:26:24 vml000127 systemd: Unit tomcat.service entered failed
state.

"Error: Could not find or load main class $JAVA_OPTS" What's wrong?
Where could be the nasty bug? Any idea?

ttyl
Django

Hi Django,

Can you show the contents of the file /etc/sysconfig/tomcat ?

Kind regards,

Martijn Brinkers

···

On 06/26/2015 04:51 PM, Django wrote:

Hello,

I tried to setup my first ciphermail on an CetOS 7 based virtual
machine, like described here:
Quick setup — CipherMail Documentation

If I try to start tomcat the following error occurred:

Jun 26 16:26:24 vml000127 systemd: Starting Apache Tomcat Web
Application Container...
Jun 26 16:26:24 vml000127 systemd: Started Apache Tomcat Web
Application Container.
Jun 26 16:26:24 vml000127 server: Java virtual machine used:
/usr/lib/jvm/jre/bin/java
Jun 26 16:26:24 vml000127 server: classpath used:
/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.ja
r:/usr/share/java/commons-daemon.jar
Jun 26 16:26:24 vml000127 server: main class used:
org.apache.catalina.startup.Bootstrap
Jun 26 16:26:24 vml000127 server: flags used: $JAVA_OPTS
-Djava.awt.headless=true -Xmx128M
Jun 26 16:26:24 vml000127 server: options used:
-Dcatalina.base=/usr/share/tomcat -Dcatalina.home=/usr/share/tomcat
-Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat/temp
-Djava.util.logging.config.file=/usr/share/tomcat/conf/logging.propertie
s
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Jun 26 16:26:24 vml000127 server: arguments used: start
Jun 26 16:26:24 vml000127 server: Error: Could not find or load main
class $JAVA_OPTS
Jun 26 16:26:24 vml000127 systemd: tomcat.service: main process
exited, code=exited, status=1/FAILURE
Jun 26 16:26:24 vml000127 server: Java virtual machine used:
/usr/lib/jvm/jre/bin/java
Jun 26 16:26:24 vml000127 server: classpath used:
/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.ja
r:/usr/share/java/commons-daemon.jar
Jun 26 16:26:24 vml000127 server: main class used:
org.apache.catalina.startup.Bootstrap
Jun 26 16:26:24 vml000127 server: flags used: $JAVA_OPTS
-Djava.awt.headless=true -Xmx128M
Jun 26 16:26:24 vml000127 server: options used:
-Dcatalina.base=/usr/share/tomcat -Dcatalina.home=/usr/share/tomcat
-Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat/temp
-Djava.util.logging.config.file=/usr/share/tomcat/conf/logging.propertie
s
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Jun 26 16:26:24 vml000127 server: arguments used: stop
Jun 26 16:26:24 vml000127 server: Error: Could not find or load main
class $JAVA_OPTS
Jun 26 16:26:24 vml000127 systemd: tomcat.service: control process
exited, code=exited status=1
Jun 26 16:26:24 vml000127 systemd: Unit tomcat.service entered failed
state.

"Error: Could not find or load main class $JAVA_OPTS" What's wrong?
Where could be the nasty bug? Any idea?

--
CipherMail email encryption

Open source email encryption gateway with support for S/MIME, OpenPGP
and PDF messaging.

Twitter: http://twitter.com/CipherMail

--
CipherMail email encryption

Open source email encryption gateway with support for S/MIME, OpenPGP
and PDF messaging.

Twitter: http://twitter.com/CipherMail

Hello Martijn!

···

Am 26.06.2015 um 16:54 schrieb Martijn Brinkers:

Can you show the contents of the file /etc/sysconfig/tomcat ?

Here ist is:

# Service-specific configuration file for tomcat. This will be sourced b
y
# the SysV init script after the global configuration file
# /etc/tomcat/tomcat.conf, thus allowing values to be overridden in
# a per-service manner.
#
# NEVER change the init script itself. To change values for all
services make
# your changes in /etc/tomcat/tomcat.conf
#
# To change values for a specific service make your edits here.
# To create a new service create a link from /etc/init.d/<your new

to

# /etc/init.d/tomcat (do not copy the init script) and make a copy of th
e
# /etc/sysconfig/tomcat file to /etc/sysconfig/<your new service> and
change
# the property values so the two services won't conflict. Register the n
ew
# service in the system as usual (see chkconfig and similars).
#

# Where your java installation lives
#JAVA_HOME="/usr/lib/jvm/java"

# Where your tomcat installation lives
#CATALINA_BASE="/usr/share/tomcat"
#CATALINA_HOME="/usr/share/tomcat"
#JASPER_HOME="/usr/share/tomcat"
#CATALINA_TMPDIR="/var/cache/tomcat/temp"

# You can pass some parameters to java here if you wish to
#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3"

# Use JAVA_OPTS to set java.library.path for libtcnative.so
#JAVA_OPTS="-Djava.library.path=/usr/lib64"

# What user should run tomcat
#TOMCAT_USER="tomcat"

# You can change your tomcat locale here
#LANG="en_US"

# Run tomcat under the Java Security Manager
#SECURITY_MANAGER="false"

# Time to wait in seconds, before killing process
#SHUTDOWN_WAIT="30"

# Whether to annoy the user with "attempting to shut down" messages or n
ot
#SHUTDOWN_VERBOSE="false"

# Set the TOMCAT_PID location
#CATALINA_PID="/var/run/tomcat.pid"

# Connector port is 8080 for this tomcat instance
#CONNECTOR_PORT="8080"

# If you wish to further customize your tomcat environment,
# put your own definitions here
# (i.e. LD_LIBRARY_PATH for some jdbc drivers)

JAVA_OPTS="$JAVA_OPTS -Ddjigzo-web.home=/usr/share/djigzo-web"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Xmx128M"

O.K.?
And here's my /etc/tomcat/tomcat.conf

# System-wide configuration file for tomcat services
# This will be loaded by systemd as an environment file,
# so please keep the syntax.
#
# There are 2 "classes" of startup behavior in this package.
# The old one, the default service named tomcat.service.
# The new named instances are called tomcat(a)instance.service.
#
# Use this file to change default values for all services.
# Change the service specific ones to affect only one service.
# For tomcat.service it's /etc/sysconfig/tomcat, for
# tomcat(a)instance it's /etc/sysconfig/tomcat(a)instance.

# This variable is used to figure out if config is loaded or not.
TOMCAT_CFG_LOADED="1"

# In new-style instances, if CATALINA_BASE isn't specified, it will
# be constructed by joining TOMCATS_BASE and NAME.
TOMCATS_BASE="/var/lib/tomcats/"

# Where your java installation lives
JAVA_HOME="/usr/lib/jvm/jre"

# Where your tomcat installation lives
CATALINA_HOME="/usr/share/tomcat"

# System-wide tmp
CATALINA_TMPDIR="/var/cache/tomcat/temp"

# You can pass some parameters to java here if you wish to
#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3"

# Use JAVA_OPTS to set java.library.path for libtcnative.so
#JAVA_OPTS="-Djava.library.path=/usr/lib"

# You can change your tomcat locale here
#LANG="en_US"

# Run tomcat under the Java Security Manager
SECURITY_MANAGER="false"

# Time to wait in seconds, before killing process
# TODO(stingray): does nothing, fix.
# SHUTDOWN_WAIT="30"

# If you wish to further customize your tomcat environment,
# put your own definitions here
# (i.e. LD_LIBRARY_PATH for some jdbc drivers)

I hope that helps ... :wink:

cul8r
Django

Hello,

···

Am 26.06.2015 um 16:58 schrieb Django:

JAVA_OPTS="$JAVA_OPTS -Ddjigzo-web.home=/usr/share/djigzo-web"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Xmx128M"

On CentOS 7 with Tomcat 7 should it be like that:

JAVA_OPTS="-Ddjigzo-web.home=/usr/share/djigzo-web"
JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"

Isn't it so? :confused: I'm not a grait tomcat guru!

cul8r
Django

Something has changed with Tomcat 7 on CentOS 7. Somehow the sysconfig
file for tomcat no longer understands $JAVA_OPTS. Probably the
systconfig file is no longer included as a shell script (this used to
work, not sure when this was changed).

The solution is to set the JAVA_OPTS in one line:

JAVA_OPTS="-Ddjigzo-web.home=/usr/share/djigzo-web
-Djava.awt.headless=true -Xmx128M"

After a restart the first time the GUI is activated, it takes some time
to login. I think that the generation of some SSL DH keys takes some
time after a restart.

Kind regards,

Martijn Brinkers

···

On 06/26/2015 04:58 PM, Django wrote:

Hello Martijn!

Am 26.06.2015 um 16:54 schrieb Martijn Brinkers:

Can you show the contents of the file /etc/sysconfig/tomcat ?

Here ist is:

# Service-specific configuration file for tomcat. This will be sourced b
y
# the SysV init script after the global configuration file
# /etc/tomcat/tomcat.conf, thus allowing values to be overridden in
# a per-service manner.
#
# NEVER change the init script itself. To change values for all
services make
# your changes in /etc/tomcat/tomcat.conf
#
# To change values for a specific service make your edits here.
# To create a new service create a link from /etc/init.d/<your new
> to
# /etc/init.d/tomcat (do not copy the init script) and make a copy of th
e
# /etc/sysconfig/tomcat file to /etc/sysconfig/<your new service> and
change
# the property values so the two services won't conflict. Register the n
ew
# service in the system as usual (see chkconfig and similars).
#

# Where your java installation lives
#JAVA_HOME="/usr/lib/jvm/java"

# Where your tomcat installation lives
#CATALINA_BASE="/usr/share/tomcat"
#CATALINA_HOME="/usr/share/tomcat"
#JASPER_HOME="/usr/share/tomcat"
#CATALINA_TMPDIR="/var/cache/tomcat/temp"

# You can pass some parameters to java here if you wish to
#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3"

# Use JAVA_OPTS to set java.library.path for libtcnative.so
#JAVA_OPTS="-Djava.library.path=/usr/lib64"

# What user should run tomcat
#TOMCAT_USER="tomcat"

# You can change your tomcat locale here
#LANG="en_US"

# Run tomcat under the Java Security Manager
#SECURITY_MANAGER="false"

# Time to wait in seconds, before killing process
#SHUTDOWN_WAIT="30"

# Whether to annoy the user with "attempting to shut down" messages or n
ot
#SHUTDOWN_VERBOSE="false"

# Set the TOMCAT_PID location
#CATALINA_PID="/var/run/tomcat.pid"

# Connector port is 8080 for this tomcat instance
#CONNECTOR_PORT="8080"

# If you wish to further customize your tomcat environment,
# put your own definitions here
# (i.e. LD_LIBRARY_PATH for some jdbc drivers)

JAVA_OPTS="$JAVA_OPTS -Ddjigzo-web.home=/usr/share/djigzo-web"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Xmx128M"

--
CipherMail email encryption

Open source email encryption gateway with support for S/MIME, OpenPGP
and PDF messaging.

Twitter: http://twitter.com/CipherMail

--
CipherMail email encryption

Open source email encryption gateway with support for S/MIME, OpenPGP
and PDF messaging.

Twitter: http://twitter.com/CipherMail

Almost correct. I think by setting JAVA_OPTS like that will override the
previous setting. That's why it was using $JAVA_OPTS to make sure the
new value got appended. But, it might be that they completely changed
this during a minor update :frowning: .. because using $JAVA_OPTS used to work
correctly. I'll investigate this.

Kind regards,

Martijn

···

On 06/26/2015 05:26 PM, Django wrote:

Hello,

Am 26.06.2015 um 16:58 schrieb Django:

JAVA_OPTS="$JAVA_OPTS -Ddjigzo-web.home=/usr/share/djigzo-web"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Xmx128M"

On CentOS 7 with Tomcat 7 should it be like that:

JAVA_OPTS="-Ddjigzo-web.home=/usr/share/djigzo-web"
JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"

Isn't it so? :confused: I'm not a grait tomcat guru!

--
CipherMail email encryption

Open source email encryption gateway with support for S/MIME, OpenPGP
and PDF messaging.

Twitter: http://twitter.com/CipherMail

It looks like RedHat changed the Tomcat service to start with systemd.
The file /etc/sysconfig/tomcat is now loaded with the EnvironmentFile
directive and this does not support $ var expansion.

See Environment @
http://www.freedesktop.org/software/systemd/man/systemd.exec.html

I'll update the documentation.

Thanks for reporting.

Kind regards,

Martijn Brinkers

···

On 06/26/2015 05:32 PM, Martijn Brinkers wrote:

On 06/26/2015 05:26 PM, Django wrote:

Hello,

Am 26.06.2015 um 16:58 schrieb Django:

JAVA_OPTS="$JAVA_OPTS -Ddjigzo-web.home=/usr/share/djigzo-web"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Xmx128M"

On CentOS 7 with Tomcat 7 should it be like that:

JAVA_OPTS="-Ddjigzo-web.home=/usr/share/djigzo-web"
JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"

Isn't it so? :confused: I'm not a grait tomcat guru!

Almost correct. I think by setting JAVA_OPTS like that will override the
previous setting. That's why it was using $JAVA_OPTS to make sure the
new value got appended. But, it might be that they completely changed
this during a minor update :frowning: .. because using $JAVA_OPTS used to work
correctly. I'll investigate this.

--
CipherMail email encryption

Open source email encryption gateway with support for S/MIME, OpenPGP
and PDF messaging.

Twitter: http://twitter.com/CipherMail

HI Martijn!

I'll update the documentation.

O.K. that's grait. BTW, you should rename (remove .deb) on your
downloadpage:
Community Edition packages

old:
- ------------------------------------------------------
RedHat & CentOS
Description File Signature
Back-end djigzo-2.10.0-3.noarch.rpm.deb
Web GUI djigzo-web-2.10.0-3.noarch.rpm.deb
- ------------------------------------------------------

new:
- ------------------------------------------------------
RedHat & CentOS
Description File Signature
Back-end djigzo-2.10.0-3.noarch.rpm
Web GUI djigzo-web-2.10.0-3.noarch.rpm
- ------------------------------------------------------

Thanks for reporting.

No problem.

Hav a nice weekend!

Best regards
Django

···

Am 26.06.2015 um 17:47 schrieb Martijn Brinkers:

You are right. You are the first to spot this :slight_smile: the actual link is
correct (i.e., the downloaded file does not have the .deb extension) but
the link text is not correct.

I'll fix this.

Thanks

Martijn Brinkers

···

On 06/26/2015 08:28 PM, Django wrote:

HI Martijn!

Am 26.06.2015 um 17:47 schrieb Martijn Brinkers:

I'll update the documentation.

O.K. that's grait. BTW, you should rename (remove .deb) on your
downloadpage:
Community Edition packages

old:
------------------------------------------------------
RedHat & CentOS
Description File Signature
Back-end djigzo-2.10.0-3.noarch.rpm.deb
Web GUI djigzo-web-2.10.0-3.noarch.rpm.deb
------------------------------------------------------

new:
------------------------------------------------------
RedHat & CentOS
Description File Signature
Back-end djigzo-2.10.0-3.noarch.rpm
Web GUI djigzo-web-2.10.0-3.noarch.rpm
------------------------------------------------------

--
CipherMail email encryption

Open source email encryption gateway with support for S/MIME, OpenPGP
and PDF messaging.

Twitter: http://twitter.com/CipherMail

--
CipherMail email encryption

Open source email encryption gateway with support for S/MIME, OpenPGP
and PDF messaging.

Twitter: http://twitter.com/CipherMail