Difference between publish and restart in jboss/tomcat - spring

What is difference between publish and restart in jboss/tomcat? I am really confused about when one should use restart or publish?
Every time I make any change config in my Java(Spring) application(on localhost) I had to do a compile and then perform a restart of server so that it picks up the changes.
Is there any easier way to get the changes picked up?

You could use JRebel if you want to avoid redeploys. It fully supports Spring and you'll see changes immediately reflected in the deployed application. It's a commercial plugin but it saves you a lot of time.

Related

Unit tests for a OAuth/Config client Spring application

I have a very simple Spring application with cloud config client and oauth resources. It's turning out to be quite a challenge to run the unit tests without requiring the config server to be up.
None of the solutions out there for disabling cloud config client work for the latest version of spring. I have even tried to use empty or bogus config.import urls, but neither disable it. I really dont want to spin up the config server just for running unit tests and it doesnt feel like the correct way either.
What is the recommended way to setup tests for a config client application?
Looking for pointers, ideas.
Thankyou!
Making the configuration optional in test seems to do the job, though you still see an attempt being made to download the config.
spring.config.import: "optional:configserver:http://localhost:8888"
OR you can use
spring.cloud.config.enabled: false
However, client will always attempt to download the configuration, even though it appears to treat it as optional and moves on. I think this is really confusing for new users - one thinks the client is still enabled. What happens when the configserver is up and you expect the client to not download the config, but it still does. I guess the only way to find out is to test.
The weird part is that the following combination fails to load the context.
spring.config.import: "optional:configserver:http://localhost:8888"
spring.cloud.config.enabled: false
Either the import is set to optional or the config is disabled, but not both at the same time.
And, this is only for the tests. Creating another profile application-standalone.yml with same settings as test, fails.

Are Changes Made to the CRM Unsecure Configuration Settings of a Plugin Instantaneous

If I have some configuration changes in the Unsecure (does it matter?) Configuration Settings, and I make a change, will that force all instances of the plugin to get the newest settings, or does it take a while for the configuration settings to propagate?
The change does have to propagate to each front end web server, so I have definitely seen very short delays before, but I'm talking seconds. The vast majority of the time, as soon as I hit Update Step and then initiate whatever action in the UI, I can see that the plugin ran with the updated configuration value.
I'm less sure about delays when it comes to plugins running in the async service. Meaning, if 30 async plugins/wfs are queued up, you make your config change, I'm not sure if those queued up async jobs will use the new value or the old.
One easy way to investigate this would be for your plugin to write to the trace log and then set the trace log level in system settings to all. Plugin-trace log records show what configuration values the plugin ran with.

Is real time change feedback with Spring/Tomcat/Intellij possible?

