How enable production mode in GWT 2.7 application - gwt

I would like to deploy my GWT 2.7 application on my server through gwt-maven-plugin and jenkins. But, after compile process, when I launch my application, I've this error message :
Couldn't load APPLICATION_NAME from Super Dev Mode
server at http://MY_IP:9876.
Please make sure this server is ready.
Indeed, the super dev mode is enabled by default since 2.7. So, how disable it to use production mode ?

Ok thank you very much for your comment. Indeed, my problem concerned the *.nocache.js and *.devmode.js files. I started my project (my first one in GWT) in 2.6 version and these files were created (by dev and super-dev-mode) and versionned by my fault. So, when my jenkins deployed my project, it used these files so even if I did mvn clean before deploy it had no effect.
So, I removed these files from my project and I did a mvn clean install before deploy to fix my issue.

Related

Play 2.5.6 application on Tomcat or any alternative?

I have created an application on Play framework 2.5.6. I am trying to find out what is the best way to deploy the application on production. I have tomcat installed on my Ubuntu machine. How to create war file and How to deploy on tomcat? I am using Scala Eclipse IDE for development.
Have a look at this other thread which is very similar to what you're asking here (albeit directed at GAE).
In a nutshell, the disadvantages of deploying your app to Tomcat are:-
you have extra work to do to package your application as a WAR
extra work to deploy it
your application may not be fully asynchronous running in Tomcat
As that outdated documentation suggests - the simplest way of deploying your app in production is just using the version of Netty which is packaged as part of a Play application. See the relevant version of the docs to create a distribution. You only need a relevant version of a JVM on your prod server in this case.
The flow is generally:-
Run $ dist to build the binary (this is a zip by default, but you can also build a tar if you prefer using $ universal:packageZipTarball instead of dist).
Move it into your Linux production environment
Unpack it
Set permissions if you build a zip $ chmod +x /path/to/bin/<project-name> (not required if you created the tar)
Run the app start script (created by the dist task) eg. $ target/universal/stage/bin/<project-name>

How do I automatically compile Coffeescript using Typesafe?

First of all I would like to mention that I have downloaded "play-scala-intro" template from Playframework official website, after running this project using terminal command ./activator ui (Ubuntu), the Typesafe UI web application started to listen on port 8888, and "play-scala-intro" application on port 9000.
At every change and save inside the project, application is rebuilt and the single thing what is not is Coffeescript.
I'm trying to recompile somehow Coffeescript, on project rebuild. Activator version what I use is 1.3.3
I think the root cause might be related to the activator UI running Play in prod mode vs develop mode. This question is similar:
How to run play project in dev mode with Typesafe Activator UI
According to Play CoffeeScript Page
CoffeeScript sources are compiled automatically during an assets command, or when you refresh any page in your browser while you are running in development mode. Any compilation errors will be displayed in your browser:
To run in dev mode go into the folder that got created when you fetched the template and use the command: activator run
For what its worth to run in prod mode you use activator start command.
Here is what I saw in the console which led me to believe it is prod mode:
This might only be the UI application but like you I could not get the coffeescript to recompile in this configuration.
For some activator templates there is more content in the tutorial but this one relies on a video so if you are comfortable with an editor or IDE I think you can watch the associated video Introduction to Play Framework for Scala developers
and follow along locally.

Gwt hosted mode stopped working from Eclipse on adding a special dependency via maven

On integrating a library on server side of my gwt app (maven, gwt 2.4) the development/hosted mode stopped working. The app works fine if deployed or run with "gwt:run" and all unit tests and integration tests pass as before.
If i start development mode (run/debug as web application) from Eclipse the develpoment mode view pops up but nothing else happens. normally the console should show some output but console keeps empty. So i don't even have a hint whats going wrong.
Can someone give some advice where to look / what to do to get at least a hint what's wrong?
if i check out the revision before integrating the library the development mode works! - at the moment i add the dependency (only adding not using it) it stops working.
Background about library i added (don't know if my problem relates to this):I had some problem on integrating the library. the library uses eclipse birt charting engine. This engine has a dependency to Apache derby db, this conflicted with another library. i solved this by excluding the derby dependency via maven. the second problem was a "command line too long" error on unit test - this was solved by updating the maven-surefire-plugin.
The Problem was hard but the solution is simple: With Java 7 it is working!
The problem could be reproduced on 2 of 3 machines. The machine without the problem is the only one that uses java 7. So i installed java 7 on my machine and linked eclipse to it - now hosted mode (from eclipse) works again :-).

Cannot deploy my updates to cloudfoundry

I have a simple app running on tomcat (using Postgresql). I deployed it to the Cloud-Foundry using the STS plugin and it runs OK. Recently I've encountered serious compilation problems (related to JS and JQuery) which led me to re install my STS. Now, when I run the app locally it runs perfect but when I use "Update & Restart" nothing happens - my new updates are not deployed! (I'm connected and Start/Stop works). I don't have a clue for how to tackle this. Please help.
Since you have reinstalled your STS, I would suggest you delete your app from Cloud Foundry and deploy your project from STS again. It might be because your project is not being linked with the app you have on cloudfoundry.com
Try that and let us know how it goes.

Speeding up code changes in Eclipse Web Browser?

I'm developing an application using the Vaadin framework in Eclipse. I'm using the Tomcat v6.0 servlet and run the application in the Eclipse Web Browser. A problem I've been having though is to have recent changes show in the browser when I test the application.
No matter how many times I restart Tomcat, clean all published resources and restart the Eclipse Web Browser the changes still won't take effect. The changes seem to take effect randomly where time is the biggest factor, which is of great frustration when developing...
So my question is if anyone else has noticed this problem and have any ideas of how to solve it, if there is a configuration I can do or if I'm missing a step in the restart which blocks the changes from taking effect..?
Any help would be greatly appreciated!
In Vaadin most of the code runs in the server and is contained in normal Java files. There are three levels of resource/class changes:
The runtime "hot code replacement". If running Tomcat in debug mode some Java class changes can be published without redeploying the web application. However, if the Tomcat is configured to "auto publish" (check your server settings in Eclipse), the redeployment is automatically done whenever classes change and this causes full context reload and sessions serialization (see #2) . Hot code replacement can be enhanced using tools like JRebel.
Web application deployment. This is essentially deploying a new war file to the server. Causes the previous version to be undeployed and deploys the new version of all classes and resources. Sometimes there are some resources left in the servers work directory or classes are not reloaded, in which case the server restart (#3) is needed.
Server restart. This makes the whole JVM to reload and all the classes and web applications are also reloaded. Still cleaning the work directory separately is needed to make sure everything is reloaded.
In addition to this there is the client-side part of Vaadin (essentially a JavaScript compiled with GWT), which is treated as a static resource by Tomcat. If you modify the client-side Java code the GWT is used to recompile the JavaScript. Deployment should be simply file copying. The browsers cache the generated HTML/JS files, but GWT includes mechanism to avoid this.
You should first try to change the server settings for automatic publishing and see if that helps. Also, I've noticed that different Tomcat version behave differently. This is unfortunate, but the only thing you can do is to try to find the versions/set-up that works for you.
Just to make sure: you have been adding ?restartApplication in the URL to force application to restart on page reload, haven't you?