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.
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.
For me, this was caused by a file permission issue. We use a different deployment strategy where I work (not something I can change) which means the webapp exists in a completely different directory to the normal Tomcat directory structure. The above exception occurred when the Tomcat runtime didn't have permission to access that directory.
I had this error when I was starting an application that was designed for Tomcat 8 using Tomcat 7.
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...
Just in case this might help anyone who come later, I managed to start my tomcat8 server after close and reopen the front project in:
The main resource set specified [project-to-be-reopened]
In my case, it's maven dependency that's causing me this issue, updating maven-dependency will also help.
I had a similar issue. Just if someone else runs into this problem:
For me it was caused because I had an old project deployed, then closed that project. For several weeks, everything was fine, until I used the "Clean..." command of eclipse on that tomcat server. From that point on the famous The main resource set specified [...path to deployment location of this project...] is not valid was raised every time I tried to start Tomcat.
What solved this problem for me was just removing that old project from tomcat (Right click on that entry under Tomcat Server and choose "Remove").
I had a similar issue with one of the projects. I tried all the solutions to this question. None worked for me. I then double-clicked the Tomcat server to see the actual config. In there, under the tab "Modules", there is a list of projects currently associated with the Tomcat server. I could see that the "trouble-causing project" was listed there. I clicked on that and hit remove.
Then everything started to work just fine.
In my case with Tomcat 9 and using Eclipse under Windows, I somehow removed the application from the webapp directory under the Tomcat true server and could no longer start the standalone Tomcat server service. Got the same root cause text as the initial posted question. My solution was to copy the Eclipse version of the application (from the workspace's .metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps tree) to the C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps directory.
Note that I am not using Maven in my workspace, and it was just a standard Java Web project.
For me, the cause was another:
In .metadata.plugins\org.eclipse.wst.server.core\servers.xml the "server" element had no "list" element.
I added the "list" element:
<server auto-publish-setting="1" auto-publish-time="1" configuration-id="/Servers/Tomcat v9.0 Server 9091 ASM-config" deployDir="wtpwebapps" hostname="localhost" id="Tomcat v9.0 Server 9091 ASM" jrebel.old-auto-publish-setting="2" name="Tomcat v9.0 Server 9091 ASM" runtime-id="Apache Tomcat v9.0" server-type="org.eclipse.jst.server.tomcat.90" server-type-id="org.eclipse.jst.server.tomcat.90" start-timeout="9000" stop-timeout="30" testEnvironment="true" timestamp="4">
<list key="modules" value0="adsuite-market::org.eclipse.jst.j2ee.server:adsuite-market::jst.web::2.4"/>
and restarted Eclipse. Then it worked as normal again.
Related
I am using RAD and WAS 7.0.23, and try to deploy jax-rs in it. But I am getting below error in deployment descriptor(Web.xml).
Error 404: javax.servlet.UnavailableException: SRVE0200E: Servlet
[com.ibm.websphere.jaxrs.server.IBMRestServlet]: Could not find
required class - class java.lang.ClassNotFoundException:
com.ibm.websphere.jaxrs.server.IBMRestServlet
Servlet Mapping
<servlet>
<description>JAX-RS Tools Generated - Do not modify</description>
<servlet-name>JAX-RS Servlet</servlet-name>
<servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>APPLICATION CLASS</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAX-RS Servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
JAX-RS wasn't added to WAS until 8.0. If you want to use JAX-RS on that old a server (which I generally wouldn't recommend for the reason Andy mentioned above), you'll need to bring your own provider.
First, I agree that continuing to use the well-out-of-support 7.0 is unwise.
That said, it may just be that you need to add the jar to the RAD project's "Deployment Assembly", in addition to the "Java Build Path".
I have a simple JSF project which works just fine; after adding RichFaces to it, it stops working properly
Environment: Eclipse IDE, JSF 2.1 (Apache MyFaces 2.1.5), Tomcat v7.0 Server (Location: workspace metadata, Server Locations: Use Tomcat installation); http://localhost:8181/ gives me the admin console, so the server is running ok
The application: a Dynamic Web Project (version 3.0) named jsf1;
under WebContent, i have a page named main.xhtml (For brevity, i won't paste the content, because things work well so far; Its a simple hello world page);
the faces-config.xml is left unchanged;
the web.xml contains:
<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>/faces/*</url-pattern>
</servlet-mapping>
In Project Explorer, i right click on the project > Run As > Run on Server, and the application is accessible in a web browser at the url http://localhost:8181/jsf1/faces/main.xhtml
Adding RichFaces: i followed the instructions given at https://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/GettingStarted.html
under WEB-INF/lib i have added all the required jars
i have appended to web.xml the following content:
<!-- Plugging the "Blue Sky" skin into the project -->
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<!-- Making the RichFaces skin spread to standard HTML controls -->
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<!-- Defining and mapping the RichFaces filter -->
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
Now, when i run the project on server, in the console i get:
SEVERE: Exception starting filter richfaces
java.lang.ClassNotFoundException: org.ajax4jsf.Filter
I added the richfaces-impl-3.3.3.Final.jar, which contains the org.ajax4jsf.Filter class.
Now, when i run the project on server,the console contains no errors, however, the link http://localhost:8181/jsf1/faces/main.xhtml displays a blank page.
How is it possible to create a functional RichFaces application?
When trying to create Dynamic Web project or even using old one( which used to work before) and running it on the tomcat(v8.0.35) server from my eclipse (mars.2 v4.5.2) I started getting Http status code 404 when accessing the recourse:
Here is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>hello</display-name>
<servlet>
<display-name>LoginServlet</display-name>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.javawebtutor.controller.LoginServlet</servlet-class>
</servlet>
<servlet>
<display-name>RegisterServlet</display-name>
<servlet-name>RegisterServlet</servlet-name>
<servlet-class>com.javawebtutor.controller.RegisterServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>RegisterServlet</servlet-name>
<url-pattern>/RegisterServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
For reference, I have done everything step by step in this tutorial:
http://www.javawebtutor.com/articles/hibernate/mvc-appliction-using-servlet-jsp-and-hibernate.html
Java I'm using for the project is jdk1.8. For server - jre1.8
I'm 99% sure I've not deviated from the tutorial and something wrong must be with my Tomcat installation. As I mentioned it worked before on other projects I have not modified and it stopped working as well.
I have tried cleaning projects, cleaning Tomcat server, work directory, remove tomcat server, restart eclipse, add tomcat server again. I've even converted project into Maven project and tried to build with clean and install goals. Nothing helped.
Here is server location snippet:
Related answer here: Tomcat is not deploying my web project from Eclipse
And yes, I did try everything in there.
If it helps I'm developing on Win10
EDIT:
Project topology:
With the limited amount of info, I suggest you do the following:
Check if you have a login.jsp directly under your webapp or webContent(your tutorial uses this), because your welcome file in web.xml specifies this as your home page.
Try access http://localhost:8080/ instead of http://localhost:8080/hello/
Please provide your complete expanded project tree if the above does not solve your problem.
Also, here is one of my youtube video introducing how to set up a running java-web app with eclipse and tomcat. It is only a couple of minutes.
Following this tutorial makes sure you have a minimal java web project running, you can start from there if your problem cannot be fixed.
Hi all I am working on Eclipse 6.0.36 and using tomcat server.I am having an error said "The requested resource is not available" error 404.I had seen other post on same question and this is the common error that many solution that I could find on google. But still cannot solve my problem.. I am also still new working on eclipse.If there any information that you need just ask me, before vote down.. there are so long codes that I need to show..
some says this might be caused by servlet command.My servlet,from web_bkup.xml files looks like this:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SourceCodeServlet</servlet-name>
<url-pattern>*.source</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
surely there is lack of information that I give and you all can ask for it. But if there any solution that you all can shared.Hopefully can solve my error
Since you have only given little information, I try to answer under a few assumptions.
The 404 tells you that Tomcat could not find the resource e-system.jsp. I now assume that you have a project PM_Portal in Eclipse that you have successfully deployed to the Tomcat server, meaning there were no severe errors in the Tomcat log files which stopped the web application from starting. I also assume that PM_Portal is the root context of your application.
From that information, getting a 404 after successfull deployment means that there either is no JSP file e-system.jsp in the /WebContent folder of the Eclipse PM_Portal project or the Deployment Assembly configuration for you project lacks a mapping for the /WebContent folder. In order to check this, you can right-click on the project folder and choose Properties. Open the Deployment Assembly property and check that /WebContent is mapped to the root folder / of the target deployment.
Hope this is helpful.
I searched this site for answer to this question and couldn't find a solution.
what i did is that i simply compress the war directory in my eclipse GWT app project then rename it to .war then drop it to tomcat webapps folder.
when i run the web app, the first screen is successfully shown but when i call a servlet within my src code it gives me resource not found by tomcat server.
i'm sure i have added entry for servlet in web.xml file and the app worked well when i run it in eclipse gwt dev mode. something prevent my servlets (standard servlets not GWT RPC servlets) to be found and executed by tomcat. what could be the reason?
UPDATE
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Servlets -->
<servlet>
<servlet-name>OAuth</servlet-name>
<servlet-class>org.goauth.server.OAuthServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>OAuth</servlet-name>
<url-pattern>/goauth/oauth</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>OAuthCallback</servlet-name>
<servlet-class>org.goauth.server.OAuthCallbackServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>OAuthCallback</servlet-name>
<url-pattern>/goauth/callback</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>service</servlet-name>
<servlet-class>org.goauth.server.OAuthServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>service</servlet-name>
<url-pattern>/goauth/service</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>OAuthConfirm</servlet-name>
<servlet-class>org.goauth.server.OAuthConfirmServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>OAuthConfirm</servlet-name>
<url-pattern>/goauth/confirm</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>GOAuth.html</welcome-file>
</welcome-file-list>
</web-app>
Error
nothing in tomcate logs files
the only error in browser is :
HTTP Status 404 - /goauth/oauth
type Status report
message /goauth/oauth
description The requested resource (/goauth/oauth) is not available.
Apache Tomcat/6.0.20
I found the problem :
for invoking my servlet i was calling a url of the format : "/goauth/OAuth"
this worked with eclipse gwt plugin in dev mode but not when i deploy war to tomcat server.
the solution is that my url pointing to my servlet should be of the form :
String href = GWT.getHostPageBaseURL()+"goauth/OAuth";
so we need to tell tomcat the full url by prefixing servlet url with GWT.getHostPageBaseURL().
Take a look at how to create a GWT .war in eclipse: http://blog.elitecoderz.net/gwt-and-tomcat-create-war-using-eclipse-to-deploy-war-on-tomcat/2009/12/
In your mapping, try changing
/goauth/oauth
to /OAuth