Sunday, August 22, 2010

GWT error - com.google.gwt.user.client.rpc.ServiceDefTarget $NoServiceEntryPointSpecifiedException: Service implementation URL not specified

Note that the solution depends on the GWT version. I was using GWT 2.0+

Just ensure that service relative path is mentioned in your client service interface via annotation

com.google.gwt.user.client.rpc.RemoteServiceRelativePath

An example,

@RemoteServiceRelativePath("sampleService")
public interface SampleService extends RemoteService {
..
}

If you want to understand why 
or
if you using older version of GWT then the annotation won't be available for you so 
here is the answer.

This is mentioned in GWT dev guide under 'Common pitfall' but i didn't read it earlier,
"When running your RPC call, development mode displays an excaption NoServiceEntryPointSpecifiedException: Service implementation URL not specified. This error means that you did not specify a @RemoteServiceRelativePath in your service interface, and you also did not manually set target path by calling ServiceDefTarget.setServiceEntryPoint()."
    Also note this one that's closely related to above one,
    "If invoking your RPC call fails with a 404 StatusCodeException, your web.xml may be misconfigured. Make sure you specified a @RemoteServiceRelativePath and that the <url-pattern> specified in your web.xml matches this value, prepended with the location of your GWT output directory within the war directory."

    For every annotation definition given above, corresponding entry for service impl should be given in web deployment descriptor i.e web.xml. As an example,

       <servlet>
            <servlet-name>sampleServlet</servlet-name>
            <servlet-class>samples.gwt.SampleServiceImpl</servlet-class>
        </servlet>

        <servlet-mapping>
            <servlet-name>sampleServlet</servlet-name>
            <url-pattern>/sample-gwt-module/sampleService</url-pattern>
        </servlet-mapping>
     
    where


     sample-gwt-module

    is the (alternate) name of the sample GWT module as defined in module definition as


    <module rename-to='addressbookmain'>

    No comments:

    Post a Comment