I need a java/j2ee program, that will load an updated class file when the server is still on. In our Web Application testing environment few classes(Java files) are being frequently changed to fix defects and need to load them in JVM fresh.
We can not restart the server to impact on going testing .
Can we write a program to load it using class loader?
No you cannot, you would need to have the container on the server side. Although for your server like tomcat, jboss, websphere etc. you can configure them to hot deploy but the server side would still needs restart once new class file is placed. If you are trying to hot deploy a class file you can try using JRebel it will allow you to hot deploy the class file without actually restarting because it is managed within JRebel container. (also note that JRebel is not free)
Related
I know this is a weird question but is it possible to somehow run a JAR with a main class on Tomcat like a WAR?
I'm aware that won't automatically give it any website capability.
I just want it to execute it inside the web server JVM with the isolation that it gives
I managed to get this running but I'm facing a lot of problems that only occur when the application is running with java web start. When I run it from within my IDE it runs fine.
Static content that should be served out of the box from within a folder named 'static' is not found in the jar. I wrote a mapping method to get it with getClass().getResourceAsStream() and write it to the response.
On my Win 7 & Java 8 machine, the used socket is not closed when shutting down. I see jp2launcher.exe that keeps running and probably prevents spring boot getting the shutdown hook called to clean up.
Apparently there are some jars in the class path that aren't found.
java.io.FileNotFoundException:Jar URL cannot be resolved to absolute file path
because it does not reside in the file system:
https://mysite/webstart/org.springframework.boot-spring-boot.jar
Someone an idea what causes this?
I am new to using the JBoss 7.1.1 server and am confused by a behavior that I have observed.
My JBoss server is deploying the six jBPM .war files (designer, drools-guvnor, jbpm-form-builder, jbpm-gwt-console, jbpm-gwt-console-server, jbpm-human-task-war) which I have placed in the .\jboss-as-7.1.1.Final\standalone\deployments folder.
When I launched the server for the very first time it detected these files and deployed them. I see the deploymentNNN and tempNNN folders appear in the .\jboss-as-7.1.1.Final\standalone\tmp\vfs folder. This is similar to the behavior I'm familiar with from my use of the tomcat server.
I then shut the server down and observe that the two folders created in .\jboss-as-7.1.1.Final\standalone\tmp\vfs are retained but their contents are automatically deleted. When I restart the server it once again deploys the six jBPM files into a new pair of folders in .\jboss-as-7.1.1.Final\standalone\tmp\vfs.
This is very surprising because no changes have been made to the six jBPM files and the problem is that this redeployment takes 3 to 4 minutes.
If this was just happening in a "production" environment then perhaps this would not be much of an issue. However, I am trying to integrate the JBoss server into use with Eclipse Kepler in a development environment and having to wait 3 to 4 minutes for each code change and server launch is not practical.
1) Can anyone explain why JBoss goes to the trouble to redeploy files that have not been changed?
2) Is this a behaviour that can be changed through a configuration setting?
3) Is there any settings where we can stop the jboss to redeploy the war files when it restarted
Thank you,
All
In order to stop JBoss from re-deploying your apps (and deleting on shutdown),
try deploying the apps in unpacked form.
extract the files to {name}.war directories (e.g /designer.war, /drools-guvnor.war)
and then deploy these directories (i.e copy them to the deployments folder)
Alternatively, try to deploy them using the JBoss CLI
Deploying differently won't change the fact that at startup JBOSS reloads your application to the JVM.
This can take time because your application stores data from database to your server memory. (You could as well be hitting this WFLY-925 bug... Or the one they are talking about here...)
The thing is you normally don't need to restart your server completely when redeploying. You can hot-deploy your module - see also full doc. at Auto-deploy mode. (make sure the feature isn't disabled
If you need some context to be reloaded, I advise you have a specific procedure in your code that you can call to reload all cached info. instead of restarting completely (e.g. have a call to a specific URL from your application do it...)
This is a weird situation. I run a main application in an application server(say WAS) and a sub application in another server (say JBoss). Now , the sub application needs to use the configuration made in the main application server(for example , sub application needs to use the ObjectPoolManager configuration made in WAS from JBoss). Is it possible?
No. You can of course write some kind of adapter, which reads the WAS configuration and translates it to the JBoss format and sets the JBoss configuration. However, i think the cost-benefit-factor for such a development is very very bad.
I just packaged my maven web application into a war file, upload it to remote server which has installed the tomcat environment. After I unpacked my war file and put all files in the /webapps/ROOT directory, I run bin/startup.sh to fire up the tomcat.
This just works fine, but when I intend to change my web application and redeploy it on the server, I don't know how to do that seamlessly, that is to say, not letting the users who is using my website lose any request.
Could anyone give me some idea? Thanks a lot!
You can always use manager app coming with tomcat to deploy a war without bringing the website down, even from a remote machine using browser.
http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_A_New_Application_Remotely
You may use reverse proxy as door of you site. After deploying your "second" war into Tomcat, you can change the configuration of reverse proxy and reload it. The reloading of reverse proxy is very speedy, so that it likes "seamless" re-deployment of Java web application. After the reloading of reverse proxy, you could un-deploy "first" war of application safely.
This way to re-deploy is especially useful if the application needs time for initialization(for example: including ORM, Spring Framework...).
There are few concerns about using multiple-war-at-the-same-time:
1) There will be two applications(although, temporary) running on your Tomcat concurrently, make sure there is nothing hazard about concurrent executing. For example: scheduled jobs
2) You need to confirm that there is enough memory on Tomcat to live with two web applications, or Tomcat may hang.
3) Be meticulous about Java.lang.OutOfMemory: PermGen Space problem