Deploy GWT app in Tomcat as ROOT

69 views
Skip to first unread message

Xybrek

unread,
Dec 8, 2011, 12:29:13 AM12/8/11
to Google-We...@googlegroups.com
Hi,

I've been trying to deploy my gwt app in Tomcat server but I am having
problem running the application rpc in the ROOT, I mean, if the app is
deployed like:

webapps/mygwapp

I works, if the servlet defined in the web.xml is like this:

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

In this case: http://localhost:8080/mygwtapp/greet works just fine.

However if I move the app inside the ROOT, that is renamed the folder
mygwtapp to ROOT

The applications RPC fails. If I change the the url mapping to just
<url-pattern>/greet</url-pattern>

It still wont work. Any ideas?

Thanks.

Kanagaraj M

unread,
Dec 8, 2011, 12:45:48 AM12/8/11
to google-we...@googlegroups.com, Google-We...@googlegroups.com
The problem is in your @RemoteServiceRelativePath("greet")
The above always append(as prefix) your app name with 'greet', so it would expect a servlet mapping /mygwtapp/greet
Try using ServiceDefTarget 

Xybrek

unread,
Dec 8, 2011, 12:52:24 AM12/8/11
to Google-We...@googlegroups.com
> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/u1_iOLtqP7EJ.
> To post to this group, send email to
> google-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

I see, then I can then rename the url-pattern into just
<url-pattern>/greet</url-pattern>?

Xybrek

unread,
Dec 8, 2011, 12:57:27 AM12/8/11
to Google-We...@googlegroups.com
On Thursday, 08 December, 2011 01:45 PM, Kanagaraj M wrote:
> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/u1_iOLtqP7EJ.
> To post to this group, send email to
> google-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

How to map the client-side service to match the servlet mapping '/greet'?

Kanagaraj M

unread,
Dec 8, 2011, 1:01:04 AM12/8/11
to google-we...@googlegroups.com, Google-We...@googlegroups.com
GreetingServiceAsync serviceAsync= (GreetingServiceAsync)GWT.create(GreetingService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) serviceAsync;
String moduleRelativeURL = " http://localhost:8080/"+ "greet";
endpoint.setServiceEntryPoint(moduleRelativeURL);

Kanagaraj M

unread,
Dec 8, 2011, 1:06:12 AM12/8/11
to google-we...@googlegroups.com, Google-We...@googlegroups.com
That is what ServiceDefTarget is doing.
You need to have servlet mapping as following

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

Kanagaraj M

unread,
Dec 8, 2011, 1:06:50 AM12/8/11
to google-we...@googlegroups.com, Google-We...@googlegroups.com

Xybrek

unread,
Dec 8, 2011, 1:23:14 AM12/8/11
to Google-We...@googlegroups.com
On Thursday, 08 December, 2011 02:01 PM, Kanagaraj M wrote:
> GreetingServiceAsync serviceAsync= (GreetingServiceAsync)GWT.create(GreetingService.class);
> ServiceDefTarget endpoint= (ServiceDefTarget) serviceAsync;
> String moduleRelativeURL= " http://localhost:8080/ <http://localhost:8080/mygwtapp/greet>"+ "greet";
>
> endpoint.setServiceEntryPoint(moduleRelativeURL);

>
> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/sywCmOmYtpgJ.

> To post to this group, send email to
> google-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

Hi I see thanks, however I am still trying to remember how I did it
before. I am not sure I used that kind of approach you suggested.

Reply all
Reply to author
Forward
0 new messages