Run web project on Server Tomcat 7 with Eclipse - eclipse

I have big web application that uses GWT. When it starts a dialog window is openning on client side for logging. LogDialog consists of two textfields (password and name). Why when I use option Run on Server from Eclipse I can see only loading picture(it appears from beginnig). But then the LogDialog and main menu dont appear. As I know there is one jscript that Browser have to load to show Logdialog. I tried to view web app from GooGle Chrome and I discovered that it doesnt load Cashier.js (jscript file) and shows to me loading picture. What am I doing wrong? How can I catch the error?
As I know GWT compiler generate the client side Javascript code. The web app uses database for storing logname and pass.

Related

Disabling SPA at porlet level

I have an WAR style application that has been converted from Liferay 6.2 to 7.1. it needs to have SPA turned off and has been tested successfully when turning off SPA at the portal level but would like to turn off at the portlet level.
have tried adding the false property to the object in liferay-portlet.xml but the app doesn't load into Liferay correctly after that and complains.
this appears to be the recommended approach from https://portal.liferay.dev/docs/7-0/tutorials/-/knowledge_base/t/automatic-single-page-applications. there may be some "order" necessary to these properties? I can't determine exactly what that might be from this DTD https://docs.liferay.com/ce/portal/7.1-latest/definitions/liferay-portlet-app_7_1_0.dtd.html#single-page-application.
a further inspection of the error message that occurs when the portlet is loading provides help that indicates the properties order that should appear in the liferay-portlet.xml. I'm able to deploy the portlet without error now.
unfortunately, the portlet still does not act properly. its an EXTJs front end and there are consistent "The schema can only be reconfigured once" and "duplicate object" errors reported in the browser console. reloading the entire page works fine.
how might one start to debug this issue?
I disabled SPA in a WAR application by setting <single-page-application> to false in liferay-portlet.xml
See: https://github.com/jorgediaz-lr/index-checker/blob/master/docroot/WEB-INF/liferay-portlet.xml#L18
<portlet>
<portlet-name>index_checker</portlet-name>
<icon>/icon.png</icon>
<configuration-action-class>com.liferay.portal.kernel.portlet.DefaultConfigurationAction</configuration-action-class>
<control-panel-entry-category>
apps
</control-panel-entry-category>
<control-panel-entry-weight>1.5</control-panel-entry-weight>
<control-panel-entry-class>
jorgediazest.indexchecker.portlet.IndexCheckerControlPanelEntry
</control-panel-entry-class>
<preferences-company-wide>true</preferences-company-wide>
<preferences-unique-per-layout>false</preferences-unique-per-layout>
<single-page-application>false</single-page-application>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>
/js/main.js
</footer-portlet-javascript>
<css-class-wrapper>index_checker-portlet</css-class-wrapper>
</portlet>
If that setting is not working to you and causes errors, please copy your log traces with the problems.

Polymer unexpected routing result home page

I cloned polymer starter kit 1.0 and its working perfectly fine only if the url is : localhost:8080. When I tried with Eclipse and Apache Tomcat 8.0 to build a Java MVC application then URL would be as : localhost:8080/project-name.
Now the behaviour of the page navigation changed dramatically. When I start the project the URL comes as: localhost:8080/project-name/#!/project-name
But it should come like: localhost:8080/project-name and should show home page and on clicking on users or contact tab the url should be :
localhost:8080/project-name/#!/users
localhost:8080/project-name/#!/contact
but it is showing like:
localhost:8080/project-name/#!/project-name/users
localhost:8080/project-name/#!/project-name/contact
I tried to make app.baseUrl =" ";. Changed the routing.html routing for home to empty or '*'but nothing worked.
Any help would be highly appreciated.
Thanks.
You must deploy your app as "ROOT.war" to hide the projects context. The name of your project is deployed as the "context" in the URL.
Naming your app ROOT simply tells Tomcat it is the main app to run and you will indeed get below as your projects context.
localhost:8080
Don't worry about the Tomcat homepage, I simply rename it to "ROOT-1" when I really want to keep it. Also don't worry about the context while running in eclipse because it would awkward to test your app as ROOT. Just rename the .war to ROOT before launch.
When you see the "#" it usually means your are navigating to some point in an html file, i.e. looks like your app is SPA.
"#!/appComponent"
The line below simply looks like you have a SPA style page with the same name as your project with all the other pages inside of it.
localhost:8080/project-name/#!/project-name/users

