0

我已将 maven 项目提交给 svn 它在我的机器上运行,但是当其他人导入该 maven 项目时,它们会出现异常:

Module声明了一个servlet类.......,但是web.xml没有对应的映射;请将以下几行添加到您的 web.xml

这个类属于我的项目使用的库。我不明白有什么问题。请帮我。

模块.gwt.xml:

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='engile'>
  <!-- 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                                      -->

    <inherits name="com.google.gwt.inject.Inject" />
    <inherits name="com.appops.ui.basic.Fields" />
    <inherits name='com.mvp4g.Mvp4gModule' />
    <inherits name="gwtupload.GWTUpload"/>
    <inherits name='com.google.api.gwt.oauth2.OAuth2'/>
    <inherits name="com.google.gwt.xml.XML"/>
    <inherits name="org.atmosphere.gwt.Client"/>

    <!-- Logger at client side -->
    <inherits name = "com.google.gwt.logging.Logging"/>  
    <set-property name="gwt.logging.enabled" value="TRUE"/>
    <set-property name="gwt.logging.logLevel" value="INFO"/>
    <set-property name="gwt.logging.popupHandler" value="DISABLED" />
    <set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" />

  <!-- Specify the app entry point class.                         -->
  <entry-point class='com.engile.client.Engile'/>

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


<!--  <set-property name="user.agent" value="safari"/> 
  <set-property name="user.agent" value="gecko1_8"/> -->

</module>

网页.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
  <filter>
    <filter-name>guiceFilter</filter-name>
    <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>guiceFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <listener>
    <listener-class>com.engile.server.guice.BootstrapListener</listener-class>
  </listener>
  <servlet>
    <description>AtmosphereServlet</description>
    <servlet-name>AtmosphereServlet</servlet-name>
    <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
    <init-param>
      <param-name>org.atmosphere.disableOnStateEvent</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>org.atmosphere.cpr.AtmosphereHandler</param-name>
      <param-value>com.engile.server.services.AtmosphereHandler</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>AtmosphereServlet</servlet-name>
    <url-pattern>/engile/gwtComet</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>remoteLoggingService</servlet-name>
    <servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>remoteLoggingService</servlet-name>
    <url-pattern>/engile/remote_logging</url-pattern>
  </servlet-mapping>

<!--   <servlet> 
  <servlet-name>testImpl</servlet-name> 
  <servlet-class>com.appops.server.TestImpl</servlet-class> </servlet>
   <servlet-mapping> <servlet-name>testImpl</servlet-name>
    <url-pattern>/engile/test</url-pattern>
     </servlet-mapping> -->
  <welcome-file-list>
    <welcome-file>Engile.html</welcome-file>
  </welcome-file-list>
</web-app>
4

1 回答 1

0

您需要检查所有扩展RemoteService并声明RemoteServiceRelativePath注释的接口,确保所有此类相对路径都映射到 web.xml

示例 - 在https://developers.google.com/web-toolkit/doc/latest/tutorial/RPC

@RemoteServiceRelativePath("stockPrices")
public interface StockPriceService extends RemoteService { 
}

被映射到

  <!-- Servlets -->
  <servlet>
    <servlet-name>stockPriceServiceImpl</servlet-name>
    <servlet-class>com.google.gwt.sample.stockwatcher.server.StockPriceServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>stockPriceServiceImpl</servlet-name>
    <url-pattern>/stockwatcher/stockPrices</url-pattern>
  </servlet-mapping>
于 2013-01-15T09:27:29.903 回答