RPC用于Tomcat服务器

RPC用于Tomcat服务器

本文介绍了如何将GWT-RPC用于Tomcat服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装了Eclipse + GWT插件
  • 创建了具有示例
    的GWT项目代码
  • Compliled GWT项目(GWT编译)
  • 将war(编译)目录从
    复制到eclipse的工作区到TOMCAT
    webapps / ROOT文件夹
  • 在我的浏览器中运行localhost:8080

    sample.html页面GWT项目显示正确,但是当我尝试进行服务器调用时发生错误。




    • Jetty没有问题
      (Eclipse GWT开发模式) - rpc
      工作正常

    • TOMCAT存在的问题。


    在TOMCAT的catalina.out日志中说:
    $ b

    我猜在WEB_INF / web.xml的servlet定义处可能存在问题,这里是我的web.xml

     < web- app xmlns =http://java.sun.com/xml/ns/javaee
    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 >

    < display-name>欢迎使用Tomcat< / display-name>
    < description>
    欢迎来到Tomcat
    < / description>

    <! - Servlets - >
    < servlet>
    < servlet-name> greetServlet< / servlet-name>
    < servlet-class> com.tomcat.server.GreetingServiceImpl< / servlet-class>
    < / servlet>

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

    < welcome-file-list>
    < welcome-file> Tomcat.html< / welcome-file>
    < / welcome-file-list>

    < / web-app>


    解决方案

    当我部署到我的Godaddy时,托管服务器。它在我的本地机器上正常工作,但不是在部署时。我得到了同样的确切的错误信息。问题是你编译你的代码的是一个更新的,然后Tomcat正在使用的Java版本。

     安装jdk1.5.0_22(或者任何你的tomcat服务器正在使用的)
    可能需要重新启动你的机器
    Eclipse-> Window->首选项 - > Java->安装JRES->添加
    标准虚拟机 - >下一步
    浏览到您的jdk目录
    完成
    清理项目
    编译项目
    重新部署并交叉手指!

    这对我有用,如果它不适合你,那么... ya ...它应该工作。祝你好运

    1. Installed Tomcat 6
    2. Installed Eclipse + GWT plugin
    3. Created GWT project with samplegenerated code
    4. Compliled GWT project (GWT compile)
    5. Copied war (compiled) directory fromeclipse's workspace to TOMCATwebapps/ROOT folder
    6. Run localhost:8080 at my browser

    The sample.html page from the GWT project displays correct but when i try to make a server call an error occurs.

    • No problem with jetty(Eclipse GWT develpment mode) - rpcwork's fine
    • PROBLEM at TOMCAT.

    The catalina.out log at TOMCAT says:

    I guess there might be a problem at WEB_INF/web.xml at servlet definition, here's my web.xml

    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
       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">
    
      <display-name>Welcome to Tomcat</display-name>
      <description>
         Welcome to Tomcat
      </description>
    
      <!-- Servlets -->
      <servlet>
        <servlet-name>greetServlet</servlet-name>
        <servlet-class>com.tomcat.server.GreetingServiceImpl</servlet-class>
      </servlet>
    
      <servlet-mapping>
        <servlet-name>greetServlet</servlet-name>
        <url-pattern>/tomcat/greet</url-pattern>
      </servlet-mapping>
    
      <!-- Default page to serve -->
      <welcome-file-list>
        <welcome-file>Tomcat.html</welcome-file>
      </welcome-file-list>
    
    </web-app>
    
    解决方案

    I had this same issue when I deployed to my Godaddy hosting server. It worked fine on my local machine but not when I deployed. I got the same exact error message. The problem is you compiled your code with a version of java that is newer then that of which Tomcat is using.

    Install jdk1.5.0_22 (Or whatever your tomcat server is using)
    Probably need to restart your machine
    Eclipse->Window->Preferences->Java->Installed JRES->Add
    Standard VM->Next
    Browse to the directory of your jdk
    Finish
    Clean the project
    Compile the project
    Redeploy and cross your fingers!
    

    This worked for me, if it doesn't for you then....ya...it should work. Good luck

    这篇关于如何将GWT-RPC用于Tomcat服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 09-03 09:07