Is it possible to run GWT in hosted mode under Tomcat, not Jetty in Eclipse? I am going to integrate GWT widgets into spring app, so it make requests to spring controllers. But developing, spring is ran on one server, GWT on another... So I can't make direct requests to spring controllers, and I am tired of doing monkey work, writing servlets under jetty which make requests to spring controllers under tomcat...
You can use Tomcat instead of Jetty. You should start devmode with -noServer flag..
Here is more explanation from gwt web site
Related
I am converting Java web project into Spring Project. (10 JSP and 5 controllers connecting to DB)
We are using Wildfly server for deployment.
Is there any use of creating Spring Boot project (though i have facilities like actuators, starters etc.)
or
Is it fine to create Spring MVC Project and deploy the war in Wildfly as i am not using any container here and spring boot project will be an overhead? Basically i am finding why should i use spring boot here?
it depends.
Spring boot is just SpringMVC + Tomcat in one JAR (very simplified definition, I know).
If you have an existing and working Wildfly Server, use it. Compile your web app as WAR an deploy it. You will have also better configuraiton, server update and server bugfixing possibilities. At least that was in my case, as my team mates had a lot of experience with Wildfly.
We are using SpringBoot for small pure REST (micro)services (without HTML, JSP), since they are fast to implement and to deploy (just run a jar file). All of these applications have their own Tomcat server - with own PORT. If you want a new Tomcat version you have to recompile your application. This could be a disadvantage (but not realy).
I am developing a small project where I have Springboot java application and
Anagular 5 application. I want to deploy them on one tomcat. running each on diffrent ports.
Application Flow should be like this:
1) Some external service calls Java application with some headers. Springboot java application should read the headers put them in cookie and forward the request to Angular application.
2)Angular application reads the headers from the cookie and communicates to another application(Hosted somewhere else) with API calls.
What I tried:
I am able to deploy Spring boot application on tomcat.
For angular deployment I am copy pasting the dist folder into webapp.
What is question about: I wanted them to run at a time on tomcat on defferent ports so.
external application --calls-> java application(say running on localhost:8080)-----redirect from localhost:8080 to ----> Angular application(say running on localhost:8081).
in moment your are delegating servlet container to a provided one, all spring properties concerning an "embedded" container will be simply ignored. This is the case of server.port property.
Maybe it's a client/company constraint BUT using Spring Boot project this way makes you loose big part of its benefits: Raising serverless apps ready to be horizontaly scaled :(
Spring Boot keeps the possibility to let your static resources in the apps whitout loosing the ability to run the embedded container; by building an executable war.
Tip: To do that, just change the packaging from .jar to .war.
Hope was helpful :)
I am new to angular 2 and js frameworks so this question is probably going to sound a bit stupid, I have a task at work where I am looking to integrate angular 2 with Spring boot application, I went through couple of tutorials online and found that you can configure the proxy setting for paths inside angular to redirect calls to spring boot application for various paths.
For reference: https://dzone.com/articles/angular-2-and-spring-boot-development-environment
The question I want to ask is that since Angular is a js framework and I thought that it could be completely integrated with any application, like plain old javascript, html and css. In a way that only a single port is required to launch the server and jsp based models can be served through it.
But with Angular2 you need a separate port of its own to do anything. Is that true?
If it is then why it is like that?
If not then can you please direct me to a guide which describes how to integrate it in a way that it would be served through the server?
But with Angular2 you need a separate port of its own to do anything. Is that true?
No, not at all. An Angular application, once built, is just a set of satic files that can be served by any web server, including the one running your spring boot app. Those file aren't "run" on the server. They're just downloaded by the browser.
During development, though, it's much more productive to have a separate web server like the one that Angular CLI starts up, and which watches your source files, rebuilds your application on the fly, and serves it immediately. Since this server can also serve as a proxy to your spring server, you can just pretend your spring server hosts the angular files.
An alternative is to use your angular build tool to build the app to some directory, and configure spring to serve static files from that directory.
In production, you'll simply build the production-ready angular app, integrate the generated files inside the spring boot jar file (inside the static folder, typically), and run the spring boot application as usual.
I have a Java desktop application which uses spring framework and I need to replace the Swing UI with a web front end. I understand that I will need to adapt many things to make things work with the MVC architecture.
My concrete question is the following:
Will my application now have to run entirely in the application server?
I would appreciate if anyone could point me to some documentation that goes through a similar process.
Thanks!
Technically yes, but Spring Boot makes it trivial to set up an embedded servlet container and package your entire application as a runnable jar. This is how we're deploying our applications to production; the only thing we need is a JRE on the server VM, and java -jar takes care of all of it.
I recommend using Maven with the Spring Boot plugin (there's also a Gradle plugin) with the repackage goal, and using the lightweight Undertow servlet engine instead of the default Tomcat.
My web application is made with Java, specifically with the Google Web Toolkit (GWT). The back-end used
GWT RPC RemoteServiceServlet
Hibernate/Java
MongoDB (via Morphia)
and other Java libraries
I really did not use any Spring framework at all, will my web application be able to be deployed in a CloudFoundry MicroCloud and in CloudFoundry.com hosting?
Will I be needing to reconfiguring my web application that has been tested and deployed in a Tomcat Server with MySQL and MongoDB database?
GWT should not be an issue.
If you want to deploy a java web app not using Spring, you can deploy it as a java web app, then parse the VCAP_SERVICES manually to configure your data sources from the application.
See http://blog.springsource.org/2011/10/13/using-cloud-foundry-services-with-spring-part-1-the-basics/ for details
https://github.com/SpringSource/cloudfoundry-samples/tree/master/hello-java
Why wouldn't it work?
In the event it wouldn't, that wouldn't be because of GWT at least: GWT-RPC runs in AppEngine, so there's no reason it wouldn't work in CloudFoundry.