Production enviornment works fine but hosted mode does not!

6 views
Skip to first unread message

Payam

unread,
Jan 3, 2008, 12:20:05 AM1/3/08
to Google Web Toolkit
Hi all,

I started off the following thread regarding the fact that my app was
working fine in the hosted mode but not in the production environment
after I deploy it.

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/623acb59e3b6d0fe

Now after following the suggestions in the above discussion thread, my
production environment is fixed but my hosted environment is broken.
Not sure what I need to do to get both environments up and running
now!

This is the error message I am getting:

The development shell servlet received a request for
'IncidentAssociationService' in module 'gwtView.test'

I tried replacing the web.xml that is under comes with the embedded
tomcat (tomcat\webapps\ROOT\WEB-INF\web.xml) to my web.xml noted above
for my production environment, but that did not fix anything. I got
the same exact error!

What do I need to do now such that both environments work fine?

Thanks again,
Payam

Eric Ayers

unread,
Jan 3, 2008, 7:39:52 AM1/3/08
to Google-We...@googlegroups.com
Payam,

This comes up a lot and I'm adding it to the 1.5 FAQ list.

This usually means that your server side code is not compiled or not in the classpath for running in hosted mode.  If you use an IDE like Eclipse, this is usually not a problem, as eclipse compiles all .java files it finds.  If you are using something like 'ant' to compile your code, make sure it compiles the files  in your 'server' class and they are available to hosted mode when you run it.

-Eric.

Eric Ayers

unread,
Jan 3, 2008, 7:50:27 AM1/3/08
to Google-We...@googlegroups.com
Of significant note, if you are simply using a plain text editor and the XXX-shell and  XXX-compile script created by applicationCreator, these scripts  do *NOT* compile server side code. 




--
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

Eric Ayers

unread,
Jan 3, 2008, 7:59:59 AM1/3/08
to Google-We...@googlegroups.com
FAQ_HostedModeRPCsResourceNotFound  
Why do I get a "resource not found" error when making an RPC call in hosted mode.

Why do I get a "resource not found" error when making an RPC call in hosted mode?

When testing a new RPC interface, you may get the following message when running in hosted mode:

The
 development shell servlet received a request for 'rpcs/myService' 
in module 'com.example.RPCExample' 
   
Resource not found: rpcs/myService

This means that the servlet engine could not find the server-side definition of your RPC method. Check the following:

  • The server side code should be compiled before starting hosted mode. Of significant note, if you are simply using a plain text editor and the <module>-shell and <module>-compile scripts created by applicationCreator, these scripts do NOT compile server side code.
  • Make sure the server code path is listed in the <module>.gwt.xml file:
     
<!-- Example servlet loaded into hosted mode tomcat       -->
     
<servlet path ="/myService" class="com.example.server.MyServiceImpl" />
  • Make sure the compiled server classes are available to the hosted mode shell. You may need to modify the classpath when launching the hosted mode shell (for example, by editing <module>-shell) if your server classes are in a separate jar file or directory tree.

Let me know if that helps or if you find some problem with it.

Thanks,
-Eric

Isaac Truett

unread,
Jan 3, 2008, 8:15:30 AM1/3/08
to Google-We...@googlegroups.com
Payam,

Also make sure that the path attribute in your gwt.xml's servlet tag
matches the url-pattern in your web.xml. These both need to stay in
sync with the URL your client code is requesting.

Hope that helps,
Isaac

On Jan 3, 2008 12:20 AM, Payam <payam...@gmail.com> wrote:
>

Isaac Truett

unread,
Jan 3, 2008, 8:22:57 AM1/3/08
to Google-We...@googlegroups.com
Eric,

The new FAQ looks good. It brings to my mind a possible error-handling
improvement. I see two error cases:

1. There is no <servlet> tag mapping the requested path to a class.
2. The class could not be found.

Would it be too difficult (I haven't looked up the relevant code) to
differentiate the error messages for these two scenarios? In the first
case I suppose there's no way to tell a failed RPC call from a request
for a non-existent static file, but in the second case I imagine
there's something comparable to a ClassNotFoundException that could be
caught and handle separately.

Payam

unread,
Jan 3, 2008, 10:10:50 AM1/3/08
to Google Web Toolkit
Eric,

Thanks for your reply. It is strange since I am using eclipse for
development and am trying to bring up the shell when in eclipse. I did
not have this problem until I made the changes noted in the pasted
link above to fix my the deployment issue I had.

Any other thoughts you might have with regards to what I need to check
given I am running under eclipse and my server side code should be
automatically compiled, which it is.

Thanks in advance,
Payam

On Jan 3, 7:39 am, "Eric Ayers" <zun...@google.com> wrote:
> Payam,
>
> This comes up a lot and I'm adding it to the 1.5 FAQ list.
>
> This usually means that your server side code is not compiled or not in the
> classpath for running in hosted mode.  If you use an IDE like Eclipse, this
> is usually not a problem, as eclipse compiles all .java files it finds.  If
> you are using something like 'ant' to compile your code, make sure it
> compiles the files  in your 'server' class and they are available to hosted
> mode when you run it.
>
> -Eric.
>
> On Jan 3, 2008 12:20 AM, Payam <payam.f...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi all,
>
> > I started off the following thread regarding the fact that my app was
> > working fine in the hosted mode but not in the production environment
> > after I deploy it.
>
> >http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
>
> > Now after following the suggestions in the above discussion thread, my
> > production environment is fixed but my hosted environment is broken.
> > Not sure what I need to do to get both environments up and running
> > now!
>
> > This is the error message I am getting:
>
> > The development shell servlet received a request for
> > 'IncidentAssociationService' in module 'gwtView.test'
>
> > I tried replacing the web.xml that is under comes with the embedded
> > tomcat (tomcat\webapps\ROOT\WEB-INF\web.xml) to my web.xml noted above
> > for my production environment, but that did not fix anything. I got
> > the same exact error!
>
> > What do I need to do now such that both environments work fine?
>
> > Thanks again,
> > Payam
>
> --
> Eric Z. Ayers - GWT Team - Atlanta, GA USAhttp://code.google.com/webtoolkit/- Hide quoted text -
>
> - Show quoted text -

Eric Ayers

unread,
Jan 3, 2008, 11:17:55 AM1/3/08
to Google-We...@googlegroups.com
Isaac,

I took an hour or so looking at how to do this and .   What happens is that when an HTTP request comes in to the hosted mode backend running at port 8888, it first looks to see if there is a servlet to delegate to (configured by the <servlet> tag) and then it falls through to try to find files in the public path.  By the time the logic gets to the point where it can't find the requested resource, it doesn't know what the client was asking for (was it supposed to be a file on disk or delegated to a servlet?) 

To really make a good error message, the hosted mode backend would have to be able to look at a URL and know that it is supposed to be an RPC  request.  The only way we have to tell that at the moment is by the <servlet> tag. 

I will submit a patch with a suggestion that a file is missing from the public path or there is a missing <servlet> tag right in the "resource not found" error message.

Reply all
Reply to author
Forward
0 new messages