This content has been marked as final. Show 7 replies
I think you should be able to use a deployment plan to change the context root which should not require you to change your application archive.
James, really appreciate your time. I created Plan.xml and added the tag <context-root>/</context-root>. When I tried to deploy the application archive file, I get the exception :
[J2EE:160174]ERROR: Failed to parse deployment plan 'C:\deployments\production\myApp\plan\Plan.xml': VALIDATION PROBLEMS WERE FOUND C:\deployments\production\myApp\plan\Plan.xml:17:5:17:5: problem: cvc-complex-type.2.4b: Element not allowed: context-root@http://www.bea.com/ns/weblogic/90 in element deployment-plan@http://www.bea.com/ns/weblogic/90:
I am not sure should I use ns declaration for weblogic 10 instead of 9.0.
Also, there is caution mentioned by Oracle in http://download.oracle.com/docs/cd/E12840_01/wls/docs103/deployment/config.html#wp1065363
Caution: Oracle does not support using a deployment plan to change the context-root in an application.xml file. However, if an application is deployed as a library, you can either change the context-root through an weblogic-application.xml file or use the deployment plan to change the context-root in an weblogic-application.xml file.
Additional info :
The Plan.xml looks as shown below :
<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-deployment-plan.xsd">
Maybe I'll blog this because it didn't work when I tried it as exploded (deployed directly from the IDE), but it did once I tried an EAR outside of the IDE (OEPE in this case).
Thanks to Edmond for helpful clues on this:
First export the EAR to a directory
Then go to your domain's bin dir with a shell and call setDomainEnv
Then call a command like this from the dir where the EAR is with that same shell:
java weblogic.PlanGenerator -all -plan Plan.xml PlanEAR.ear
That should generate a Plan.xml file.
The original weblogic.xml actually had the name of the context root explicitly defined for me like this:
So firstly, we have to set the variable assignment in Plan.xml, where "FooPlan" is the value I want for my new context root.
So in order to override the context root we need to do a replace instead of a variable assignment since the element already exists. Edit Plan.xml again.
Now we can do a redeployment with this new deployment plan provided the EAR and Plan.xml and I can now access the application at http://locahost:7001/FooPlan/.
java weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password welcome1 -redeploy -name PlanEAR -source PlanEAR.ear -targets AdminServer -plan Plan.xml
James, thanks a lot for useful information and really appreciate your effort and time in this regard. It really helped me to understand the power of deployment plan.
Just wondering why console feature to designate an application as default is removed in wls later versions. BEA could have kept this feature as it is in the later versions. The console feature will avoid all these manual steps we need to do to make an application as default application.
Thanks again for your precious information and I am glad that I learnt something new.
I found an easier way, you can do it from the console and it will auto-gen the deployment plan for you. Both methods are described in my blog entry:
James, beautiful article you have provided to us. Thanks so much. I still have one concern but you can ignore my concern :-).
Basically I do not want to work on deployment plan at all. I was just looking for that 8.1 console feature ( in 10.3 ) which allowed us to assign default application for each of the weblogic server from the drop down. In 8.1 we did not have to take any effort to deal with any xml file for this console feature.
Looks like in 10, it is gone. That's fine. I will refer your blog to come up with deployment plan.