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
Related
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?
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.
Issue I'm facing is as follows.
In Jboss I have web.xml as follows...
<servlet>
<servlet-name>servlet</servlet-name>
<servlet-class>com.exp.ServletExample</servlet-class>
<servlet-mapping>
<servlet-name>servlet</servlet-name>
<url-pattern>/test/hello</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>NewFile.html</welcome-file>
</welcome-file-list>
</servlet>
And when I try _http://localhost:8800/SimpleServletProject/ - [SimpleServletProject is the war file name] then my welcome file i.e. NewFile.html is getting displayed.
If I put the same war on jetty and type _http://localhost:8080/SimpleServletProject/ it doesn't work... I get 404 error saying
HTTP ERROR 404
Problem accessing /SimpleServletProject/index.jsp. Reason: not found
My war structure is as follows
SimpleServletProject.war
-META-INF
-WEB-INF
-NewFile.html
I'm struggling with this issue, any help would be much appreciated.
I installed: JDK 1.7.0_10, GWT 2.4, GXT 2.2.5, App Engine 1.7.0, Eclipse Indigo Service Release 2, Glassfish-3.1.2.2-windows-ml, WinXP SP3.
I created a new “Web Application project”. Run->Run As… -> Web application:
http://127.0.0.1:8888/Exp.html?gwt.codesvr=127.0.0.1:9997
In that case I had:
Sending name to the server:
GWT User
Server replies:
Hello, GWT User!
I am running Google App Engine Development/1.7.0.
It looks like you are using:
Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20100101 Firefox/17.0
web.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>ru.sample.Exp.server.GreetingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/exp/greet</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>Exp.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>SystemServiceServlet</servlet-name>
<servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value/>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>SystemServiceServlet</servlet-name>
<url-pattern>/_ah/spi/*</url-pattern>
</servlet-mapping>
</web-app>
When I compiled my application and copy “war” folder into glassfish docroot: E:\glassfish3\glassfish\domains\domain1\docroot\exp\
If I try to open the link: http://localhost:8080/exp/Exp.html
I have the error:
Sending name to the server:
GWT User
Server replies:
An error occurred while attempting to contact the server.
Please check your network connection and try again.
The error is:
com.google.gwt.user.client.rpc.StatusCodeException: 404 GlassFish v3 - Error
report HTTP
Status 404 - type Status
reportmessagedescriptionThe requested
resource () is not available.GlassFish Server Open Source
Edition 3.1.2.2
Just copying content to the root won't work. Try to build war file (not sure, but application's root could be also ok) and to place it to autodeploy folder. Here is the detailed description of deploy process. Please also check Glassfish logs, to be sure that application is deployed successfully.
As I understand it, GWT uses an embedded Jetty server. Can
anyone please tell me where I can find the Jetty .xml configuration files
used by GWT? I have a webapp which makes uses of Jetty's
ContinuationFilter and ProxyServlet. The app works fine under GWT but
fails when run in a separate Jetty instance outside of GWT. If I can
replicate the GWT Jetty config then I think I'll be okay.
Edit for more info:
My webapp's web.xml reads as follows:
<?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>
<filter>
<filter-name>JettyContinuationFilter</filter-name>
<filter-class>org.eclipse.jetty.continuation.ContinuationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>JettyContinuationFilter</filter-name>
<url-pattern>/bugzilla/*</url-pattern>
</filter-mapping>
<!-- Servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>com.searchsystem.gwt.server.GreetingServiceImpl</servlet-class>
</servlet>
<servlet>
<servlet-name>jetty-proxy-servlet</servlet-name>
<servlet-class>org.eclipse.jetty.servlets.ProxyServlet$Transparent</servlet-class>
<init-param>
<param-name>ProxyTo</param-name>
<param-value>http://localhost/</param-value>
</init-param>
<init-param>
<param-name>Prefix</param-name>
<param-value>/</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/dashboard/greet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jetty-proxy-servlet</servlet-name>
<url-pattern>/bugzilla/*</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>Dashboard.html</welcome-file>
</welcome-file-list>
</web-app>
and the link to my Bugzilla installation is in this form:
com.google.gwt.user.client.ui.Frame bugFrame = new Frame("/bugzilla/");
Running under Jetty 6.1.26, I get this output:
Request Attributes
Attribute: Value:
javax.servlet.forward.request_uri /bugzilla/
org.mortbay.jetty.error_page /jspsnoop/ERROR/404
javax.servlet.forward.servlet_path /bugzilla/
testFilter 1
javax.servlet.error.message NOT_FOUND
requestInitialized ''
javax.servlet.forward.context_path
javax.servlet.error.status_code 404
javax.servlet.error.servlet_name default
org.mortbay.jetty.newSessionId 47deq3eo5kblxfrvtc5rljrg
javax.servlet.error.request_uri /bugzi
lla/
there is no jetty.xml. GWT sets up the Server programmatically.
You can find the setup in
com.google.gwt.dev.shell.jetty.JettyLauncher
contained in the gwt-dev.jar
See: Serving a GWT Application with an Embedded Jetty Server by Brandon Tilley (code extract shown below). He seems to have achieved it quite seamlessly, a process which I will be confirming myself tomorrow.
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.webapp.WebAppContext;
public class EmbeddedGwt {
public static void main(String[] args) throws Throwable {
// Create an embedded Jetty server on port 8080
Server server = new Server(8080);
// Create a handler for processing our GWT app
WebAppContext handler = new WebAppContext();
handler.setContextPath("/");
handler.setWar("./apps/GwtApplication.war");
// If your app isn't packaged into a WAR, you can do this instead
WebAppContext altHandler = new WebAppContext();
altHandler.setResourceBase("./apps/GwtApplication");
altHandler.setDescriptor("./apps/GwtApplication/WEB-INF/web.xml");
altHandler.setContextPath("/");
altHandler.setParentLoaderPriority(true);
// Add it to the server
server.setHandler(handler);
// Other misc. options
server.setThreadPool(new QueuedThreadPool(20));
// And start it up
server.start();
server.join();
}
}