此bounty已结束。回答此问题可获得+250声望奖励。赏金宽限期12小时后结束。Maelstorm希望引起更多关注这个问题。
我已经按照xnat站点(https://wiki.xnat.org/documentation/getting-started-with-xnat/xnat-installation-guide)上的在线文档进行了操作,并安装了apache tomcat 9(版本9.0.75,JVM版本:1.8.0_372_b07,JVM供应商:但是当我在xnat webapp上点击“开始”时,我得到错误:
FAIL - Application at context path [/xnat-web-1.8.8] could not be started
FAIL - Encountered exception [org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@35a50a4c]]
日志文件显示以下内容(已截断以允许在此处发布):
... org.apache.catalina.core.ApplicationContext.log HTMLManager: Error starting [/xnat-web-1.8.8]
org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@6dde5c8c]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
...
...
...
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.NullPointerException
at java.lang.String.startsWith(String.java:1405)
at java.lang.String.startsWith(String.java:1434)
at org.apache.catalina.webresources.AbstractFileResourceSet.file(AbstractFileResourceSet.java:98)
at org.apache.catalina.webresources.DirResourceSet.getResource(DirResourceSet.java:94)
at org.apache.catalina.webresources.StandardRoot.getResourceInternal(StandardRoot.java:272)
at org.apache.catalina.webresources.Cache.getResource(Cache.java:64)
at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:211)
at org.apache.catalina.webresources.StandardRoot.listResources(StandardRoot.java:347)
at org.apache.catalina.webresources.StandardRoot.processWebInfLib(StandardRoot.java:585)
at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:722)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
根据ChatGPT:
Based on the provided log file, it appears that there is an error during the deployment of the web application '/xnat-web-1.8.8' in Tomcat. The error message indicates a NullPointerException and a LifecycleException related to the StandardRoot component.
The root cause of the issue seems to be the NullPointerException occurring within the AbstractFileResourceSet class. It specifically fails when attempting to access a file resource, likely due to a missing or invalid file path.
我想知道这个问题是在单元文件中还是在postgresql配置(TCP/IP连接)设置中。我只在localhost上使用tomcat。在我的pg_hba.conf文件中,我刚刚添加了listen_addresses = '*'
行。如果您查看下面的单元文件,我为它指定了多个文件夹以供读写。Tomcat默认使用/opt/tomcat。但是xnat文档设置表明我使用/var/lib/tomcat、/var/log/tomcat和/etc/tomcat/ Catalina 作为ReadWritePaths。我刚刚添加了所有这些与我的安装默认路径在我的单位文件.我想知道这是否是错误所在。我的tomcat单元文件是:
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
User=xnat
Group=xnat
PrivateTmp=yes
Environment="JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true"
Environment="CATALINA_BASE=/opt/tomcat"
Environment="CATALINA_HOME=/opt/tomcat"
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid"
Environment="CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX:+UseParallelGC -Dxnat.home=/data/xnat/home"
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
#AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
CacheDirectory=tomcat
CacheDirectoryMode=750
#ProtectSystem=strict
ReadWritePaths=/etc/tomcat/Catalina/
ReadWritePaths=/opt/tomcat/webapps/
ReadWritePaths=/var/lib/tomcat/webapps/
ReadWritePaths=/opt/log/tomcat/
ReadWritePaths=/var/log/tomcat/
ReadWritePaths=/data/xnat/home
ReadWritePaths=/home/xnat/
[Install]
WantedBy=multi-user.target
/opt/tomcat/webapps/xnat-1.8.8/META-INF下的context.xml文件是:
xml version="1.0" encoding="utf-8"?>
<!--
~ web: context.xml
~ XNAT http://www.xnat.org
~ Copyright (c) 2005-2021, Washington University School of Medicine and Howard Hughes Medical Institute
~ All Rights Reserved
~
~ Released under the Simplified BSD.
-->
<Context>
<!--
For Tomcat 7 compatibility, uncomment the <Loader> element and comment out the <Resources>
and <CookieProcessor> elements under that.
-->
<!-- Loader className="org.apache.catalina.loader.VirtualWebappLoader" searchVirtualFirst="true" virtualClasspath="${xnat.home}/plugins/*.jar"/ -->
<!--
For Tomcat 8 compatibility, uncomment the <Resources> and <CookieProcessor> elements below and
comment out the <Loader> element below that.
-->
<Resources>
<PreResources className="org.apache.catalina.webresources.DirResourceSet" base="${xnat.home}/plugins" webAppMount="/WEB-INF/lib" />
</Resources>
<CookieProcessor className="org.apache.tomcat.util.http.LegacyCookieProcessor" />
<JarScanner scanAllDirectories="true" />
<Parameter name="xnatHome" value="${xnat.home}"/>
<Manager pathname="" />
</Context>
从那以后,我也尝试过通过vagrant和docker部署xnat,但没有成功。我将感激你能给予我的任何帮助。
1条答案
按热度按时间wqsoz72f1#
在我看来,这个问题与Tomcat无法正确处理
context.xml
文件中定义的应用程序资源有关:其原因很可能是
${xnat.home}
占位符没有成功解析,可能是因为没有正确定义同名的系统属性。在定义
CATALINA_OPTS
环境变量时,尝试在单元文件中定义系统属性:请注意,它的定义不正确,请注意
CATALINA_OPTS=
后面的"
。它应该是:
这可能是一个错字,但它也可以解释这个问题。