Caused by: java.lang.IllegalArgumentException: addChild: Child name 'localhost' is not unique

1、错误描述

[plain]  view plain copy
  1. 严重: End event threw exception  
  2. java.lang.reflect.InvocationTargetException  
  3.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
  4.     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)  
  5.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
  6.     at java.lang.reflect.Method.invoke(Unknown Source)  
  7.     at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:852)  
  8.     at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201)  
  9.     at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1060)  
  10.     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)  
  11.     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)  
  12.     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)  
  13.     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)  
  14.     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)  
  15.     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)  
  16.     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)  
  17.     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)  
  18.     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)  
  19.     at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)  
  20.     at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1555)  
  21.     at org.apache.catalina.startup.Catalina.load(Catalina.java:615)  
  22.     at org.apache.catalina.startup.Catalina.load(Catalina.java:663)  
  23.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
  24.     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)  
  25.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
  26.     at java.lang.reflect.Method.invoke(Unknown Source)  
  27.     at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)  
  28.     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)  
  29. Caused by: java.lang.IllegalArgumentException: addChild:  Child name 'localhost' is not unique  
  30.     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:887)  
  31.     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)  
  32.     at org.apache.catalina.core.StandardEngine.addChild(StandardEngine.java:244)  
  33.     ... 26 more  

2、错误原因

     由于在Tomcat中的server.xml中加了一个:

[plain]  view plain copy
  1. <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"></Host>  
    而自身本来自带一个:

[plain]  view plain copy
  1. <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"></Host>  

     有两个Host导致重复


3、解决办法

    去掉添加的一个Host

[plain]  view plain copy
  1. <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"></Host>  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值