How to run a GWTP web application with IntelliJ on local Tomcat server?

262 views Asked by At

Is there a way to run a gwtp project on Intellij Idea and local Tomcat server? I tried it with run smart Tomcat and GWT configration, but I received an error like this:

Uncaught Error: java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code! It cannot be called, for example, from server code.

This means that I am not allowed to use client code in server code. This is so bad, because this project runs perfectly on global server nginx and tomcat. The project also runs perfectly on local in development mode, with GWT configuration and different pom.xml.

Also, I receive the error if I do not start a GWT configuration:

could not load app from super dev mode at server http://localhost:9876

2

There are 2 answers

0
sajad kamali On BEST ANSWER

It's funny that I ran into this problem again after a long time. Both war address should be the same. tomcat and run configuration.

Sample of run conf for this state:

-logLevel
INFO
-startupUrl
App.html
-war
<your project war directory. Ex: /target/gwttakeexam-0.0.1-SNAPSHOT>
-bindAddress
<your local IP address>
-noserver
-codeServerPort
<some free port: 8085>
-port
<tomcat server port: 8080>
-generateJsInteropExports
onlineducation.monta.App

Tomcat deployment conf

Dev mode parameters of GWT run conf

0
sajad kamali On

Here is my answer. My mistake was in the GWT configuration. I used the wrong -war direction in the dev mode parameters. Specifically, I had a local GWTP project that had a local war with GWT client code. Sadly, I used that war in my new GWTP project. I modified my war address and recompiled my project without GWT client code.