Reputation: 3013
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>
Upvotes: 2
Views: 3300
Reputation: 3013
Well i found the solution, it had to do with Tomcat's way of operation.
The error was: I was compressing only the war directory (not it's inside contents) into project.war.
Upvotes: 1
Reputation: 5023
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 webapps
folder and each folder is mapped to one context, while the ROOT
folder 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) Test
in webapps/Test
folder, you would access it like this:
http://localhost:8080/Test
But applications in the ROOT
folder have no context and are accessed by simply going to localhost:8080
. And this is your case. Tomcat is looking for you application directly in the ROOT
folder but you have your app in the ROOT/war
folder. In other words, the RPC call expects the myproject
folder to be under the ROOT
folder and not under the ROOT/war
folder. That's why it's not working.
If you still wanted to have your war
folder within the ROOT
folder, you would have to change the url-pattern
to /war/myProject/call
.
Upvotes: 4
Reputation: 3024
look like, servlet is not initializing for you war try to change SERVLET tag as i.e. add tag
<load-on-startup>1</load-on-startup>
this tag ensures that servlet should be loaded
<servlet>
<servlet-name>callServlet</servlet-name>
<servlet-class>com.myproject.server.dao.Call</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
hopefully this will work
Upvotes: 0