3

I am trying to write a simple Google App Engine application. I am following this tutorial: https://developers.google.com/appengine/docs/java/gettingstarted/creating, however I cannot make it working.

When testing on the localhost, I receive:

HTTP ERROR 403 Problem accessing /. Reason: FORBIDDEN Powered by Jetty:// 

This is my application code:

package test; import java.io.IOException; import javax.servlet.http.*; public class Test extends HttpServlet { private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); resp.getWriter().println("Hello, world"); } } 

My web.xml file:

<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE web-app PUBLIC "-//Oracle Corporation//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"> <servlet> <servlet-name>test</servlet-name> <servlet-class>test.Test</servlet-class> </servlet> <servlet-mapping> <servlet-name>test</servlet-name> <url-pattern>/test</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app> 

My appengine-web.xml file:

<?xml version="1.0" encoding="utf-8"?> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <application>halocline-test</application> <version>10</version> <!-- Allows App Engine to send multiple requests to one instance in parallel: --> <threadsafe>true</threadsafe> <!-- Configure java.util.logging --> <system-properties> <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/> </system-properties> <!-- HTTP Sessions are disabled by default. To enable HTTP sessions specify: <sessions-enabled>true</sessions-enabled> It's possible to reduce request latency by configuring your application to asynchronously write HTTP session data to the datastore: <async-session-persistence enabled="true" /> With this feature enabled, there is a very small chance your app will see stale session data. For details, see http://code.google.com/appengine/docs/java/config/appconfig.html#Enabling_Sessions --> </appengine-web-app> 

Console output:

Jul 06, 2012 2:42:34 PM com.google.apphosting.utils.jetty.JettyLogger info INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger Jul 06, 2012 2:42:35 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml INFO: Successfully processed C:\Users\Halocline\workspace\Test\war\WEB-INF/appengine-web.xml Jul 06, 2012 2:42:35 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml INFO: Successfully processed C:\Users\Halocline\workspace\Test\war\WEB-INF/web.xml Jul 06, 2012 3:42:36 PM com.google.appengine.tools.development.DevAppServerImpl start INFO: The server is running at http://localhost:8888/ Jul 06, 2012 3:42:36 PM com.google.appengine.tools.development.DevAppServerImpl start INFO: The admin console is running at http://localhost:8888/_ah/admin 

No errors are shown in the console when I open localhost:8888 in my web browser.

Any idea what I am doing wrong?

2 Answers 2

1

You servlet is mapped to http://localhost:8888/test

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks a lot, that works. However when I deploy this application and access MyAppID.appspot.com/test I get the following error: Error: Server Error The server encountered an error and could not complete your request. If the problem persists, please report your problem and mention this error message and the query that caused it.
Look at the log files on appengine.
@Jaroslaw Pawlak: See the log files in the admin console
0

I believe you might have your index.html file in a wrong directory. Check it did not accidentally slip under WEB-INF. It should be directly under war.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.