java.lang.IllegalArgumentException: The main resource set specified […] is not valid

匿名 (未验证) 提交于 2019-12-03 02:11:02

问题:

I'm having trouble starting my Tomcat server, it used to work, but I did something wrong and now it throws me this exception:

Caused by: java.lang.IllegalArgumentException: The main resource set specified [E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\workspace\j2eeapplication\target\j2eeapplication-0.0.1-SNAPSHOT] is not valid     at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:643)     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)     ... 9 more

And this is my web.xml :

<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"         version="3.1">          <display-name>J2EE Application Example</display-name>          <welcome-file-list>                 <welcome-file>index.jsp</welcome-file>         </welcome-file-list>          <context-param>                 <param-name>contextConfigLocation</param-name>                 <param-value>/WEB-INF/applicationContext.xml</param-value>         </context-param>          <context-param>                 <param-name>javax.faces.DEFAULT_SUFFIX</param-name>                 <param-value>.xhtml</param-value>         </context-param>          <context-param>                 <param-name>facelets.DEVELOPMENT</param-name>                 <param-value>true</param-value>         </context-param>          <context-param>                 <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>                 <param-value>1</param-value>         </context-param>          <listener>                 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>         </listener>          <servlet>                 <servlet-name>Resources Servlet</servlet-name>                 <servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>                 <load-on-startup>0</load-on-startup>         </servlet>          <servlet-mapping>                 <servlet-name>Resources Servlet</servlet-name>                 <url-pattern>/resources/*</url-pattern>         </servlet-mapping>          <servlet>                 <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>                 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>                 <init-param>                         <param-name>contextConfigLocation</param-name>                         <param-value></param-value>                 </init-param>                 <load-on-startup>1</load-on-startup>         </servlet>          <servlet-mapping>                 <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>                 <url-pattern>/app/*</url-pattern>         </servlet-mapping>          <servlet>                 <servlet-name>Faces Servlet</servlet-name>                 <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>                 <load-on-startup>1</load-on-startup>         </servlet>          <servlet-mapping>                 <servlet-name>Faces Servlet</servlet-name>                 <url-pattern>*.jsf</url-pattern>         </servlet-mapping>          <filter>                 <filter-name>charEncodingFilter</filter-name>                 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>                 <init-param>             <param-name>encoding</param-name>             <param-value>UTF-8</param-value>         </init-param>         <init-param>             <param-name>forceEncoding</param-name>             <param-value>true</param-value>         </init-param>         </filter>          <filter-mapping>             <filter-name>charEncodingFilter</filter-name>             <url-pattern>/*</url-pattern>         </filter-mapping>  </web-app>

I looked at different solutions over the forums, but nothing worked. Final option will be uninstalling tomcat and fresh installation, cause I read that might work. Thanks for the help in advance.

回答1:

Seems like you have an outdated web application referenced in your Tomcat embeded server (You are using Tomcat As within Eclipse right?).

First checkout the deployed application within you server, and check the artifact name j2eeapplication-0.0.1-SNAPSHOT and version. You may need to remove it and clean your working directory the redeploy it and you should be safe.



回答2:

I had this error when I was starting an application that was designed for Tomcat 8 using Tomcat 7.



回答3:

A maven update did the trick for me.

Right click on your maven project:

  • Maven > Update Project...
  • Select All
  • Check "Force Update of Snapshots/Releases"
  • Click Ok

Now, right click on your server:

  • Clean...


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!