GWT + Spring hosted mode not working - spring

I have a following problem, probably somebody can help me?
I had an Spring MVC application, quite basic one, with a few simple jsp pages.
Also I had an Spring Security integrated with it.
Now I need to add some GWT widget to one page. No problem so far, I've added <div> to the page, added GWT module, all all needed GWT logic.
When I compile GWT and then deploy application to tomcat - everything works perfectly, I open app, login into it, open my page and see GWT UI components.
Now I want to open my application in hosted mode. There problems begin.
When I start hosted mode, Jetty starts, Spring framework initialize, and then my jsp (translated as .htm) open without hosted mode param ?gwt.codesvr=127.0.0.1:9997. After opening my page I see nothing if I delete compiled gwt code.
When I manually add "?gwt.codesvr=127.0.0.1:9997" hosted mode start and GWT module begin to load. This is when I get an error:
12:57:15.589 [ERROR] [rehabrental] Failed to load module 'testmodule'
from user agent 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru;
rv:1.9.2.23) Gecko/20110920 Firefox/3.6.23' at 127.0.0.1:63260
java.lang.NoSuchFieldError: warningThreshold at
com.google.gwt.dev.javac.JdtCompiler.getCompilerOptions(JdtCompiler.java:413)
at
com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.<init>(JdtCompiler.java:228)
at
com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:700)
at
com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:235)
at
com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:447)
at
com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:370)
at
com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:360)
at
com.google.gwt.dev.DevModeBase$UiBrowserWidgetHostImpl.createModuleSpaceHost(DevModeBase.java:110)
at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:197)
at java.lang.Thread.run(Unknown Source)

Do you use eclipse ?. If so you need rearrange your exported modules as JDT classes causes problems with the GWT compiler. See comment #7 in this GWT issue about pushing GWT dependencies above others, so that they are picked up first by the compiler.

Related

Wildfly Undertow HTTP Response 200 but no content

I am developing a simple web service using Eclipse Java EE IDE for Web Developers : Version: Kepler Service Release 2 Build id: 20140224-0627 and Wildfly-8.2.0.Final. I chose wildfly-javaee7-webapp-blank-archetype using Maven and started development. Firstly, there was no problem, I could add some simple jsp pages and also a simple html page with some images and javascript inclusion then I could deployed, launched and accessed those pages by browser. But all of a sudden, Wildfly (I guess Undertow maybe?) started to response with HTTP response 200 with no content... I really don't get what is going on. I also did rollback my sources to the very early simple pages only. But still the symptoms are the same. Also I have tried to use newer version of Wildfly-9.0.1.Final and deployed manually but I haven't seen any difference.
ex1) this is ok. (Of course browsers take care of this...)
ex2) this kind of contents won't be loaded and sent back as content 0...
I doubted local path issue but I haven't changed anything and it was loaded earlier.
It would be really appreciated if somebody could give me a solution.
Finally I have solved this problem. I have found a problem on a servlet I have added at last. Actually I was trying to migrate my web service running on glassfish and did migrate files one by one. I specified a URL to be handled by the servlet in Web.xml when it run on glassfish. But somehow, it's not working on Wildfly which means all URL request are unexpectedly handled by the servlet... Since I have no idea to specify url to be handled by the specific servlet in Web.xml for Wildfly, I decided to filter request URL in the servlet code. So it is working now. Thank you guys trying to help me...

How to debug a Spring Boot Web Application in STS?

