-2

If I put my GWT project's, named FirstProject, war content directly into Tomcat's ROOT folder. All things, including RPC calls, work fine.

my web.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee">

  <!-- Servlets -->
  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>com.example.server.GreetingServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/firstproject/greet</url-pattern>
  </servlet-mapping>

  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>FirstProject.html</welcome-file>
  </welcome-file-list>

</web-app>

and my interface is:

@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService { ... }

But if I copy all FirstProject war content into Tomcat's ROOT/MyFolder/ folder and access it on http://example_web_address.com/MyFolder/FirstProject.html then all things works except RPC calls

I do not want to use maven, ant or compressed war file. What should I change in my web.xml? Or is the problem in elsewhere?

lembas
  • 377
  • 1
  • 7
  • 21

2 Answers2

2

You need to update your servlet-mapping's url-pattern to where GWT will expect them, i.e. prefix them with MyFolder:

<url-pattern>/MyFolder/firstproject/greet</url-pattern>

Note: your <welcome-file> has to be updated similarly too.

Maybe you'd rather deploy the app at /MyFolder rather than at /ROOT then?

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
  • not working. I still get error 404. is there anything I should do with tomcat? context.xml or server.xml? – lembas Aug 28 '14 at 13:10
0

I voted Thomas up. But the real answer is "Do not copy the war content into webapps/ROOT/MyFolder, put it in webapps/MyFolder and do not change anything in web.xml".

I hope this is the right thing to do in stackoverflow ethics.

lembas
  • 377
  • 1
  • 7
  • 21