How to use GWT - RPC to Tomcat server

后端 未结 4 835
太阳男子
太阳男子 2021-01-15 09:16
  1. Installed Tomcat 6
  2. Installed Eclipse + GWT plugin
  3. Created GWT project with sample generated code
  4. Compliled GWT project (GWT compile)
相关标签:
4条回答
  • 2021-01-15 09:58

    You are probably compiling your classes with a newer jdk then the version tomcat is running on.

    0 讨论(0)
  • 2021-01-15 10:05

    I use GWT-SDK webAppCreator command (from terminal) and it generates all the files required to run on an external server like Tomcat.

    I will provide the steps i followed in order to help others begin with simple GWT-TOMCAT development

    TOMCAT

    1. Download a Tomcat version, i prefer Tomcat 6 http://apache.tsl.gr/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip

    2. Follow the instructions for your specific operation system in order to install it. I followed this tutorial (MAC-OS) http://www.malisphoto.com/tips/tomcatonosx.html

    GWT

    1. Download a GWT-SDK version (i use 2.0.4 which i find more stable and compatible with external sources like EXT-GWT library and TOMCAT) http://code.google.com/p/google-web-toolkit/downloads/list

    2. Open your TERMINAL if you are a UNIX user then change directory to the GWT-SDK you just downloaded

    3. Change permissions to run webAppCreator script. I usually modify permissions of all files by typing - > chmod 750 *

    4. Create a GWT project by executing in terminal -> ./webAppCreator -out MyProject com.myproject

    5. All files are automatically generated

    6. Switch directory to the project you just created, type in terminal -> cd MyProject

    7. Compile your project with the ant script provided by the GWT-SDK, type in terminal -> ant build

    8. Open you project and copy it's build.xml file, war/ contents to Tomcat's webapps/ROOT folder

    9. FINALLY open your browser type localhost:8080/ to run your project (It will open your project .html page by default because it is defined inside /WEB-INF/web.xml file)

    Congratulations!

    0 讨论(0)
  • 2021-01-15 10:09

    You can only get this error if the JDK version used to compile the classes is GREATER than the JDK version used by Tomcat. PERIOD. Pursuing any other avenue will be fruitless.

    what is the environment JAVA_HOME set to?

    Look at the Tomcat startup logs, what JDK is it using when it starts up, it is at the top of logs when it starts up

    Now look at your Development tool that compiled the classes. It MUST be using a different JDK with a higher version for you to get this error.

    0 讨论(0)
  • 2021-01-15 10:20

    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

    0 讨论(0)
提交回复
热议问题