Friday, January 27, 2012

Re: Hosting issue

The problem is nothing to do with GWT, or really, Tomcat for that
matter. Somewhere in your code you are making a URL request which has
the path:

/home/spectrum/public_html/prism/rpctesting/greet

which looks an extremely unlikely URL to me.

The things to check are:

@RemoteServiceRelativePath in your RPC

I suspect that it probably looks like:

@RemoteServiceRelativePath("greet")

and then the web.xml file for the server should look something like:

<!-- servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<!-- this should be the class of the server-side implementation of your 'Greet Service' which should
extend RemoteServiceServlet-->
<servlet-class>com.mycompany.myproject.server.rpc.GreetServiceImpl</servlet-class>
</servlet>

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

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

Where your GWT project is XXX.

The url-pattern must be context-relative. What is often confusing about this is that the default Jetty implementation in the development
mode has a context of "/", but when you deploy it to tomcat by default the context becomes the name of the war, which is often also
the project name.

Consequently the actual request looks something link www.myserver.com/XXX/XXX/greet. This is because the context relative path for the JS files which make up your project are, by default, in a folder with the same name as the gwt.xml module, or its 'shorthand' module name. Since its common to make the module name the same as the project, the war ends up with the same name as the module, and the deployed context is the project name. Confused? Maybe this will explain it more clearly:

Eclipse project: Myproject
GWT module com.mycompany.myproject.Mymodule
module contains <module rename-to='mymodule'>

Your eclipse project structure will have<workspace>/Myproject/war (and src, test, etc)

in /Myproject/war there will be a folder called mymodule which will contain all your gwt compiler output (JS files) - this folder is
generated automatically by GWT and if you change the module name ('rename-to') it will generate a new folder with the new name.

If you deploy this to tomcat, you cannot use the Export-->Web->War option because eclipse does not recognize a GWT project as a WebApplication project by default, but lets imagine that you call the war file mywar.war.


consequently any RPC requests will be:

http://www.mycompany.com/mywar/mymodule/greet
<tomcat handles this -------->|<gwt handles this>

I suggest that you read through what I've written above very carefully and compare it to your project and then trace the actual calls with Firebug or Wireshark and see what's happening. There are lots of opportunities for typos and misunderstandings.

If this does not help the next thing to do is to put some logging or debugging in your project and try and work out where in the code the problem is. That's not really an issue for this list, because only you can debug your program.


As for your earlier question "does anyone actually host gwt files with tomcat", I've done maybe 10 or 15 separate installations of tomcat6 and tomcat7 hosting war files generated from GWT and they work just fine.

HTH

Alan


On 1/26/2012 8:58 PM, Nitheesh Chandran wrote:
> Ok ,
>
> Its just a web application starter project. I ran the project in the
> development mode and in the local apache tomcat server . Its working
> there. The same thing i have deployed to a remote server and i am
> facing the issue.
>
> Our version of GWT is : GWT 2.3.0
>
> server OS : cent os 5.0
>
> The servlet container in the server is : Tomcat
>
> development platform is : windows 7
>
> I have deployed the WAR files to the server by using normal FTP
> first. It was not working .So we have tried by converting war to .war
> file and deployed in the server. That is also not working now. The
> same issue i am facing.
>
>
> /home/spectrum/public_html/prism/rpctesting/greet , greet is the
> remote servlet path to my servlet. The server is not mapping to this
> servlet ,that is why it is not working.But it works fine in local
> machine and even in the app engine also.
>
>
>
>
> On Jan 26, 6:24 pm, Alan Chaney<a...@mechnicality.com> wrote:
>> On 1/26/2012 1:23 AM, Nitheesh Chandran wrote:> Hello ,
>>
>>> Please reply on the following issue , fed up with this one
>> You don't actually give very much information:
>>
>> - version of GWT
>> - server OS
>> - are you running Jetty or Tomcat?
>> - development platform?
>>
>> How are you deploying? Copying files to remote server? Bundling as a war?
>>
>>
>>
>>> I just tried to deploy a starter project in the remote server. I am
>>> getting the following error in the server log
>>> [Tue Jan 24 04:26:47 2012] [error] [client 14.140.69.18] File does not
>>> exist: /home/spectrum/public_html/prism/rpctesting/greet, referer:
>>> http://yellowlemon.in/prism/Rpctesting.html
>>> [Tue Jan 24 04:26:47 2012] [error] [client 14.140.69.18] File does not
>>> exist: /home/spectrum/public_html/404.shtml, referer:
>> Where is the file
>>
>> /home/spectrum/public_html/prism/rpctesting/greet ?
>>
>> On your local machine? On the server? Why are you trying to read a file from the filing system?
>>
>>
>>
>>
>>
>>
>>
>>> http://yellowlemon.in/prism/Rpctesting.html
>>> Does anyone know or has anyone successfully hosted a GWT RPC
>>> application on a server ?? please reply

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment