尝试在 Apache Tomcat 上部署 GWT 失败



>我正在开发一个GWT应用程序。应用正在开发模式下工作。

我正在做一个gwt项目,并试图将其部署到Apache Tomcat。我以前从未使用过Apache Tomcat,我对Java和GWT相当陌生。我的 tomcat 服务器似乎已启动并运行,因为我在本地主机上看到"如果您看到此内容,您已成功安装 Tomcat":8080/

在我启动并运行Tomcat之后,我使用Eclipse GWT Compile来编译我的应用程序。我已经将我的.html文件和.css文件+war文件夹复制到C:\apache-tomcat-8.0.15\webapps\MyAPP\

打开.html文件 (file:///C:/apache-tomcat-8.0.15/webapps/PurchaseOrder/PurchaseOrder.html) 给了我 UI(登录屏幕),但是在进行第一次 RPC 调用(登录)时,我收到错误"失败无法启动异步服务调用 (PurchaseOrderService_Proxy.checkUsernameAndPassword) - 检查网络连接"

我的

问题是我的网络或我的服务类中的内容不正确.xml

PurchaseOrderService.java
package com.google.gwt.sample.purchaseorder.client;
import java.util.ArrayList;
import java.util.HashMap;
import com.google.gwt.sample.purchaseorder.client.model.Brands;
import com.google.gwt.sample.purchaseorder.client.model.Item;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@RemoteServiceRelativePath("exampleservice")
public interface PurchaseOrderService extends RemoteService {
  boolean checkUsernameAndPassword(String value, String value2);
  ArrayList<Item> getPersonalInfo();
  HashMap<String, ArrayList<Item>> getListOfPurchaseOrderSortedFromBrands();
  String createExcelExportFile(HashMap<String, ArrayList<Item>> exportMap);
}

网站.xml:

  <!-- Servlets -->
  <servlet>
    <servlet-name>purchaseOrderServiceImpl</servlet-name>
    <servlet-class>com.google.gwt.sample.purchaseorder.server.PurchaseOrderServiceImpl</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>purchaseOrderServiceImpl</servlet-name>
    <url-pattern>/purchaseorder/exampleservice</url-pattern>
  </servlet-mapping>
  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>PurchaseOrder.html</welcome-file>
  </welcome-file-list>
</web-app>

打开.html文件 (file:///C:/apache-tomcat-8.0.15/webapps/PurchaseOrder/PurchaseOrder.html) 给了我我的 UI(登录屏幕),但是在进行第一次 RPC 调用时 (登录)我收到错误"失败无法启动 异步服务调用 (PurchaseOrderService_Proxy.checkUsernameAndPassword) -- 选中 网络连接"

这不是您访问在 Tomcat 中运行的应用程序的方式。您的雄猫正在运行@ localhost:8080,因此您必须使用http://localhost:8080/<app_context_root>/filename.html访问

最新更新