问题
i can't get a comet chat example to run. i get this error
[WARN] 404 - GET /birgit.chat.Chat.nocache.js (127.0.0.1) 1413 bytes
this is how my web.xml looks like
<servlet>
<servlet-name>chatComet</servlet-name>
<servlet-class>net.zschech.gwt.comet.server.CometServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>chatServiceImpl</servlet-name>
<servlet-class>birgit.chat.server.ChatServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>chatServiceImpl</servlet-name>
<url-pattern>/birgit.chat.Chat/chat</url-pattern>
</servlet-mapping>
This is my Chat.gwt.xml
<!DOCTYPE module SYSTEM "http://google-web-toolkit.googlecode.com/svn/trunk/distro- source/core/src/gwt-module.dtd">
<module >
<inherits name="com.google.gwt.user.User" />
<inherits name="com.google.gwt.user.theme.standard.Standard" />
<inherits name="net.zschech.gwt.comet.Comet" />
<servlet class="birgit.chat.server.ChatServiceImpl" path="/chat"/>
<entry-point class="birgit.chat.client.ChatEntryPoint" />
</module>
Those are packages i use
package birgit.chat.client;
package birgit.chat.server;
I think there is something wrong with path but i am out of ideas.
Please help. Thank you.
回答1:
First you should rename your module name in your *.gwt.xml , module has rename-to attribute which renames the module. After that you can reference your *.nocache.html with renamed module name.
<module rename-to="chatModule">
<inherits name="com.google.gwt.user.User" />
<inherits name="com.google.gwt.user.theme.standard.Standard" />
<inherits name="net.zschech.gwt.comet.Comet" />
<servlet class="birgit.chat.server.ChatServiceImpl" path="/chat"/>
<entry-point class="birgit.chat.client.ChatEntryPoint" />
</module>
and in your html page:
<script type="text/javascript" language="javascript"
src="chatModule/Chat.nocache.js"></script>
来源:https://stackoverflow.com/questions/8946831/gwt-warn-404-get-birgit-chat-chat-nocache-js-comet