GWT RPC call don’t seems to work when i deploy my war file to TOMCAT (tomcat/webapps/ROOT/war).
It gives me an error:
The requested resource
(/war/myproject/call) is not
available.
If i change the directory structure and then deploy directly war contents (not war directory itself), like (tomcat/webapps/ROOT/project.html, project.css, project, etc…) then it works.
Can someone please explain me whats going on?
I think there might a problem at:
<servlet>
<servlet-name>callServlet</servlet-name>
<servlet-class>com.myproject.server.dao.Call</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>callServlet</servlet-name>
<url-pattern>/myproject/call</url-pattern>
</servlet-mapping>
The thing is that a single Tomcat server can have multiple applications deployed, each in its so-called context. The applications are deployed in the
webappsfolder and each folder is mapped to one context, while theROOTfolder is the default (no-context).To access an application on Tomcat, you specify the context after the URL. For example if you had an application (context)
Testinwebapps/Testfolder, you would access it like this:But applications in the
ROOTfolder have no context and are accessed by simply going tolocalhost:8080. And this is your case. Tomcat is looking for you application directly in theROOTfolder but you have your app in theROOT/warfolder. In other words, the RPC call expects themyprojectfolder to be under theROOTfolder and not under theROOT/warfolder. That’s why it’s not working.If you still wanted to have your
warfolder within theROOTfolder, you would have to change theurl-patternto/war/myProject/call.