Tomcat 9配置问题

时间:2019-07-17 06:03:44

标签: tomcat tomcat9

因此,我对于tomcat还是一个新手,对配置或诊断它的经验很少。我对stackoverflow也很陌生。因此,请原谅我的任何疏忽。 我试图让Tomcat 9.0.21在ubuntu 18.04服务器上工作。

因此,我无法在本地或远程登录tomcat。当我检查catalina.out文件时,得到以下信息:

17-Jul-2019 05:08:14.640 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.p$
17-Jul-2019 05:08:14.802 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8090"]
17-Jul-2019 05:08:14.831 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
17-Jul-2019 05:08:14.834 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [326] milliseconds
17-Jul-2019 05:08:14.860 SEVERE [main] org.apache.tomcat.util.digester.Digester.fatalError Parse fatal error at line [45] column [3]
        org.xml.sax.SAXParseException; lineNumber: 45; columnNumber: 3; The markup in the document following the root element must be well-formed.
                at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
                at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
                at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
                at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
                at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$TrailingMiscDriver.next(XMLDocumentScannerImpl.java:1395)
                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:842)
                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
                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:1448)
                at org.apache.catalina.users.MemoryUserDatabase.open(MemoryUserDatabase.java:445)
                at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:107)
                at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)
                at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:840)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
                at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:117)
                at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
                at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34)
                at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:127)
                at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:101)
                at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:76)

我认为致命错误是参考server.xml文件的第45行,其中有以下条目。

pathname="/opt/tomcat/current/conf/tomcat-users.xml" />

有问题的完整条目如下(以防遗漏明显的语法错误):

<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="/opt/tomcat/current/conf/tomcat-users.xml" />

我对tomcat-users.xml文件所做的修改如下:

</tomcat-users>
 <role rolename="admin-gui"/>
 <role rolename="manager-gui"/>
 <role rolename="manager-status"/>
 <role rolename="manager-script"/>
 <role rolename="manager-jmx"/>
 <role rolename="tomcat"/>
 <user username="admin" password="redacted" roles="admin-gui"/>
 <user username="manager" password="redacted" roles="manager-gui"/>
 <user username="testing" password="redacted" roles="manager-gui,manager-status,manager-script,manager-jmx"/>
</tomcat-users>

当我尝试登录到webgui时,它没有错误登录并重复了用户名/密码挑战。当我取消窗口时,它给了我一个标准的tomcat 401错误。 如果我拖尾-f catalina.out可以得到

16-Jul-2019 01:47:27.507 WARNING [http-nio-8090-exec-1] org.apache.catalina.realm.LockOutRealm.filterLockedAccounts An attempt was made to authenticate the locked user [managertest]

请帮助

0 个答案:

没有答案