I have GWT-Maven project created using IntelliJ. I can build and run it but the browser shows a strange error on home page. How to fix it?
I've tried to create new project and import the existing code but it doesn't help.
Project download: GwtStudy
You need to run it GWT Development mode with Jetty.
The you will get a code server at http://127.0.0.1:9876/
and a web server at: http://127.0.0.1:8888/yourapp.html
See also this video: https://www.youtube.com/watch?v=kx9RxrQZnFA
The tutorial is slightly misleading. You need to run the app by choosing "GWT Development mode with Jetty" and not "GWT development mode" as one may believe following the tutorial (the super dev mode is the standard nowadays).
If you run the app using "GWT development mode" you will start only the code server, that will run the java code, but it will not be able to serve the html page that hosts the stockwatcher application.
If you run it with "GWT Development mode with Jetty" you will get a code server at http://127.0.0.1:9876/ AND the web server at: http://127.0.0.1:8888/stockwatcher.html, that is the URL that you need to open with your browser to see the page that hosts the app (you can see that the docs shows the browser opening the url at port 8888 and not at port 9876).
The answer of Jankos is right but for me it was not enough clear. The video is not strictly needed or related to solve the issue, so I added this answer to help gwt beginners like me.
This is the CodeServer, which compiles your app on-demand, and serves the compiled scripts and their source maps.
You need another web server to serve your webapp, including most importantly an html page that includes the nocache.js script.
Depending on how you "run" your app this may or may not already be the case (you'd need to give more information).
Related
I am trying to create a Java + Maven app that uses the Oracle Business Intelligence (BI) Web Service to render an analysis using HTMLViewService. So far I've been using the GO URL without problems, but I want to migrate to Web Services for security reasons.
I am using Oracle Business Intelligence Product Version 12.2 as BI Server and Tomcat 9.0.34 as webserver.
My problem is that the resources are not properly rended/loaded. I can't figure out what I'm doing wrong in my implementation.
TLDR:
Full code and how to reproduce the problem locally on GitHub.
Here is the report displayed directly in the BI server:
And here is the report shown in my application:
As you can see, the dropdown arrow was not displayed, also the CSS for buttons Refresh, Print, Export was not applied. In the console window I got:
Network tab:
Application tab:
It looks like fcustom.css file is directly importing 2 css files: master.css and facustom.css. Also some .png files are missing. The application looks for them directly in the root of our server instead of using the bridge. Why aren't all resources going through the bridge servlet?
I managed to overcome the above problem by manually putting those resources in WebContent folder, but this is a dirty solution and it's still not fully functional. Some analysis still do not render at all, export is giving errors etc. as shown on GitHub.
Any help will be highly appreciated!
I'am trying to run this project on my local host.
I followed these instructions on how to launch a dynamic web project on Tomcat Server.
Everything works and when I run the application, I see this which is correct
Now I'am trying to play around with the code a bit. I located the html code that corresponds to the new wine page - /WebContent/tpl/wine-details.html
I changed the country label to show states instead.
However when I re run the web application on the Tomcat Server, the label still says country.
Does anyone know what the issue is? I made sure to save the file. What I also found interesting was there were two copies of this file, in backbone-jax-cellar and backbone-jax-cellar-master. I made sure that both copies contained the states label.
If anyone's having this issue still, I recommend just visiting the URL in a web browser. I used Chrome and everything is showing up fine.
I think the problem here is that Eclipse is somehow caching the html page and doesn't update it when it runs the web app
I am starting to learn GWT.
I've picked up newest version (2.7.0).
I have wrote Entry point class to display start page and to call rpc to server to execute some function.
Every change I made in client side source code in Entry point class, cause auto recompile (hot swap), so I can see immediatly changes, that I've apply.
My problem is that it works only for client side code.
It dosen't work for server side code. To see changes in server side code, I have to stop server and console, and run it again, which is very very annoiyng.
So my question is:
Is it normal behaviour of gwt app server in SuperDevMode in 2.7.0 version? Or am I doing something wrong?
How should I deal with that?
Please give me your thougths about it.
By the way: I use GWT with eclipse and Google plugin.
EDIT
I wonder what about Maven GWT projects? How to deal with them?
What you describe is normal behavior.
There are several ways to reload the server side code when refreshing without restarting your server:
The built in web server does support hot swapping code, but only if you do not modify method or class signatures. If you do change them (or add a class or method), a server restart is required.
You might need to configure your Eclipse to auto re-publish any code changes to your web server.
There are 3rd Party Eclipse plugins which improve the hot code reloading mechanism, for example JRebel, which allows hot code replacement even if you change method or class signatures.
There's a "reload webapp" button in DevMode. It's in the "Jetty" tab when using "bare" DevMode, and a yellow double spinning arrow in the Eclipse view when using the GPE. It'll restart the web app just as if you redeployed it in a standalone server.
I found this solution:
https://github.com/jbarop/gwt-hotdeployment
It seems to do the job for developer.
But it is quite old.
Recently I started to use Super Dev Mode to get look&feel of it. It took me couple of hours to get it up but I didn't find out how and actually can you use SDM for faster development using hot swapping.
Using Dev Mode all I had to do is save my changes in IDE and refresh the browser page. Now my code changes needs to get transferred to the code server to be recompiled? Am I right or am I missing something obvious?
All you have to do is click the DevMode On bookmarklet and Compile button. This is for client-side code only though.
For server-side code, whereas DevMode can serve your webapp and you can reload it with a single click to get your changes in, CodeServer only deals with the client side, so you have to deploy your webapp to a server (that said, you can use DevMode if you want). You then need to re-deploy your webapp when you make changes to your server-side code.
See https://stackoverflow.com/a/18333050/116472 for a detailed step-by-step howto.
Java Compatibility
I have been having some trouble with making a custom browser I am using a default class provided by oracle for a custom browser. One thing I noticed with the browser is that it cannot run java applets without some sort of variation of java browser plugins. How exactly do normal browsers receive information from a web server to run a java program externally? Is there any way to somehow point the browser toward the jre to run the app like on a normal browser. Just need somewhere to start. FireFox apparently references some sort of MIME format under the npjp2.dll native found in the jre directory. Thanks Very Much.
Oracle Example
You can provide the user with a standard html download page in order for him to download a JNLP file which is the standard file to start a java web start app (applet). If the user's system has java installed, it must recognize the .jnlp file and assosiate it as a java app. It's an extra step, for the user to manually download the file instead of running automatically on a web browser, however because of recent security loopholes on java web implementations, most browsers don't trust java anymore, therefore the blocking. If you insist on setting up a web start app in a browser you must make sure that all users have appropriate security configurations on ther java installation (very unlikely).
EDIT:
Here's a very nice tutorial on how to achieve what I just explained.
TUTORIAL