Problem loading XNAT after upgrading Ubuntu 22.04 with tomcat9

185 views
Skip to first unread message

Ruba

unread,
Jul 20, 2023, 12:34:03 PM7/20/23
to xnat_discussion
Hi,

I previously installed XNAT 1.7.6 on Ubuntu 18.04 with Tomcat7 and openjdk-8-jdk. I recently upgraded the OS to Ubuntu 22.04 and installed Tomcat9. I have also configured the META-INF/context.xml file mentioned in this link. Although Tomcat is active and running, I still cannot load XNAT and get the following error:

XNAT error.png

If it is any help, I have attached the Catalina.out file.
I would appreciate it if anyone could help me resolve this issue.
Thank you in advance.

Best regards,
Ruba
catalina.out

Charlie Moore

unread,
Jul 20, 2023, 12:37:31 PM7/20/23
to xnat_discussion
Hi Ruba,

What is there in XNAT's logs? I don't think the tomcat logs will be enough to tell what's going on here.

Thanks,
Charlie Moore

Ruba

unread,
Jul 20, 2023, 1:03:05 PM7/20/23
to xnat_discussion
Hi,

There is no file in the XNAT log directory. Is there any other place I should look?

Thank you,
Ruba

Rick Herrick

unread,
Jul 20, 2023, 1:08:06 PM7/20/23
to xnat_di...@googlegroups.com
What I’m more interested in than catalina.out is localhost.date.log (e.g. localhost.2023-07-20.log). The start time in your catalina.out is very quick:

20-Jul-2023 16:06:30.184 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [834] milliseconds

834 milliseconds means that Tomcat’s not even getting to trying to start XNAT, so I don’t think you’ll have any XNAT logs.

What I almost guarantee you’ll see in localhost.2023-07-20.log is something like this:

20-Jul-2023 16:06:30.023 SEVERE [http-nio-8080-exec-9] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet [jsp] threw exception
    java.lang.UnsupportedClassVersionError: org/eclipse/jdt/internal/compiler/env/INameEnvironment has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java
Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)

I mentioned this in my previous reply here. I can tell from the paths in catalina.out (e.g. CATALINA_BASE: /var/lib/tomcat9) that you’re using the standard Tomcat 9 package in Ubuntu 22.04, which won’t run with Java 8. Like I said in that earlier reply, the only way to work around this is to install Tomcat 9 manually. This post describes the process: it uses Java 11 and Tomcat 10, but the basic procedure is the same, substituting Java 8 for Java 11. Note that I’ve run XNAT with Tomcat 10 and had no issues, but it’s not “officially” supported (i.e. we’ve done no scaling, performance, or functional testing with XNAT on Tomcat 10), so the safest bet is going with Tomcat 9.

Rick Herrick
Senior Software Developer


------ Original Message ------
From "Charlie Moore" <charle...@flywheel.io>
To "xnat_discussion" <xnat_di...@googlegroups.com>
Date 7/20/23, 11:37:31 AM
Subject [XNAT Discussion] Re: Problem loading XNAT after upgrading Ubuntu 22.04 with tomcat9

--
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/d29f4706-0482-4966-be37-90755d229ebcn%40googlegroups.com.

Ruba

unread,
Jul 20, 2023, 1:44:25 PM7/20/23
to xnat_discussion
Hi Rick,

Thank you for the reply. I did follow your suggestions and manually install Tomcat 9. I used the /var/lib/tomcat9 directory instead of the /opt/tomcat9 directory. I will try again, and I will go through the exact steps this time.

I also checked the localhost_access_log.2023-07-20.txt file in the /var/lib/tomcat9/logs directory. I can see only the following messages:

20-Jul-2023 16:06:30.078 INFO [main] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()

20-Jul-2023 16:06:30.080 INFO [main] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()

20-Jul-2023 16:06:30.081 INFO [main] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker@5f683daf')

I have attached all the logs from tomcat9 in case they help.

Thanks again.
Ruba
catalina.out
localhost.2023-07-20.log
catalina.2023-07-20.log
localhost_access_log.2023-07-20.txt

Rick Herrick

unread,
Jul 20, 2023, 3:48:16 PM7/20/23
to xnat_di...@googlegroups.com
I think you don’t have XNAT installed. The ROOT application started up fine:

20-Jul-2023 16:06:29.737 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/var/lib/tomcat9/webapps/ROOT]
20-Jul-2023 16:06:29.779 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/var/lib/tomcat9/webapps/ROOT] has finished in [41] ms