I have a few weeks before the next project & i'm looking/wanting to streamline our development process to give the UX & Devs guys the shortest lead time to change validation (e.g. 10 seconds for a Java change/1 second for UX/JS changes).
Basically, I want what John Lindquist shows in this video (RT feedback with webstorm & the Angular todo list example in 3 minutes) but I with Tomcat & Spring.
Ive been researching/playing this for the last few days with our stack (Tomcat8,Intellij13, Spring4, Angular) and I am just not 'getting it' so think it is my lack of knowledge in this area and i'm missing something (hence the SO question).
What I have achieved to date for UX Guys
Grunt (using node) to serve up the 'static resources'(JS/SCSS/Templates) and livereload to refresh chrome - this is very good and very close to what i want (RT feeback from SCSS/JS/HTML changes) but the big problem is that node is serving the static resources and not TC so with Cross Origin Policies (solved via this and this )- rebuilds in intellij become messy with grunt involved - looked at SCSS compiles with file watchers but it is not gelling) - in short i did not get grunt servicing static & TC the REST API working in harmony. Another option was this guy updates the TC resources with grunt when the file changes but just don't want to go there.
This leads me back to file watchers, jetbrains live edit (what the web storm video shows) and intellij and again, i'm close when it comes to static content as intellij can update the resources on TC on frame deactivation but (and a big BUT) this is NOT real time and when you change resource structure, you need to refresh the page however we are working on a SPA which loses context on refresh which slows the guys down as have to reply sequences to get back to where the change happened and also when using intellij they have to 'frame de-activate' to get the changes pushed to TC (they are on dual monitors so to tab off intellij is the same as pushing a button to deploy the changes )
The best to date is grunt and accept the same origin issues for development but am I missing something for the UX guys?
What I have achieved to date for Dev Guys
Before we start, can't afford jrebel and haven't got Spring Loaded working with intellij and tomcat (yet).
at this stage simply having TC refreshed by intellij with classes change and restart when bean definitions/method structure changes. Bad I know but 'it is what we are use to'
Looking at spring boot - promising but ideally would like not to give the configuration freedom away but it does give live updates on the server I believe.
Grails is out at the moment so can't benefit there.
I know Play allows some real time updates but again, haven't looked at this in detail and a big shift from the current stack.
Summary
On the development side will likely stick to Live Edit and accept the refresh/deactivation issue so we can't 'achieve' what John Lindquist shows in Webstorm, i.e. real time updates when resources changes when using Tomcat/Intellij/Chrome - or at least 'I don't know' how to achieve this?
Server side - i'm still working on this, going to continue to look at spring loaded and intellij integration then look at jrebel and see what budget, if any, we can get but in the meantime is there any alternatives as I see the node/ruby/grails guys getting it all so i believe it must be me and i'm missing the best setup to get super fast feedback from our code changes when using Tomcat & Spring?
In Short, yes it is possible & have achieved what I set out to achieve - that was all developmental changes in a Java EE platform (including JS/SCSS Changes and Spring/Java Changes) to happen in 'real time' (5/10 seconds server, 2 seconds ux). I have recorded a little video showing it all in action (please excuse the lack of dramatics)..
Stack:
AngularJS
Grunt -serving up static pages with an http proxy to /service context calls. The proxy is needed for 2 reasons - 1 is to
get around the Cross origin issues & 2 - so that real time static
resources changes (HTML/JS/SCSS) are shown in Chrome - you can't do this with
tomcat as the resources are copied to the web-app folder in TC and
not being served directly from source (Intellij can redeploy on frame deactivation but that doesn't work well and it doesn't allow for instant changes to be reflected in Chrome)..
Grunt monitors SCSS changes (I believe you could use file watchers in
intellij though but have grunt serving the static content)
Live Edit updates Chrome on the fly.
JRebel for Spring/Server side changes to Tomcat (licence required for
commercial use)
The subtle but important thing is what Grunt is doing..
I think this is a simpler alternative to Ian's solution:
Structure the application in three parts:
REST services (src/main/java) and
Web source files (src/web, don't include them in the final war)
Static files produced by grunt (src/web/dist, and include them in final war at /)
Configure CORS filter (which you need anyway for REST services) [1]
Now the kicker:
Start tomcat (as usual)
Start your angularjs website from src/web (using IntelliJ it's just Debug index.html)
Done -- all your edits in source html/js files are reflected in next browser refresh (or use grunt plugin to make it even more "live")
[1] https://github.com/swagger-api/swagger-core/wiki/CORS

Vaadin 6 : Window.open(FileResource) ; how do I monitor download?

I am building a Portlet using Vaadin 6. In the portlet I let the end user download the result of the searches/operations he's done.
What I am doing here is generate, on the fly, a zip file for download and serve it for download using
getMainWindow().open(resource);
where resource is a FileResource.
Since the search for is quite complex, I have very little chance to be able to reuse the results and, in order to make things nice,I would like to delete the zip file from the server once it's been "consumed" by the download process.
Is there any chance I can monitor somehow when the download has been completed ?
TIA
If your concern is just keeping the Server clean, it should be enough to use the tmp-dir of your machine. This Way, the OS handles deletion for you.
Or you could write your own clean up process either with cron or sheduler/timer services.

How to prevent WebSphere from starting before files from an application update have been unpacked

Using the WebSphere Integrated Solutions Console, a large (18,400 file) web application is updated by specifying a war file name and going through the update screens and finally saving the configuration. The Solutions Console web UI spins a while, then it returns, at which point the user is able to start the web application.
If the application is started after the "successful update", it fails because the files that are the web application have not been exploded out to the deployment directory yet.
Experimentation indicates that it takes on the order of 12 minutes for the files to appear!
One more bit of background that may be significant: There are 19 application servers on this one WebSphere instance. WebSphere insists that there be a lot of chatter between them, even though they don't need anything from each other. I wondered if this might be slowing things down when it comes to deployment. Or if there's some timer in the bowels of WebSphere that is just set wrong (usual disclaimers apply...I'm just showing up and finding this situation...I didn't configure this installation).
Additional Information:
This is a Network Deployment configuration, and it's all on one physical host.
* ND 6.1.0.23
Is this a standalone or a ND set up? I am guessing it is ND set up considering you have stated that they are 19 app servers. The nodes should be synchronized with the deployment manager so that the updated files are available to the respective nodes.
After you update and save the changes, try and synchronize the nodes with the dmgr (or alternatively as part of the update process, click on review and the check the box which says synchronize nodes) and this would distribute the changes to the various nodes.
The default interval, i believe is 1 minute.
12 minutes certainly sounds a lot. Is there any possibility of network being an issue here?
HTH
Manglu

Resources