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.
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?
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.
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.
ENV: Amazon Linux with Tomcat6 on EC2.
I create a simple dynamic web project with an index.jsp on Eclipse, load it to cloud and it shows up correctly. But once I create a servlet and do the same process, the page says service not available and gives error code 503.
I have tried to remove the servlet tags in web.xml, then it works again.
Just to clarify, I have two existing dynamic web projects that I'd like to have deployed on cloud. Both are running fine on local Tomcat6.
edit:
<?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" 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>Test</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>Se</display-name>
<servlet-name>Se</servlet-name>
<servlet-class>Servlet.Se</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Se</servlet-name>
<url-pattern>/Se</url-pattern>
</servlet-mapping>
</web-app>
Above is my web.xml, if I remove servlet,servlet-mapping blocks, it works again.
The UnsupportedClassVersionError usually happens because you are using a newer JDK version for compiling than the version used at runtime. Try compiling with the same JDK version used by Tomcat.
SEVERE: Error deploying web application archive Test.war
java.lang.UnsupportedClassVersionError: Servlet/Se : Unsupported major.minor version 51.0 (unable to load class Servlet.Se)
This type of error occurs when you have compiled your running your application on a different version of JRE than it was originally intended for or compiled on.
51.0 means that it is expecting JRE version 7 and (it is most probable that) you must be running it on JRE 6 on your ec2 server. First determine what is the version of the JRE on your ec2 server with the command
$ java -version
and make sure that is matches the one with on which the code was initially compiled on. It is most probable that you compiled your code on JRE7 and on ec2 server, JRE6 is configured and you might want to upgrade it on ec2 server, or downgrade on your machine.
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