xnat-1.8.2 not started in tomcat 9

155 views
Skip to first unread message

pilla...@gmail.com

unread,
Sep 2, 2021, 4:12:41 AM9/2/21
to xnat_discussion
Dear XNAT team and users,

I have tomcat7 + xnat 1.7.1 + postgresql 9 working at the moment. I have encountered sending email errors. I am thinking maybe upgrading of tomcat will sort out the issue. 
I shutdown existing tomcat7 and followed https://www.digitalocean.com/community/tutorials/install-tomcat-9-ubuntu-1804 to install tomcat 9. By default settings, tomcat 9 seems starting well, I can see tomcat 9 page and enter manager page as well. When I copied xnat-web-1.8.2.2.war to websapp dir to and override ROOT, then I got errors like:

HTTP Status 404 – Not Found

Type Status Report

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.52

in the /etc/systemd/system/tomcat.service file,  I have the following settings

[Unit]

Description=Apache Tomcat Web Application Container

After=network.target


[Service]

Type=forking

#Environment=JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

Environment=JAVA_HOME=/usr/lib/jvm/java-8-oracle

Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid

Environment=CATALINA_HOME=/opt/tomcat

Environment=CATALINA_BASE=/opt/tomcat

#Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'

#Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

#Environment='JAVA_OPTS=-Djava.awt.headless=true -Xms1024m -Xmx6028m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC'

Environment='JAVA_OPTS=-Djava.awt.headless=true'

Environment='CATALINA_OPTS=-Xms512m -Xmx1g -XX:+UseConcMarkSweepGC -XX:-OmitStackTraceInFastThrow'

CATALINA_OPTS='${CATALINA_OPTS} -Dxnat.home=/data/xnat/home -Dxnat.config.home=/data/xnat/home/config -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8080'


ExecStart=/opt/tomcat/bin/startup.sh

ExecStop=/opt/tomcat/bin/shutdown.sh


User=tomcat7

Group=tomcat7

UMask=0007

RestartSec=10

Restart=always


[Install]

WantedBy=multi-user.target


--------

How to start xnat with tomcat 9?;

Look forward to hearing from you. Thank you very much.
J

Herrick, Rick

unread,
Sep 2, 2021, 10:58:41 AM9/2/21
to xnat_di...@googlegroups.com

All I can tell you based on this information is that something’s not working properly. You need to at least provide the Tomcat logs and any XNAT logs that may have messages in them. It’s possible that even with that info that we can’t tell you what’s going on, because it can be really difficult to say what’s going on with a custom system configuration like what you’re describing, but without it we definitely can’t tell.

 

-- 

Rick Herrick

XNAT Architect/Developer

Computational Imaging Laboratory

Washington University School of Medicine

 

 

From: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of pilla...@gmail.com <pilla...@gmail.com>
Date: Thursday, September 2, 2021 at 3:12 AM
To: xnat_discussion <xnat_di...@googlegroups.com>
Subject: [XNAT Discussion] xnat-1.8.2 not started in tomcat 9

* External Email - Caution *

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/9fa8aaa2-877e-4c5c-8604-748f0573841en%40googlegroups.com.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

pilla...@gmail.com

unread,
Sep 2, 2021, 5:36:07 PM9/2/21
to xnat_discussion
Hi Rick,

The catalina.out shows the following message. Because XNAT didn't start, so there was no logs available for XNAT. Thank you very much.

