myeclipse 修改項目名Tomcat啟動項目報錯java.lang.IllegalArgumentException: Can't convert argument: null
一、Tomcat啟動報錯:
有時候我們會避免項目重名,在導入項目時會修改項目名稱。
修改項目名稱後啟動該項目至tomcat,報錯:java.lang.IllegalArgumentException: Can‘t convert argument: null
二、問題分析:
因為MyEclipse在修改項目名時候,自動更新部署了web.xml文件並且重新生成了xml文件的頭部聲明. 會將標簽修改為 <javaee:param-name>這樣的類型。
三、解決問題:
修改項目的web.xml,將其中帶有javaee:的標簽中的javaee:刪掉即可,也可以直接Ctrl+F將javaee:直接全部替換為空。
四、報錯信息如下:
java.lang.IllegalArgumentException: Can‘t convert argument: null
at org.apache.tomcat.util.IntrospectionUtils.convert(IntrospectionUtils.java:999)
at org.apache.tomcat.util.digester.CallMethodRule.end(CallMethodRule.java:523)
at org.apache.tomcat.util.digester.Rule.end(Rule.java:229)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1140)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1644)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1066)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
問題是由於在Eclipse下重構JEE項目名時,Eclipse自動更新了部署文件web.xml,重新生成了xml文件的頭部聲明,新增加了javaee的命名空間:如下
<servlet>
<javaee:display-name>MessageBrokerServlet</javaee:display-name>
<servlet-name>MessageBrokerServlet</servlet-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
<init-param>
<javaee:param-name>services.configuration.file</javaee:param-name>
<javaee:param-value>/WEB-INF/flex/services-config.xml</javaee:param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
將標簽 <javaee:param-name> 中的javaee:刪掉就完美解決問題,直接Ctrl+F將javaee:直接全部替換為空。
---------------------
本文來自 Lemyou 的CSDN 博客 ,全文地址請點擊:https://blog.csdn.net/Lemyou/article/details/80373024?utm_source=copy
myeclipse 修改項目名Tomcat啟動項目報錯java.lang.IllegalArgumentException: Can't convert argument: null