Java webstart replaces jnlp with wifi login page html

My webstart runs fine whenever there is internet connection. It also runs fine when I disconnect from wifi. But it does not work if my computer is connected to public wifi (ie. coffeeshop, airport, etc) such that if I open a browser it forwards me to a html page that asks me to click on a button to connect to internet.
Basically Java webstart thinks that the html welcome page is the new update to my jnlp file so it replaces my jnlp with the welcome page html. Of course that will fail to parse, so I get a parse error and I cannot recover from it unless I completely remove my webstart application from cache and re-download and re-install it.
Has anyone else experienced this? Is there a way to prevent this issue?
I submitted a bug report to OpenJDK:
https://bugs.openjdk.java.net/browse/JDK-8079874
Unfortunately it's marked as incomplete. Evidently I wasn't clear about what the problem is. I'll try to get in touch with them to see which part is not clear.

GWT refresh modifications

I'm new to GWT and therefore have a lot of "code and see how it behaves" going on. I'm wondering what are the minimal actions to take to load the modifications in my web browser. For example when I work on the xml I can just refresh my page. So when do I need to perform these and why:
Refresh browser
Reload web server
Re build app
???
1. Refresh browser
You need to do this whenever you've made code changes in UiBinder or any other client side code.
Reload web server
This needs to be done when you've made any changes to the server side classes. This only works if you're using the embedded Jetty in Dev Mode (not if you're using -noserver).
Re build app
You only need to compile the app when you're getting ready to deploy it or you want to show someone. This could also be required if you want to test the app in a browser that doesn't have the GWT plugin.
When running the app in development mode, making code changes in UiBinder or client side code the changes will be visible in the browser after a simple refresh.
But you will not see the error logs in GWT's "development mode" window unless you reload the server. So, by just refreshing the window you might miss some simple mistakes and you app will block with no notifications.

Eclipse RAP - Firefox doesn't forget session

We've got an Eclipse RAP application that's behaving a bit strangely in Firefox - two distinct problems.
When you browse around, you can click on a button in one part of the system. This opens a popup window like so:
IWorkbenchBrowserSupport bs;
bs = PlatformUI.getWorkbench().getBrowserSupport();
int style = IWorkbenchBrowserSupport.AS_EXTERNAL;
IWebBrowser b = bs.createBrowser(style, getRandomID(), "Hello world", "");
b.openURL(new URL(...));
where the URL is another servlet in the application. This servlet is in the same runtime, but has nothing to do with RAP - it takes a binary blob from in-memory storage and dumps it in the output stream.
Problem 1: This causes the HTTP session to die in firefox, and shows the "session expired" RAP error page with a link to restart the session.
Problem 2: Now, when you click on the link to restart the session, it shows the application's dialog again, but the session expired error is shown again the moment you do anything. This prevents the user from using the system again, unless Firefox is closed down completely and restarted. A quick peek with FireBug reveals that the JSESSIONID passed by Firefox does not change.
Has anyone seen this before?
How long is the dumping of the stream to the output? May it cause a timeout? As RAP uses Javascript calls, it might be much shorter than the normal timeout time.
For problem 2: Firefox caches a lot of things; and if the Javascript execution hangs, it might cause such problems.
Are these problems present in other browsers? It might be a good idea to check with the internal browser (or any other browser with a different rendering engine).
It turns out that if a RAP application opens a popup window pointing to a servlet in the application itself, inside the current HTTP servlet context, the session is killed. Fixed by creating a dummy HTTP context for the servlet in question.
If you need to deliver content from within the same application, you should use a service handler instead. See this FAQ:
http://wiki.eclipse.org/RAP/FAQ#How_to_provide_download_link.3F