关于tomcat的种种问题,异常,出错

一、

哥现在在netbeans与myeclipse中都是用的是这个:
F:\Apache Software Foundation\Apache Tomcat 6.0.16
在console上面显示的是黑色字

可以正常使用了。访问localhost:8080正常!


之前这个不知道为什么用不了了?:
F:\tomcat6.0.24
使用它访问不了localhost,显示“无法解析域名”(在360安全浏览器中),在ie中则显示“无法显示页面”。
另外在console上面显示的是红色字


难道装太多tomcat的缘故。后装者取代了前装者?

二、

解决Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.的问题

tomcat 启动报错(以前一直使用正常)

2010-3-22 9:34:24 org.apache.coyote.http11.Http11BaseProtocol init
信息: Initializing Coyote HTTP/1.1 on http-9999
2010-3-22 9:34:24 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 453 ms
2010-3-22 9:34:24 org.apache.tomcat.util.digester.Digester fatalError
严重: Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAX
ParseException(ErrorHandlerWrapper.java:236)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalErro
r(ErrorHandlerWrapper.java:215)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
XMLErrorReporter.java:386)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
XMLErrorReporter.java:316)
        at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(X
MLScanner.java:1438)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$Prolog
Dispatcher.dispatch(XMLDocumentScannerImpl.java:899)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:834)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:764)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.
java:148)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Ab
stractSAXParser.java:1242)
        at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1581)
        at org.apache.catalina.users.MemoryUserDatabase.open(MemoryUserDatabase.
java:402)
        at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance
(MemoryUserDatabaseFactory.java:103)
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF
actory.java:140)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3
04)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
        at org.apache.naming.NamingContextBindingsEnumeration.nextElementInterna
l(NamingContextBindingsEnumeration.java:113)
        at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContext
BindingsEnumeration.java:71)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBe
ans(GlobalResourcesLifecycleListener.java:137)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBe
ans(GlobalResourcesLifecycleListener.java:109)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycle
Event(GlobalResourcesLifecycleListener.java:81)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:693
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2010-3-22 9:34:24 org.apache.naming.NamingContext lookup
警告: Unexpected exception resolving reference

报错原因:检查你的server.xml配置文件!最近是不是编辑过,看看是不是有中文什么的不合法字符! 

特别是一些不可见的字符。实在不行,重新解压缩一个原始的server.xml 然后重新修改配置!

总之问题:xml解析问题,检查xml文件!

注:仔细想了想,刚刚在server.xml没进行过什么修改,倒是在tomcat-users.xml中使用“另存为”,编码换成了“Unicode”,为什么我要这样做呢?因为我看见它里面显示了很多黑方块,所以就把它的编码从ANSI改为了Unicode,以为这样能正常显示,但是还是老样子。

于是现在我又将其重新改为ANSI。

重新运行,异常解决了。

你可能感兴趣的:(服务器)