Spring Tool Suite: Changes to static resources triggers redeploy - java

I recently got into a problem with STS. It redeploy's my application on all kind of changes (JSP, CSS, JS). It was only triggered on Java changes before I upgraded it to 3.4.0.
What I tried are the following:
Enable/Disable JMX-Reloading
Tried both "Automatically publish when resource change" and "Automatically publish after a build event"
I turned ON/OFF "Auto reloading" for the web module.
But I can only get it to not publish at all or publish on everything.
This slow's down my development process.
How do I get my Spring application to only redeploy on Java changes?
Edit:
If I turn off "Auto reloading" my JSP does not even refresh on change. This is very frustrating

I solved it buy simply removing the server and then add a new one.
Right click in servers window.
Add -> server
VMware -> VMware vFabric tc Server v2.7-2.9
Existing instance -> base-instance
Finish
I have no clue what the problem was with the first one. Settings where not changed and I couldent find anything suspect.

Related

How to disable live reloading in Quarkus?

I have a Qurkus application which I run in Dev mode:
./mvnw compile quarkus:dev
I have an issue that Quarkus reloads classes also when I don't want it to (dependent project updated, etc) which takes quite a lot of time.
Question: Is there a way to disable live reloading in dev mode?
I went through the Quarkus documentation, but couldn't find if there is such an option.
You can disable it with Quarkus since 2.0.0.Alpha3 by enabling the corresponding option in the console (Quarkus tells you which key you need to press to do that - it's l).
See https://github.com/quarkusio/quarkus/pull/17035 for the pull request that brought this feature

How to solve AttributeNotSupportedException in Hybris

Everytime that we add a new attribute to items.xml, we have to execute a hybris update, otherwise we will get some error like: JaloItemNotFoundException: no attribute Cart.newAttribute
But, sometimes after executing an update, instead of getting JaloItemNotFoundException, we get something like:
de.hybris.platform.servicelayer.exceptions.AttributeNotSupportedException: cannot find attribute newAttribute
For this second case, it always work if we restart the server after the update.
Is there any other way to fix that besides restarting the server after the update?
I worked for a company years ago that added this restart as a "deploy step" after the update. I am trying to avoid that here.
I tried to execute several updates and clean type cache. But no luck.
Platform Update with "Update Running System" is usually enough. If you have localization, impex, or some other changes, you might need to include the other options or extensions.
If you have a clustered environment, make sure all nodes have been updated / refreshed as well.
Make sure that your build and deploy process is something like:
Build
Deploy
Restart Server. You stop/start manually (or by script), or let Hybris restart itself when it detects changes from the deployment.
Run Platform Update
You can try to update the platform directly after the build from the command line(i.e "ant updatesystem") before starting the server.
The restart after deploy is a pretty common step(In case the update system is performed with the server started).
I believe that one of the reasons the restart is needed is due to the fact that the Spring Context needs to be reinitialized since some of the beans need the new type system information.
For example, Let's say you need to create a new type and an interceptor for that newly created type. When deploying this change you do the following:
Change the binaries and start the server
Perform an update system in order for the database to get the latest columns and so on
Now if you try to see whether the interceptor is working you will see it does not work because when its spring bean was instantiated(during the server startup) the type that it is suppose to handle was not present in the database.
Because of that, after a restart the Interceptor works as expected.
PS: The above described Interceptor problem might have been fixed somehow in the latest Hybris Versions.

Eclipse: no shown variables in debugging Java EE

Platform I am using:
Fedora 20;
mariadb-5.5.34-2.fc20.x86_64;
Eclipse Kepler Service Release from www.eclipse.org
I am implementing example
See here
and I am trying to manage to work the login interface.
Actually I am configuring TomEE to use JAAS auth technology.
Since I am having some troubles, I would like to solve them with the help of Eclipse debugging mode. To do that, I:
setted breakpoint at line number 79 of LoginController.java;
started TomEE in debug mode;
executed login.xhtml in debug mode too;
My problem is that I see nothing in debug mode: no variables, etc.
How is it possible? I have been using debugging mode for a long time, but it is my first time in web development.
Project archive
Click here for a larger Screenshot
The webpage bean has not been istantiated for an unknown reason. I opened a new question to fix it.
Bean not instantiated

IBM Websphere startServer.bat and adding projects

I am trying to start the websphere server outside of eclipse/rad.
From:
SDP\runtimes\base_v7\bin
I runt the startServer.bat server1
It starts correctly. Now I am wondering how I can "Add/remove projects" to have the same effect as when doing it from inside RAD.
Possible?
You got to write scripts to do that. Jacl/Jython scripts are available to perform this activity.
Refer to these samples to start with:
http://www.ibm.com/developerworks/websphere/library/samples/SampleScripts.html
AdminApp is the one that you would use to administrate the application related components. This is one the 4 key control objects available in Jacl/Jython in the WebSphere environment.
HTH
Manglu

What causes duplicate requests to occur using spring,tomcat and hibernate

I'm working on a project in Java using the spring framework, hibernate and tomcat.
Background:
I have a form page which takes data, validates, processes it and ultimately persists the data using hibernate. In processing the data I do some special command (model)
manipulation prior to persisting using hibernate.
Problem:
For some reason my onSubmit method is being called twice, the first time through things
are processed properly. However the second time through they are not; and the incorrect
information is being persisted.
I've also noticed that on other pages which are simply pulling information from the data
base and displaying on screen; Double requests are happening there too.
Is there something misconfigured, am I not using spring properly..any help on this would
be great!
Additional Information:
The app is still being developed. In testing the app I'm running into this problem. I'm using the app as I would expect it to be used (single clicks,valid data,etc...)
If you are testing in IE, make note that in some versions of IE it sometimes submits two requests. What browsers are you testing the app in?
There is the javascript issue, if an on click handler is associated with submit button and calls submit() and does not return false to cancel the event bubble.
Could be as simple as users clicking on a link twice, re-submitting a form while the server is still processing the first request, or hitting refresh on a POST-ed page.
Are you doing anything on the server side to account for duplicate requests such as these from your users?
This is a very common problem faced by someone who is starting off. And not very sure about the application eco-system.
To deploy a spring app, we build the war file.
Then we put it inside 'webapps' folder of tomcat.
Then we run the tomcat instance using terminal (I am presuming a linux system).
Now, we set up env in that terminal.
The problem arises when we set up our environment for the spring application where there can be more than one war files to be deployed.
Then we must cater to the fact that the env must be exclusive to a specific war file.
To achieve this, what we can do is create exclusive env files for every war. (e.g. war_1.sh,war_2.sh,.....,war_n.sh) and so on.
Now we can source that particular env file for which we have to deploy its corresponding war. This way we can segregate the multiple wars (applications) and their environment.

Categories