That indicates that the ROOT application loaded fine and finished in 41 ms. Definitely not XNAT. And the access logs support this:

127.0.0.1 - - [20/Jul/2023:16:34:55 +0100] "GET /app/template/Login.vm HTTP/1.0" 404 780
127.0.0.1 - - [20/Jul/2023:16:35:01 +0100] "GET / HTTP/1.0" 200 11210
127.0.0.1 - - [20/Jul/2023:16:35:01 +0100] "GET /tomcat.svg HTTP/1.0" 200 67795

Here you can see the app unable to load the login page, but it did get a 200 for /tomcat.svg. That file is in the default ROOT application in the Tomcat 9 download.

Shut down Tomcat, delete the ROOT folder under your Tomcat webapps folder, then copy your XNAT war into that webapps folder, renaming it to ROOT.war from xnat-web-xxx.war, and start Tomcat.

Rick Herrick
Senior Software Developer


------ Original Message ------
From "Ruba" <rubaida...@gmail.com>
To "xnat_discussion" <xnat_di...@googlegroups.com>
Date 7/20/23, 12:44:25 PM
Subject Re: [XNAT Discussion] Re: Problem loading XNAT after upgrading Ubuntu 22.04 with tomcat9

Ruba

unread,
Jul 23, 2023, 10:43:04 AM7/23/23
to xnat_discussion
Hi Rick,

Thanks a lot for your kind help. I have followed your instruction, but it's still showing this error:

plugin error.png
I found from the old posts that this could happen because of the problem in the tomcat9 unit(/etc/systemd/system/tomcat9.service) file or config (/etc/default/tomcat9) file. I am attaching these files here if you could please have a look.

/etc/systemd/system/tomcat9.service:

[Unit]

Description=Apache Tomcat Web Application Container

After=network.target

[Service]

Type=forking

User=xnat

Group=xnat

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

Environment="CATALINA_HOME=/var/lib/tomcat9/"

Environment="CATALINA_BASE=/var/lib/tomcat9/"

Environment="CATALINA_OPTS=-Djava.awt.headless=true"

ReadWritePaths=/var/lib/tomcat9/webapps/

ReadWritePaths=/var/lib/tomcat9/logs/

ReadWritePaths=/data/xnat/

ExecStart=/var/lib/tomcat9/bin/catalina.sh start

ExecStop=/var/lib/tomcat9/bin/catalina.sh stop

[Install]

WantedBy=multi-user.target


etc/default/tomcat9:

User=xnat

Group=xnat

PrivateTmp=yes

AmbientCapabilities=CAP_NET_BIND_SERVICE

NoNewPrivileges=true

CacheDirectory=tomcat9

CacheDirectoryMode=750

ProtectSystem=strict

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

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

CATALINA_OPTS="-Xms2g -Xmx6g -Dxnat.home=/data/xnat/home"

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

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


I would highly appreciate your help.
Thanks again.

Ruba

Ruba

unread,
Jul 24, 2023, 8:35:07 AM7/24/23
to xnat_discussion

Hi,

Thank you all for your kind suggestions.
I have solved the problem following this post. Thanks to Rick.
I just included following parameter in the tomcat9 unit(/etc/systemd/system/tomcat9.service) file and it worked fine.

Environment="CATALINA_OPTS=-Xms2g -Xmx4g -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=8000"

Best wishes,
Ruba


Rick Herrick

unread,
Jul 24, 2023, 10:50:28 AM7/24/23
to xnat_di...@googlegroups.com
In your service unit definition, xnat.home is set to /data/xnat/home. Does the folder /data/xnat/home/plugins exist? And can the user xnat access it?

Rick Herrick
Senior Software Developer


------ Original Message ------
From "Ruba" <rubaida...@gmail.com>
To "xnat_discussion" <xnat_di...@googlegroups.com>
Date 7/24/23, 7:35:07 AM
Subject Re: Re[2]: [XNAT Discussion] Re: Problem loading XNAT after upgrading Ubuntu 22.04 with tomcat9

Rubaida Easmin

unread,
Jul 24, 2023, 12:27:04 PM7/24/23
to xnat_di...@googlegroups.com
Hi Rick,

Yes, the folder is there and the problem is already solved.
Thanks a lot for your help.

Best wishes,
Ruba 

You received this message because you are subscribed to a topic in the Google Groups "xnat_discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xnat_discussion/BFS9j3KYXPo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/emfbf12a7a-0f3b-44d0-8cae-e78cbdcdbf61%40c879a8ac.com.
Reply all
Reply to author
Forward
0 new messages