I am new to the Spring Framework and so I started with the Spring Boot projects.
In particular, I took the https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-web-secure-jdbc project and modified the pom.xml so that it becomes self contained (replaced spring-boot-samples with spring-boot-starter-parent in the parent->artifactId tag, removed properties node, added in repositories and pluginRepositories from http://docs.spring.io/spring-boot/docs/1.2.2.BUILD-SNAPSHOT/reference/htmlsingle/#getting-started-maven-installation).
I successfully built and ran this application outside of STS first with 'mvn spring-boot:run', then imported the Maven project into STS and it builds and runs there successfully.
I am able debug this application by right-clicking on the project folder and choosing Run->Debug As ...->Spring Boot App and the debugger does stop at the breakpoints I've set in the ApplicationSecurity class methods. However, the browser window does not automatically pop-up in STS nor the system browser (which I expect - is this correct?).
When I browse to localhost (port 8080) using the 'Internal Web Browser' within STS/Eclipse the HTML pages render out but the breakpoints that I've set in the #RequestMapping("/") methods do not get hit (I suspect that this is probably due to the fact that the browser is in a separate process to the debugger).
So, how do I debug #RequestMapping methods within STS - this would help me to understand the Spring framework better.
I have limited knowledge of Eclipse/STS, so could there be a problem with my installation?
You don't need to use the embedded browser to debug a server (the browser is a separate process). If your #RequestMapping breakpoints are not hit then I suspect Spring didn't dispatch to those routes for whatever reason (maybe security?).

Using Google App Engine modules for multi-thread backend update of a Cloud endpoints project

I'm building "read-only" webservice (Google Cloud Endpoints as backend for an Android App) so I created a project using maven:
mvn archetype:generate -Dappengine-version=1.9.10 -Dfilter=com.google.appengine.archetypes:
and selecting archetype hello-endpoints-archetype to have some sample code to work on.
This works well and my app is correctly calling the service as expected (and the service is correctly supplying the data in return).
Now I have to implement an "update" service to periodically (4 to 6 times a dya) update the data supplied to the app. So I added a servlet to my project to be called by cron. Trouble is: one of the library used during this update uses multi-threads which cause an AccessControlException to be thrown because apparently multi-thread is only allowed in backend modules...
But after having read dozens of pages on google app engine, I still don't know how to "break" my application into modules so that particular servlet would be run as a backend module while the already existing servlet keep working as they do. So far, all I got was that I should use an EAR application composed of several WAR modules, but I don't even know if my current application is an EAR or not...
I'm using Eclipse Luna, maven 3.2.1 (embeded with Eclipse), google app engine 1.9.10, writing in Java
Could anyone please help me by explaining the directory structure and/or configuration files I have to look at, modify and/or add?
Thanks for any help provided!
You can find an example of multi-modules project here.
However, note that even in backend modules the threading is limited to 50 threads, as stated here.

Debugging GWT Client in Eclipse while running on Tomcat (multiple WARs)

I've recently started a new job wherein I have to fix bugs with and make additions to a suite of GWT applications which have had a lot of contributors/developers of the years :(
App Server: Tomcat 6.0.16
JRE: Java 6
GWT: 2.5.0
Eclipse: Juno
The strange thing about this configuration is that for each application in the suite (there's about 4) the client-side code is separated into it's own war file and the server-side code is separated into several war files.
The problem is that the various components (war files) have reliance's on one another and interact during runtime.
Request
Basically, I have gotten server-side debugging working but I would like to get client-side debugging working via Eclipse; so far I haven't been able to.
Code Layout
When the code is fully deployed to Tomcat, it looks like this:
webapps
serverPiece1
WEB-INF
classes
...
web.xml
...
serverPiece2
WEB-INF
classes
...
web.xml
...
clientApp1
WEB-INF
web.xml
index.html
...
clientApp2
WEB-INF
web.xml
index.html
...
clientApp3
WEB-INF
web.xml
index.html
...
Past Experiences
At my last job my team was the only team developing using GWT and Maven.
We were able to design and implement the applications and thus we kept things simple.
For each application, we kept all of the client & server code in 1 WAR file.
All shared components that we created (window management system, etc...) were JAR'd up and included in each applications WAR file.
Doing things this way made for a very simple debug setup; we were able to debug both the client & server code using Eclipse while running the applications in Tomcat or Weblogic.
There is a setting which allows you to start the GWT dev mode with an external server.
See here for more details. Basically you do following things:
Start your App server in debug or run mode (depending if you want to also debug your backend code in eclipse).
Start GWT dev mode with the -noserver option (which won't start the embedded jetty container).
Go to the URL that is served by your app server (i.e. http://localhost:8080/index.jsp?gwt.codesvr=localhost:9997)
If you use maven you can run the dev mode with following command : mvn gwt:run -Dgwt.noserver=true

portlet (JSF) with ajax - Websphere Portal 7, RAD 8

I want created a portlet (JSF) with ajax but doesn't render.
The example I tried this example of IBM http://www.ibm.com/developerworks/rational/library/06/1205_kats_rad2/, but not run in WebSphere Portal only in WAS. (New Dynamic Web Project)
I search in many forums, and solution is change "Classloader mode" from "PARENT_FIRST" to "PARENT_LAST", i cant find this Classloader in project file, I tried change in server but a wasn't work.
Please give me a simple example who I created a portlet JSF with AJAX or who change Classloader mode to resolve this problem.
Greetings, João Sousa
Joao,
in project/package explorer right click on J2EE and select Open WebSphere Application Server Deployment. Deployment settings editor will be opened. Now scroll down to Application section. Now you can switch between PARENT_LAST & PARENT_FIRST.
Bogdan.

Resources