Saturday, January 28, 2012

Re: Hosting issue

Hello Alen. It seems like you have got what the issue is . Yes you are
right . I tried changing the remote service servlet path. But it did
not help me. For getting a detailed view i will give some more data


Here is the web.xml file


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">


<web-app>

  <!-- Servlets -->
  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>rp.server.GreetingServiceImpl</servlet-class>
  </servlet>

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

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


</web-app>


  here is the gwt.xml file


<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='rpctesting'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>


  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->
  <inherits name='com.google.gwt.user.theme.clean.Clean'/>
  <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/>
-->
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->


  <!-- Other module inherits                                      -->


  <!-- Specify the app entry point class.                         -->
  <entry-point class='rp.client.Rpctesting'/>


  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>


</module>


here is the GreetingService.java  the synchronous file


  package rp.client;


import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;


/**
 * The client side stub for the RPC service.
 */
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
String greetServer(String name) throws IllegalArgumentException;
}


No other changes in the program given by the GWT web application
starter project


I have deployed the files inside the WAR folder to the prism folder of
my server


so that i can access my app by typing www.yellowlemon.in/prism/Rpctesting.html


But the server fails to map my servlet.


can you tell me ,where i have to change ?


<url-pattern>/rpctesting/greet</url-pattern>


You said "The url-pattern must be context-relative" . I did not get
this line


i think the problem happening on the above line . It works fine on
local machine but not on server


Yes as you said rpctesting is the module name . and in the server log
i am getting error like


 File does not
exist: /home/spectrum/public_html/prism/rpctesting/greet, referer:
http://yellowlemon.in/prism/Rpctesting.html


Hope you can help me on this.

On Jan 27, 7:30 pm, Alan Chaney <a...@mechnicality.com> wrote:
> 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 linkwww.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