02-Sep-2021 22:26:55.207 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name:   Apache Tomcat/9.0.52
02-Sep-2021 22:26:55.216 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jul 31 2021 04:12:17 UTC
02-Sep-2021 22:26:55.216 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.52.0
02-Sep-2021 22:26:55.216 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
02-Sep-2021 22:26:55.216 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            4.15.0-50-generic
02-Sep-2021 22:26:55.216 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
02-Sep-2021 22:26:55.216 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib/jvm/java-8-oracle/jre
02-Sep-2021 22:26:55.216 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_131-b11
02-Sep-2021 22:26:55.217 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
02-Sep-2021 22:26:55.217 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /opt/tomcat
02-Sep-2021 22:26:55.217 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /opt/tomcat
02-Sep-2021 22:26:55.227 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
02-Sep-2021 22:26:55.227 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
02-Sep-2021 22:26:55.227 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
02-Sep-2021 22:26:55.227 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
02-Sep-2021 22:26:55.228 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
02-Sep-2021 22:26:55.228 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
02-Sep-2021 22:26:55.228 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms512m
02-Sep-2021 22:26:55.228 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx1g
02-Sep-2021 22:26:55.228 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseConcMarkSweepGC
02-Sep-2021 22:26:55.228 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:-OmitStackTraceInFastThrow
02-Sep-2021 22:26:55.228 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
02-Sep-2021 22:26:55.229 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
02-Sep-2021 22:26:55.229 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
02-Sep-2021 22:26:55.229 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
02-Sep-2021 22:26:55.232 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
02-Sep-2021 22:26:55.837 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
02-Sep-2021 22:26:55.890 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [901] milliseconds
02-Sep-2021 22:26:55.918 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
02-Sep-2021 22:26:55.918 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.52]
02-Sep-2021 22:26:55.930 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/ROOT]
02-Sep-2021 22:26:56.028 SEVERE [main] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory [/opt/tomcat/webapps/ROOT]
java.lang.IllegalStateException: Error starting child
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1185)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1933)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1095)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:477)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
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.start(Bootstrap.java:345)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.DirResourceSet@150c158]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139)
at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:691)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4885)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5023)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
... 37 more
Caused by: java.lang.IllegalArgumentException: The directory specified by base and internal path [${xnat.home}/plugins]/[] does not exist.
at org.apache.catalina.webresources.DirResourceSet.checkType(DirResourceSet.java:287)
at org.apache.catalina.webresources.AbstractFileResourceSet.initInternal(AbstractFileResourceSet.java:227)
at org.apache.catalina.webresources.DirResourceSet.initInternal(DirResourceSet.java:295)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
... 44 more
02-Sep-2021 22:26:56.032 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/ROOT] has finished in [101] ms
02-Sep-2021 22:26:56.033 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/manager]
02-Sep-2021 22:26:56.266 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/manager] has finished in [233] ms
02-Sep-2021 22:26:56.267 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/host-manager]
02-Sep-2021 22:26:56.289 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/host-manager] has finished in [22] ms
02-Sep-2021 22:26:56.289 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/ROOT.org]
02-Sep-2021 22:26:56.304 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/ROOT.org] has finished in [14] ms
02-Sep-2021 22:26:56.304 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/examples]
02-Sep-2021 22:26:56.699 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/examples] has finished in [395] ms
02-Sep-2021 22:26:56.699 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/docs]
02-Sep-2021 22:26:56.721 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/docs] has finished in [22] ms
02-Sep-2021 22:26:56.726 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
02-Sep-2021 22:26:56.744 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [854] milliseconds


Herrick, Rick

unread,
Sep 2, 2021, 7:38:51 PM9/2/21
to xnat_di...@googlegroups.com

Here’s the issue:

 

The directory specified by base and internal path [${xnat.home}/plugins]/[] does not exist.

 

The context for XNAT specifies that ${xnat.home}/plugins should be added to the application’s classpath:

 

<Resources>

    <PreResources className="org.apache.catalina.webresources.DirResourceSet" base="${xnat.home}/plugins" webAppMount="/WEB-INF/lib" />

</Resources>

 

That folder doesn’t exist, so it can’t be added. Just create that folder and you should be good.

pilla...@gmail.com

unread,
Sep 3, 2021, 5:18:16 PM9/3/21
to xnat_discussion
Hi Rick,

I have plugins folder in the /data/xnat/home directory. But the error remains.

Best wishes,
J

Moore, Charlie

unread,
Sep 3, 2021, 5:38:24 PM9/3/21
to xnat_di...@googlegroups.com
Hello there,

Are you sure you have xnat.home defined for tomcat9? I noticed the log you posted mentions the command line params being provided to tomcat, but there's conspicuously no mention of xnat.home.

Thanks,
Charlie

Sent: Friday, September 3, 2021 4:18 PM

pilla...@gmail.com

unread,
Sep 4, 2021, 6:16:29 AM9/4/21
to xnat_discussion
Hi Charlie,

I have CATALINA_OPTS='${CATALINA_OPTS} -Dxnat.home=/data/xnat/home -Dxnat.config.home=/data/xnat/home/config -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8080'
in the /etc/systemd/system/tomcat.service .
Will that be enough for setting XNAT home directory?

Best wishes,
J

Herrick, Rick

unread,
Sep 7, 2021, 11:05:39 AM9/7/21
to xnat_di...@googlegroups.com

You don’t need the -Dxnat.config.home specified, since ${xnat.home}/config is the default used for the config folder, so you can leave that off.

 

I’m 99% certain this is the issue:

 

Environment='CATALINA_OPTS=-Xms512m -Xmx1g -XX:+UseConcMarkSweepGC -XX:-OmitStackTraceInFastThrow'

CATALINA_OPTS='${CATALINA_OPTS} -Dxnat.home=/data/xnat/home -Dxnat.config.home=/data/xnat/home/config \

               -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8080'

 

This works with the standard Tomcat server packaging when you install through apt or yum and are modifying a configuration file like /etc/default/tomcat9, which is the primary configuration file for Tomcat on Ubuntu. Basically that is just a shell script that gets sourced before the service is instantiated. That looks like this in the service unit file:

 

EnvironmentFile=-/etc/default/tomcat9

 

Your CATALINA_OPTS='${CATALINA_OPTS}…' line is being ignored (I’m actually surprised the service starts: I made a typo in one once and it got very upset and wouldn’t start), so the xnat.home setting has no effect.

 

But I’m wondering why you’re managing the Tomcat 9 installation manually in this way when Tomcat 9 is available through the standard Ubuntu apt repos for 18.04. I’d suggest removing the manual configuration you have, installing Tomcat 9 through apt, then modifying /etc/default/tomcat9 to configure stuff. That file on my dev VM right now looks like this:

 

JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

JAVA_OPTS="-Djava.awt.headless=true"

CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"

CATALINA_OPTS="${CATALINA_OPTS} -Xms2g -Xmx6g -XX:+UseConcMarkSweepGC -XX:-OmitStackTraceInFastThrow -XX:+CMSClassUnloadingEnabled"

CATALINA_OPTS="${CATALINA_OPTS} -Dxnat.home=/data/xnat/home"

 

These sorts of configuration issues are the precise reason we encourage people to use standard software packages when available, as it makes it easier to understand the environment in which errors occur and (generally) eliminates variables in the platform that cause problems.

 

If you can’t use the standard Ubuntu package for Tomcat 9, then you’ll need to modify your tomcat9.service file like so:

 

Environment='CATALINA_OPTS=-Xms512m -Xmx1g -XX:+UseConcMarkSweepGC -XX:-OmitStackTraceInFastThrow \

             -Dxnat.home=/data/xnat/home -Dxnat.config.home=/data/xnat/home/config \

             -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8080'

 

Note that the \ and spaces are just for readability: this should all be on one line.

 

Alternatively you could use the EnvironmentFile directive I mentioned above:

 

EnvironmentFile=-/etc/default/tomcat9

 

With that you can remove the extra CATALINA_OPTS line altogether (I think you still want to have CATALINA_OPTS defined in the service unit file or it won’t be recognized even if it’s in the environment file, but I might be wrong about that).

 

Note that the ‘-‘ right after the equal sign in that line indicates that, even if the return code from the script indicates a failure (e.g. there’s a malformed statement in the script), the service should continue start-up. You can remove that so that errors in the service configuration cause start-up to fail so you can fix it.

Reply all
Reply to author
Forward
0 new messages