ear deployment in weblogic - deployment

I have an ear file containing 5 webapps. I want to use the same datasource in all the webapps. Note this datasource will be created during the deployment of one of the webapps. For this reason, I want to give the sequence of deployment of webapps in my weblogic. I created application.xml in the sequence I want to deploy the webapps so that datasource is created when the first app is deployed and there after other apps can use it. However it seems the weblogic is not starting the app in the sequence as given in application.xml. Can anyone guide what more is required to specify the sequence of deployment of webapps in an ear?
Thanks

Why didn't you configure On weblogic Server a Datasource and bind it in your 5 webapps?

We can order the deployments in admin console while deploying the application...
Whenever you deploy any ear file...it will ask deployment order which is final one in that wizard and it's default value is 100.
you can specify the order like 100,101,102,103,104...or whatever number you want based on your requirement

Related

Update an existing war on jboss EAP 7 without redeploy

On my Jboss EAP 7 server an application.war is deployed. Now i want to update and add some class and jsp files.How can i update existing war without deploying whole war?
#ehsavoie as per your suggestion I can change only jsp file but for Web-Content files I need to restart the application and here is the catch that Jboss maintain the checksum of every deployed application but you copy your new file at an already exploded application. This doesn't affect checksum so, now after restart it explodes your last .war and your changes reverted.
Efficient way to partial deployment is use deployment:add-content command in cli mode.
/deployment=DEPLOYMENT_NAME.war:add-content(content=[{target-path=/path/to/FILE_IN_DEPLOYMENT, input-stream-index=/path/to/LOCAL_FILE_TO_UPLOAD}]
Here is the link if you want to read more.

How to deploy two war files onto Jboss 6.4.0

I have two war files msg-producer and msg-consumer. How to deploy these two war files onto jboss 6.4.0 simultaneously?
currently deploying one war file like this:
copy war file into EAP\standalone\deployments folder
Run standalone.bat from EAP-6.4.0\bin.
Yes, you can deploy two or multiple WAR files into EAP\standalone\deployments folder.
Each web application will have a different context root, using context root you can access the application.
Yes, You can deploy two or more WAR/EAR files in the JBoss Application server.
Please go through the $JBOSS_ROOT/standalone/deployments/README.txt
There are two different modes 1. auto-deploy mode and 2. manual deploy mode
Manual deployment relies on a system of marker
files, with the user's addition or removal of a marker file serving as a sort
of command telling the scanner to deploy, undeploy or redeploy content.
Auto-deploy mode: The scanner will directly monitor the deployment content,
automatically deploying new content and redeploying content whose timestamp
has changed.
Read the README.txt for more details.
The simplest way I recommend is
Login the JBoss admin console
Under deployments tab, click on "add" and select the required msg-producer and msg-consumer war files. "Enable" checkbox to be selected.
Access the application http://localhost(or_servername):8080/contextroot/

JBoss 7 as deploys automatically

I put my jboss on the linux server, exported the war file and placed it on the deployments folder and it automatically deployed. I didn't even had to do it via command line. How is this working?
My jboss has ssl to it.
From the Application Deployment documentation:
The standalone/deployments directory in the JBoss Application Server 7 distribution is the location end users can place their deployment content (e.g. war, ear, jar, sar files) to have it automically deployed into the server runtime.
So, if you put a war file in standalone/deployments, JBoss will detect it and act as if you had manually deployed it. The documentation page has a lot more info about configuration if you want to change the defaults.

How to deploy war on websphere 8 without using Admin Console?

How do we a deploy a simple war file on the websphere server 8 without using the websphere administration console?
As a part of the manual deployment I will need to know,
where to put the war file manually on the server?
war uses jndi for db connection, since we do not want to use admin console,
how do we create jndi data sources?
we would also want to externalize the properties file. (like I used to keep
application.properties in JBOSS_HOME/server/default/conf folder in jboss instead of the app.war/web-inf/classes)
Please help
PS: Actually we will be having an ant build which will do these three things for us so that we don't have to go to the admin console. Just run the ant build and it will copy war, create jndi etc stuff.
The best way of doing what you want is writing a wsadmin script.
Using wsadmin you can deploy, add/delete/modify resources in WebSphere, pretty much anything.
I would suggest you read Getting started with wsadmin scripting
You can also use 'monitoredDeployableApps' folder under server profile. You can enable this feature from the admin console -> Applications -> Global deployment settings.
Simple and best way to do this is in two steps: (v 8+)
Enable 'monitoredDeployableApps' feature in Admin Console -> Applications -> Global Deployment Settings and restart the server. (once restart you will see a folder in your profile 'monitoredDeployableApps' (default name and can be changed while enabling this feature)
Drag and Drop your war file in this folder (no restart needed) and observer Systemout.log of the server. Verify in Admin Console for the deployed application.
NOTE: Make sure your context-root is populating to your deployable (war,ear,...) files.
-- Prakash Karri

Deployment of Web Application to a Running Tomcat

I would like to collect some best-practices on deployment of a web-application to a running Tomcat. Not long ago I had to describe the deployment process of our web-application and the process appeared rather confusing.
Say, we have an application in a WAR file (foo.war) correctly configured and not requiring additional configuration. In this case, the deployment process is rather easy:
Copy the foo.war file to the $CATALINA_HOME/webapps directory. If the application starts correctly, the application will automatically deploy to $CATALINA_HOME/webapps/foo directory.
To undeploy the application:
Remove the foo.war file from the $CATALINA_HOME/webapps. If the application unloads correctly, it will be unloaded and the $CATALINA_HOME/webapps/foo will be removed.
Now I want to override some context parameters in my running application. Having read the docs, all I need to do:
Create a context.xml file called foo.xml
Copy the file to the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory.
Unfortunately, that did not work: the application would not restart. Empirically, we found out that the only working solution is when the war file is deployed to a location outside the $CATALINA_HOME/webapps.
Besides, the default values of the configurable context parameters in the WAR file should be specified in the web.xml, since context.xml in the WAR file is not read when there is a context.xml outside.
Here is an easy example of the foo.xml:
<?xml version='1.0' encoding='utf-8'?>
<Context docBase="/path-to-deployment-directory/foo.war">
<Parameter name="myparam" value="newvalue" override="false"/>
</Context>
Be sure to specify override=false for the parameter if you want the 'newvalue' to override the value specified in the WAR's web.xml. This was not obvious for us.
Thus, to deploy an aplication to a running Tomcat:
Create a context.xml file called foo.xml
Copy the file to the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory.
Copy the foo.war to the location specified in the docBase of the foo.xml; the application will deploy automatically.
To apply new context parameters:
Add the parameter values to the foo.xml and save the file; the application will re-deploy automatically.
To undeploy the application:
Remove the foo.xml from the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory
Note that removing the foo.war will also work, but will remove the foo.xml as well.
By now, I have the following questions:
Is it a best-practice at all to deploy a web-application without stopping the tomcat? I heard an opinion that deployment to a running tomcat is never needed since people run each application in a separate tomcat.
Is it a good idea to copy WAR files to $CATALINA_HOME/webapps or they should better be kept in a separate location?
How can I configure an application deployed to $CATALINA_HOME/webapps
Why there is no INFO line in the catalina.out for deployment of an application and there is one for undeployment? Is it configurable?
On question (1), Tomcat works great for deploying servlets into a running server. There may be concerns w.r.t. security or possibly D.O.S. or provisioning reasons why you would have separate server instances.
You have the flexibility to do either way, but it is often more convenient to deploy to an already running server. This is a BUILT-IN feature in the servlet architecture. :)
For (2), again it is at your discretion where you you want to put WARs. It sounds like you already have it configured a non-standard (non-default I should say) way. Check your server.xml file for the settings in your server instance(s). Check for attributes like unpackWARs and autoDeploy.
For (3) and (4), plus your (1,2) questions, it might be a good idea to consult the Tomcat docs for your version of Tomcat on its deployment model. You should be able to use the same docs to figure out how your server has been configured.
See Tomcat Web Application Deployment in the Tomcat manual, adjusting for your version of Tomcat.
One solution would be to use the manager application. If you decide that is safe to use it, then you can easily deploy, start, stop and undeploy applications:
http://localhost:8080/manager/deploy?path=[context_path]
http://localhost:8080/manager/start?path=[context_path]
http://localhost:8080/manager/stop?path=[context_path]
http://localhost:8080/manager/undeploy?path=[context_path]
There are ant tasks that can help you with these.
I am guessing, but do not know for sure, that stopping and starting an application will make it reread the context.xml.
Regarding your second question, I believe it is better for maintenance reasons to keep the war files in the webapps directory.