Tomcat 无法从 [/opt/App1/conf/server.xml] 加载服务器配置

Tomcat Unable to load server configuration from [/opt/App1/conf/server.xml]

我正在尝试在其上安装 tomcat 服务器 运行 多项服务,如下所述:https://dzone.com/articles/run-configure-multiple-instance-in-a-single-tomcat

我使用所有需要的目录为我的服务创建了单独的文件夹,并且我在原始 Tomcat 中创建了一个控制器文件夹以控制不同的实例。当我想从控制器 运行 我的应用程序时,我看到 Tomcat 已启动但没有任何反应。

Using CATALINA_BASE:   /opt/apigateway
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/apigateway/temp
Using JRE_HOME:        /usr/java/latest
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.

在 Catalina.out 我明白了:

WARNING [main] org.apache.catalina.startup.Catalina.load Unable to load server configuration from [/opt/App1/conf/server.xml]
 org.xml.sax.SAXParseException; systemId: file:/opt/App1/conf/server.xml; lineNumber: 5; columnNumber: 67; Error at (5, 67) : org.apache.catalina.core.JasperListener
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:1862)
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:1894)
    at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1177)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1439)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:566)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:611)
    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.load(Bootstrap.java:306)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:491)
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.core.JasperListener
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:116)
    at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1174)
    ... 20 more

28-Jan-2019 14:15:28.468 SEVERE [main] org.apache.catalina.startup.Catalina.start Cannot start server, server instance is not configured
28-Jan-2019 14:15:51.674 SEVERE [main] org.apache.tomcat.util.digester.Digester.startElement Begin event threw exception
 java.lang.ClassNotFoundException: org.apache.catalina.core.JasperListener
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:116)
    at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1174)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1439)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:566)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:611)
    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.load(Bootstrap.java:306)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:491)

我的 server.xml 是这样的:

        <?xml version='1.0' encoding='utf-8'?>
    <Server port="8005" shutdown="SHUTDOWN">
      <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
      <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
      <Listener className="org.apache.catalina.core.JasperListener" />
      <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
      <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
      <GlobalNamingResources>
        <Resource name="UserDatabase" auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved"
                  factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                  pathname="conf/tomcat-users.xml" />
      </GlobalNamingResources>
      <Service name="App1">
        <Connector port="8761" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />
         <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
  <!--        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b">
             </Valve> -->
      </Host>
    </Engine>
  </Service>
</Server>

Remove line 来自 server.xml <Listener className="org.apache.catalina.core.JasperListener" />

simply REMOVE obsolete setting from server.xml

仅与 Tomcat 7

相关