java - 尝试在 Apache Tomcat 上部署 GWT 失败

标签 java eclipse apache tomcat gwt

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

我正在开发一个 gwt 项目并尝试将其部署到 Apache Tomcat。我以前从未使用过 Apache Tomcat,而且我对 Java 和 GWT 还比较陌生。我的 tomcat 服务器似乎已启动并正在运行,因为我在 localhost:8080/上看到“如果你看到这个,你已经成功安装了 Tomcat”

启动并运行 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) 给了我我的用户界面(登录屏幕),但是在进行第一次 RPC 调用时 (登录)我收到错误“FailureUnable to initiate the asynchronous service invocation (PurchaseOrderService_Proxy.checkUsernameAndPassword) -- check the network connection”

我的想法是我的 web.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);
}

web.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>

最佳答案

Opening the .html file (file:///C:/apache-tomcat-8.0.15/webapps/PurchaseOrder/PurchaseOrder.html) gives me my ui (login screen), but when making the first RPC call (loggin in) I am getting the error "FailureUnable to initiate the asynchronous service invocation (PurchaseOrderService_Proxy.checkUsernameAndPassword) -- check the network connection"

这不是您访问在 Tomcat 中运行的应用程序的方式。你的 tomcat 正在运行 @ localhost:8080 所以你必须使用 http://localhost:8080/<app_context_root>/filename.html 访问

关于java - 尝试在 Apache Tomcat 上部署 GWT 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26899528/

相关文章:

php - iReport 在 Linux 终端中运行,但无法使用 PHP exec 命令

java - 如何在 Selenium Java Webdriver 中验证图像的尺寸?

java - 如何捕获 Guava 重试器内的代码抛出的异常?

eclipse - Eclipse Indigo 中的 Tomcat 7 : javax. naming.NameNotFoundException: Resource/WEB-INF/classes not found

使用 GET 参数时 Apache Redirect 301 失败,例如 ?blah=

java - URI 的引用没有使用 Apache Santuario 的 XMLSignatureInput

java - 如果有人在我的浏览器中禁用 cookie,我该如何在 java 中进行 session ?

java - 为什么不使用 java web start 而不是其他 RIA 框架?

java - java中如何给jpanel添加jpanel

java - 重建 Maven 索引卡在 0%