I'm trying to update a couple of JAR files after my web application starts and doing a restart for the changes to take effect.(requirement)
The problem is , the session information is being persisted by tomcat. Yes, I do have a "sessionEventListener" listener in my application, but that shouldn't be a problem IMHO.
I want everything to start afresh from tomcat ( running standalone) , be it sessions, cache, or any information about the web application given to tomcat, except for the WAR file of course.
Any help would be appreciated.
During development (in Eclipse) I usually use 'Clean Tomcat Work Directory' option found when right clicking on Servers view. That will wipe all session related data.
In your tomcat 7 context.xml you can add/uncomment this line to clear all sessions on tomcat restart.
<Manager pathname="" />
Related
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...)
i am using eclipse server to the publish my web application to my local tomcat server.Whenever i modify
java or non java resource, it gets published to server(as i have selected automatically publish when resource change).But problem
is as soon as resource is published, server gets restarted which i want to avoid as it takes ample amount of time. How to avoid server restart ?
I think you are looking for hot deployment?
Heres a good tutorial I seen a while ago http://www.mkyong.com/eclipse/how-to-configure-hot-deploy-in-eclipse/
Whenever you change your code, Automatically eclipse detect your source has modified, and start redeploying your actual code into server. So that Tomcat server is restarting in a particular time interval.
You can configure tomcat for reload automatically, configure the attribute reloadable to true of the Context.
For do Tomcat 7 you must do.
Edit CATALINA_HOME/conf/context.xml
Change:
<Context>
For:
<Context reloadable="true">
Where CATALINA_HOME is your tomcat installation.
clicks on the “Module” view, make sure “Auto Reload” is “Disabled“. Default is enabled. It will stop the auto restart.
To do it in one go for all modules
In server options, uncheck option Modules auto reload by default
Also have a look at Stop Eclipse restarting my web app on file save
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
I am new to weblogic and I would like to find out how my files are arrange in Weblogic?
I have used only Tomcat and this is the first time where I will deploy in a Weblogic Server.
In Tomcat, I could view the exploded view of my projects by looking at the Tomcat Home Directory
and the WebApps folder. There I could view how my application css/js/resource files are deployed.
%TOMCAT_HOME%\webapps
I am looking for a similar functionality in Weblogic? Can somebody tell me how? Thanks
I am using Weblogic 10.3.4 by the way
WebLogic supports several different ways of deploying applications, so the answer to your question is not very straightforward.
Typically, if you deploy a war/ear, then WebLogic will place them in the $WEBLOGIC_HOME/application directory. WebLogic will then explode your ear/war into a separate wl_stage folder that will be under your managedServer directory.
You can also use the ability of WebLogic to autodeploy ( not recommended for production apps ) where WebLogic will automatically explode the app.
In summary, you probably need to reach for the documentation to get all your questions answered.
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/deployment/overview.html
I'm not quite sure if you want to find out where to deploy or where applications have been deployed.
But if you want to see where are the deployed applications in weblogic, you can go to its console (e.g. localhost:7001/console) after start the server. Then follow the following steps:
Find and click "Deployments" label
Find and click your application in the right panel
Click "Overview" tab, then you will see "Path" in the opened information table.
I would like to know if its possible to deploy java class files without restarting JBoss server. I am using jboss v4.2.2.
Also, when I try to deploy jsp files, it works fine and server picks up the changes almost instantly.
Thanks a lot in advance :)
I'm better with Tomcat than JBoss, but it should be possible (as in Tomcat) to restart the application without restarting the app server. If the server has a "development mode" and this is active, then it should be possible to trigger an app restart simply by touching WEB-INF/web.xml, i.e. updating its timestamp. That should get your previously replaced class file loaded.
Theoretically, you never have to restart the whole server, you only restart specific applications (ear-s). JBoss (with default settings) will automatically redeploy your ear if it notices any changes in it. Just copy the new version over it.
If you're not using it already, check out JBoss Tools set of eclipse plugins, to simplify whole process of deploys during development: http://www.jboss.org/tools
Yes, it is possible to re-deploy your class files without stopping and starting the server each time.
The only thing you have to do is to make a junction or a symbolic link to the application directory (in eclipse is usually "WebContent") and put the name you want in Jboss.
I've made a step-by-step tutorial here.
Deploy the app as exploded (project.war folder), add in your web.xml:
<web-app>
<context-param>
<param-name>org.jboss.weld.development</param-name>
<param-value>true</param-value>
</context-param>
Overwrite the web.xml every-time you deploy:
set PRJ_HOME=C:\Temp2\MyProject\src\main\webapp
set PRJ_CLSS_HOME=%PRJ_HOME%\WEB-INF\classes\com\myProject
set JBOSS_HOME= C:\Java\jboss-4.2.3.GA-jdk6\server\default\deploy\MyProject.war
set JBOSS_CLSS_HOME= %JBOSS_HOME%\WEB-INF\classes\com\myProject
copy %PRJ_CLSS_HOME%\frontend\actions\profile\ProfileAction.class %JBOSS_CLSS_HOME%\frontend\actions\profile\ProfileAction.class
copy %PRJ_CLSS_HOME%\frontend\actions\profile\AjaxAction.class %JBOSS_CLSS_HOME%\frontend\actions\profile\AjaxAction.class
ECHO.>>%JBOSS_HOME%\WEB-INF\web.xml