开发者

gwt - problem accessing servlet in inherited module

I'm trying to divide my app into modules and I'm stuck with this problem:

I have a widget MapServiceWidget in one module called "webvisualisation" that uses the RPC to get the data from MapService Rpc interface. I'm inheriting this module in another GWT module called "led" (I packed "webvis..." into jar with sources, added in module "led" deffinition). Then I try to create this widget in the second ("led") module and get message

"Problem accessing /led/mapservice reason NOT FOUND".

And sure it can't find it cause mapservice is defined in inherited "webvisualisation" module.

The question is why it's looking for this servler implementation in "led" module not in "webvisualisation" where it's defined? I checked all module definitions and web.xml files several times and consulted documentations, it seems ok.. but it's not. If my description is not clear I can post some config/source files.

This is web.xml for webvisua开发者_运维技巧lisation module

<!-- Servlets -->
<servlet>
    <servlet-name>mapservice</servlet-name>
    <servlet-class>pl.gmike.webvis.server.MapServiceImpl</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>mapservice</servlet-name>
    <url-pattern>/webvisualisation/mapservice</url-pattern>
</servlet-mapping>

And for led it's just ordinary generated sample file

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

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


Seems that you're bumping into a classpath problem. Maybe check that your webvisualisation.jar is in the WEB-INF/lib directory of your web application.


I got it working. I just added servlet and servlet mapping entries to "led" modules web.xml so it look like this now:

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

<servlet>
    <servlet-name>mapservice</servlet-name>
    <servlet-class>pl.gmike.webvis.server.MapServiceImpl</servlet-class>
</servlet>

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

<servlet-mapping>
    <servlet-name>mapservice</servlet-name>
    <url-pattern>/led/mapservice</url-pattern>
</servlet-mapping>

As You can see the mapservice servlet is mapped here to /led/mapservice URL where GWT seems to look for it, unlike in original "webvisualisation" module web.xml where it was mapped to /wevisualisation/mapservice .

I'm not very satisfied with this solution, it works but it requires adding a servlet mapping in WebApps web.xml for every servlet in inherited module that I want to use or that is used somewhere in this inherited module.

Still I would like to know why servlet definitions and mappings from inherited modules are not included in WebApps web.xml during compilation/linking... I think it should work without such hacks, so there's something I'm doing wrong.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