0

I deployed my gwt project on localhost with gwt-plugin on eclipse. Everything works fine. But when I try to launch application outside (from tomcat) it doesn't work normally. I put war content into webaaps folder. The client side of gwt works well but there is a problem with connection to server side.

Probable error from logs:

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

or this:

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

or this:

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>

Service:

@RemoteServiceRelativePath("greet")
public interface DataProviderService extends RemoteService {
    List<List<String>> getDatabaseData(String call);
}
8
  • What problems are you facing? Please elaborate.
    – pratZ
    Mar 7, 2014 at 13:02
  • Tomcat on the same machine? If not, perhaps you have too many localhost references somewhere. Need more info on specific error, though! Mar 7, 2014 at 13:06
  • I use tomcat on the same machine. I use gwt-rpc. When I launch the sample gwt-appliation I get message box with An error occurred while attempting to contact the server. Please check your network connection and try again. How could I get more info about error?
    – cadmy
    Mar 7, 2014 at 13:12
  • 1
    Please share web.xml where you have defined servet mapping for greet.
    – Braj
    Mar 7, 2014 at 14:21
  • 1
    Something is wrong with URL /BugGitGwt/buggitgwt/greet. It would be /buggitgwt/greet.
    – Braj
    Mar 7, 2014 at 14:26

2 Answers 2

1

Step to follow to run GWT project from external server.

  • Open command window
  • Navigate to war folder that contains following things:

    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
    
  • Execute following command using Command prompt to create a war file

     jar -cf gwtproject.war *
    
  • Copy gwtproject.war under tomcat webapps
  • start the server

Please check it again in following files:

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>

GreetingService:

@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
    Long greetServer(String name) throws IllegalArgumentException;
}
5
  • It doesn't solve the problem. The result is the same as before.
    – cadmy
    Mar 7, 2014 at 14:27
  • 1
    I will come back with some more analysis.
    – Braj
    Mar 7, 2014 at 14:31
  • I got same exception while running it from external server. I created a new sample GWT project using Eclipse as a new Web application. A fresh GWT compile and then follow the above mentioned steps and Its working fine. Please try it again with new project or GWT compile with existing project after removing cache.
    – Braj
    Mar 7, 2014 at 15:40
  • Look at my answer below. I solved the problem by changing Java) Thank you for help
    – cadmy
    Mar 7, 2014 at 15:42
  • Its also working fine with jdk1.6.0_23 and GWT 2.5.0. Thanks a lot.
    – Braj
    Mar 7, 2014 at 15:46
0

Okay. There was a thing. We use Java 6 in our enterprise but GWT supports Java 7. So it works under java 7 in eclipse but in system environment it was down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.