7 Replies Latest reply on Jul 23, 2009 8:54 PM by 702392

    WLS 10 console -- does not have feature to Designate Default web applicatio

    702392
      Hi Everyone,

      I noticed that in weblogic 10 version, from the console we can not assign default web application to a server. This was there in 8.1 console ( server configuration-general tab). If my war or ear file is ready and released into prod but I do not want to untar it again to add <context-root> into the DD. I thought I can do it from console but I am able to set default web application from WLS 10 console.

      Appreciate help if anybody knows how to do it from WLS 10 console.

      thanks.
        • 1. Re: WLS 10 console -- does not have feature to Designate Default web applicatio
          user161771 - oracle
          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.
          http://download.oracle.com/docs/cd/E12840_01/wls/docs103/deployment/config.html#wp1057141
          • 2. Re: WLS 10 console -- does not have feature to Designate Default web applicatio
            702392
            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.


            thanks
            • 3. Re: WLS 10 console -- does not have feature to Designate Default web applicatio
              702392
              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">
              <application-name>app-root</application-name>
              <module-override>
              <module-name>MyApp.war</module-name>
              <module-type>war</module-type>
              <module-descriptor external="false">
              <root-element>weblogic-web-app</root-element>
              <uri>WEB-INF/weblogic.xml</uri>
              </module-descriptor>
              <module-descriptor external="false">
              <root-element>web-app</root-element>
              <uri>WEB-INF/web.xml</uri>
              </module-descriptor>
              </module-override>
              <config-root xsi:nil="true"></config-root>
              *<context-root>/</context-root>*
              </deployment-plan>

              Thanks.
              • 4. Re: WLS 10 console -- does not have feature to Designate Default web applicatio
                user161771 - oracle
                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:
                http://biemond.blogspot.com/2009/04/using-weblogic-deployment-plan-to.html

                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:
                <wls:context-root>PlanWEB</wls:context-root>

                So firstly, we have to set the variable assignment in Plan.xml, where "FooPlan" is the value I want for my new context root.

                Original:
                <variable>
                <name>WeblogicWebApp_ContextRoots_12482790756401</name>
                <value xsi:nil="true"></value>
                </variable>

                New:
                <variable>
                <name>WeblogicWebApp_ContextRoots_12482790756401</name>
                <value>FooPlan</value>
                </variable>


                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.

                Original:
                <variable-assignment>
                <name>WeblogicWebApp_ContextRoots_12482790756401</name>
                <xpath>/weblogic-web-app/context-root</xpath>
                </variable-assignment>

                New:
                <variable-assignment>
                <name>WeblogicWebApp_ContextRoots_12482790756401</name>
                <xpath>/weblogic-web-app/context-root</xpath>
                <operation>replace</operation>
                </variable-assignment>

                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
                • 5. Re: WLS 10 console -- does not have feature to Designate Default web applicatio
                  702392
                  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.
                  • 6. Re: WLS 10 console -- does not have feature to Designate Default web applicatio
                    user161771 - oracle
                    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:
                    http://blogs.oracle.com/jamesbayer/2009/07/11gr1_update_and_a_deployment.html

                    Cheers
                    • 7. Re: WLS 10 console -- does not have feature to Designate Default web applicatio
                      702392
                      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.

                      thanks.