Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在外部服务器上启动gwt项目,例如tomcat?_Java_Tomcat_Gwt - Fatal编程技术网

Java 如何在外部服务器上启动gwt项目,例如tomcat?

Java 如何在外部服务器上启动gwt项目,例如tomcat?,java,tomcat,gwt,Java,Tomcat,Gwt,我在本地主机上部署了gwt项目,并在eclipse上部署了gwt插件。一切正常。但当我尝试在外部(从tomcat)启动应用程序时,它无法正常工作。我将war内容放入webaaps文件夹。gwt的客户端工作正常,但与服务器端的连接存在问题 日志中的可能错误: 127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "GET /BugGitGwt/ HTTP/1.1" 200 2954 127.0.0.1 - - [07/Mar/2014:17:31:36 +0400]

我在本地主机上部署了gwt项目,并在eclipse上部署了gwt插件。一切正常。但当我尝试在外部(从tomcat)启动应用程序时,它无法正常工作。我将war内容放入webaaps文件夹。gwt的客户端工作正常,但与服务器端的连接存在问题

日志中的可能错误:

127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "GET /BugGitGwt/ HTTP/1.1" 200 2954
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "GET /BugGitGwt/buggitgwt/buggitgwt.nocache.js HTTP/1.1" 200 6004
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "GET /BugGitGwt/loading4.gif HTTP/1.1" 200 2164
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "GET /BugGitGwt/BugGitGwt.css HTTP/1.1" 200 708
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "GET /BugGitGwt/buggitgwt/gwt/clean/clean.css HTTP/1.1" 200 29325
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "GET /BugGitGwt/buggitgwt/0B29E478EEA6D0F7C8617BCA1D490240.cache.html HTTP/1.1" 200 161530
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "POST /BugGitGwt/buggitgwt/greet HTTP/1.1" 500 2820
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "POST /BugGitGwt/buggitgwt/greet HTTP/1.1" 500 2820
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "POST /BugGitGwt/buggitgwt/greet HTTP/1.1" 500 2820
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "GET /BugGitGwt/buggitgwt/gwt/clean/images/hborder.png HTTP/1.1" 200 1995
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "GET /BugGitGwt/buggitgwt/gwt/clean/images/circles.png HTTP/1.1" 200 1492
127.0.0.1 - - [07/Mar/2014:17:31:36 +0400] "GET /BugGitGwt/buggitgwt/gwt/clean/images/vborder.png HTTP/1.1" 200 298
或者这个:

INFO: The APR based Apache Tomcat Native library which allows optimal performance in 
production environments was not found on the 
java.library.path: C:\Program Files (x86)\Java\jdk1.6.0_45\bin;
C:\Windows\Sun\Java\bin;
C:\Windows\system32;
C:\Windows;C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;
C:\Program Files (x86)\AMD APP\bin\x86_64;
C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;
C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT; 
C:\Program Files (x86)\Java\jdk1.6.0_45\bin;
C:\apache-maven-3.1.1\bin;
C:\Program Files (x86)\MySQL\MySQL Utilities 1.3.6\;
C:\apache-ant-1.9.3\bin;
C:\Program Files (x86)\Java\jdk1.6.0_45\bin;
C:\Program Files (x86)\Git\bin; 
C:\Program Files (x86)\Git\cmd;;.
INFO: JSR 356 WebSocket (Java WebSocket 1.0) support is not available 
when running on Java 6. To suppress this message, run Tomcat on Java 7, 
remove the WebSocket JARs from $CATALINA_HOME/lib or add 
the WebSocketJARs to thetomcat.util.scan.DefaultJarScanner.jarsToSkip property in 
$CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7 
WebSocket API will be available. 
或者这个:

INFO: The APR based Apache Tomcat Native library which allows optimal performance in 
production environments was not found on the 
java.library.path: C:\Program Files (x86)\Java\jdk1.6.0_45\bin;
C:\Windows\Sun\Java\bin;
C:\Windows\system32;
C:\Windows;C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;
C:\Program Files (x86)\AMD APP\bin\x86_64;
C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;
C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT; 
C:\Program Files (x86)\Java\jdk1.6.0_45\bin;
C:\apache-maven-3.1.1\bin;
C:\Program Files (x86)\MySQL\MySQL Utilities 1.3.6\;
C:\apache-ant-1.9.3\bin;
C:\Program Files (x86)\Java\jdk1.6.0_45\bin;
C:\Program Files (x86)\Git\bin; 
C:\Program Files (x86)\Git\cmd;;.
INFO: JSR 356 WebSocket (Java WebSocket 1.0) support is not available 
when running on Java 6. To suppress this message, run Tomcat on Java 7, 
remove the WebSocket JARs from $CATALINA_HOME/lib or add 
the WebSocketJARs to thetomcat.util.scan.DefaultJarScanner.jarsToSkip property in 
$CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7 
WebSocket API will be available. 
web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee">

  <!-- Servlets -->
  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>ru.sersem.buggitgwt.server.DataProviderServiceImpl</servlet-class>
  </servlet>

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

  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>BugGitGwt.html</welcome-file>
  </welcome-file-list>

</web-app>

greetServlet
ru.sersem.buggitgwt.server.DataProviderServiceImpl
greetServlet
/胡说八道
BugGitGwt.html
服务:

@RemoteServiceRelativePath("greet")
public interface DataProviderService extends RemoteService {
    List<List<String>> getDatabaseData(String call);
}
@RemoteServiceRelativePath(“问候”)
公共接口DataProviderService扩展了RemoteService{
列出getDatabaseData(字符串调用);
}

从外部服务器运行GWT项目要遵循的步骤

  • 打开命令窗口
  • 导航到包含以下内容的war文件夹:

    war
    |
    |__GWTTestProject.html
    |__GWTTestProject.css
    |__gwttestproject folder
    |  |
    |  |__compiled js files and html files generated by GWT compilation
    |
    |__WEB-INF folder
       |
       |__classes
       |__deploy
       |__lib
       |__web.xml
    
  • 使用命令提示符执行以下命令以创建war文件

     jar -cf gwtproject.war *
    
  • 在tomcat webapps下复制gwtproject.war
  • 启动服务器
请在以下文件中再次检查:

web.xml:

  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>com.gwt.test.server.GreetingServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/gwtproject/greet</url-pattern>
  </servlet-mapping>
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
    Long greetServer(String name) throws IllegalArgumentException;
}

好的。有一件事。我们在企业中使用Java6,但GWT支持Java7。所以它在eclipse中的java 7下工作,但在系统环境中它关闭了。

您面临什么问题?请详细说明。Tomcat在同一台机器上吗?如果没有,可能您在某处有太多的
localhost
引用。需要更多关于特定错误的信息!我在同一台机器上使用tomcat。我使用gwt rpc。当我启动示例gwt应用程序时,我收到一个消息框,其中包含
,在尝试联系服务器时出错。请检查您的网络连接并重试。
如何获取有关错误的详细信息?请共享您为greet定义了servet映射的web.xml。URL
/BugGitGwt/BugGitGwt/greet
有问题。这将是
/buggitgwt/greet
。它不能解决问题。结果和以前一样。我会回来做更多的分析。我在从外部服务器运行时遇到了相同的异常。我使用Eclipse作为新的Web应用程序创建了一个新的示例GWT项目。一个新的GWT编译,然后按照上面提到的步骤和它的工作良好。请在删除缓存后使用新项目或GWT编译现有项目重试。请查看下面的答案。我通过更改Java解决了这个问题)感谢您的帮助它在jdk1.6.0_23和GWT 2.5.0中也能正常工作。谢谢。