How to dynamically enable war files deployed in Tomcat6+ - java

I am new to the world of J2ee using Tomcat, so pardon me for my noobness.
At Tomcat start-up, all the war files deployed gets enabled. What do I need to do if I want some of them to be enabled at start up and start the rest of the wars later as per my convenience? There should be something which tells tomcat to enable the wars right[modifying which I might set the start-up settings of an application manual/automatic like that we do for windows services in services.msc]?
What I'm looking for is, if there are 3 different apps deployed in tomcat, I should be able to instruct tomcat that at Tomcat start-up, only app1 should start. I will manually turn up app2 and app3 as and when I need it. Like configuring the start up of apps with options like "manual"/"automatic"
Thanks in advance.

Related

Why does JBoss always redeploy .WAR files that have already been deployed but not changed?

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...)

how to manage multiple war application in tomcat server?

I use tomcat as web server,I want to deploy many same war file in tomcat server with different config. How to do this in the best way possible manner?
So I want to run tomcat server per each war application, my means is tomcat1 handle the .war1 in webapp and ... or handle all war files with one tomcat?which one is better?
Change the names of your war files and deploy
Use the same tomcat server, but copy and rename your web application to something different. For eg, the original application name app, copy and rename as following.
webapp -> app1
app2
app3
Running a different tomcat server for each war application might not be necessary.

How to redeploy a war in tomcat seamlessly?

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

Clear all sessions for web application in tomcat 7

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="" />

Viewing Deployed Apps in Weblogic Server

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.

Categories

Resources