1 Reply Latest reply: Jul 10, 2008 7:28 PM by 3004 RSS

    context root update with deployment plan in weblogic 10 not working

    666705
      Hi,



      I have trouble changing the context-root of a web application with deployment plan. Does anybody have experience with it?





      I have the following environment settings:


      set JAVA_HOME=C:\beawli\jrockit_150_11



      set ANT_HOME=C:\apache-ant-1.7.0



      set PATH=C:\apache-ant-1.7.0\bin;C:\beawli\jrockit_150_11\bin;C:\apache-ant-1.7.0\bin;C:\beawli\jrockit_150_11\bin;C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\Program Files\Wave Systems Corp\Dell Preboot Manager\Access Client\v5;C:\Program Files\Common Files\Teleca Shared;C:\Program Files\QuickTime\QTSystem;



      set CLASSPATH=C:\beawli\wlserver_10.0\server\lib\weblogic.jar;.;





      I have an ear file with the following application.xml:



      <?xml version="1.0" encoding="UTF-8"?>

      <application xmlns="http://java.sun.com/xml/ns/j2ee"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee

      http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"

      version="1.4">

      <display-name>stufkletser-ear</display-name>

      <module>

      <web>

      <web-uri>stufkletser-ws.war</web-uri>

      <context-root>stufkletser-levent</context-root>

      </web>

      </module>

      </application>





      I created a deployment plan with the following command:

      java weblogic.PlanGenerator -all stufkletser-app.ear

      Generating plan for application stufkletser-app.ear

      Export option is: all

      Exporting properties...

      Saving plan to C:\ plan.xml...

      <20-jun-2008 12:24:19 uur CEST> <Info> <J2EE Deployment SPI> <BEA-260086> <The d

      escriptor information at C:\DOCUME~1\LEVENT~1\LOCALS~1\Temp\Levent Tutar\.\confi

      g\deployments\stufkletser-app.ear\plan\stufkletser-ws.war\WEB-INF\weblogic.xml was saved to configuration area.>

      <20-jun-2008 12:24:19 uur CEST> <Info> <J2EE Deployment SPI> <BEA-260072> <Saved configuration for application, stufkletser-app.ear>





      Editing plan.xml



      I replaced the following

      <variable>

      <name>WeblogicWebApp_ContextRoots_12139574589845</name>

      <value xsi:nil="true"></value>

      </variable>

      With

      <variable>

      <name>WeblogicWebApp_ContextRoots_12139574589845</name>

      <value>levent</value>

      </variable>



      And (for testing purposes)



      <variable>

      <name>SessionDescriptor_CookieMaxAgeSecs_121395745903116</name>

      <value xsi:nil="true"></value>

      </variable>



      <variable>

      <name>SessionDescriptor_CookieMaxAgeSecs_121395745903116</name>

      <value>123</value>

      </variable>



      Also added <operation>replace</operation> to two places:



      <variable-assignment>

      <name>SessionDescriptor_CookieMaxAgeSecs_121395745903116</name>

      <xpath>/weblogic-application/session-descriptor/cookie-max-age-secs</xpath>

      <operation>replace</operation>

      </variable-assignment>



      ….



      <variable-assignment>

      <name>WeblogicWebApp_ContextRoots_12139574589845</name>

      <xpath>/weblogic-web-app/context-root</xpath>

      <operation>replace</operation>

      </variable-assignment>





      Deploying the application with WLST:




      Content of deploy.py

      connect('weblogic', 'weblogic', 't3://localhost:8001')

      edit()

      startEdit()

      progress=deploy(appName='stufkletser-app',path='C:/stufkletser-app.ear',planPath='C:/ plan.xml')

      progress.getState()

      save()

      activate()





      java weblogic.WLST



      Initializing WebLogic Scripting Tool (WLST) ...



      Welcome to WebLogic Server Administration Scripting Shell



      Type help() for help on available commands



      wls:/offline> execfile('deploy.py')

      Connecting to t3://localhost:8001 with userid weblogic ...

      Successfully connected to Admin Server 'AdminServer' that belongs to domain 'els

      b_domain'.



      Warning: An insecure protocol was used to connect to the

      server. To ensure on-the-wire security, the SSL port or

      Admin port should be used instead.



      Location changed to edit tree. This is a writable tree with

      DomainMBean as the root. To make changes you will need to start

      an edit session via startEdit().



      For more help, use help(edit)



      Starting an edit session ...

      Started edit session, please be sure to save and activate your

      changes once you are done.

      Deploying application from C:\stufkletser-app.ear to targets (upload=false) ...

      You have an edit session in progress, hence WLST will not

      block for your deployment to complete.

      Started the Deployment of Application. Please refer to the returned WLSTProgress

      object or variable LAST to track the status.

      Saving all your changes ...

      Saved all your changes successfully.

      Activating all your changes, this may take a while ...

      The edit lock associated with this edit session is released

      once the activation is completed.

      Activation completed

      wls:/elsb_domain/edit>







      Result after deployment

      I see in weblogic console the following:

      Context Root /stufkletser-levent

      I expected /levent as context root.

      The other parameter has been set to 123.

      Session cookies max age (in seconds): 123



      Question:

      Why can’t I change the context root?

      Kind regards,

      Levent
        • 1. Re: context root update with deployment plan in weblogic 10 not working
          3004
          I think you are trying to change the context-root in weblogic.xml
          instead of the context root in application.xml

          Should you use an xpath like

          <xpath>/application/module/web/context-root</xpath>


          Levent Tutar wrote:
          Hi,



          I have trouble changing the context-root of a web application with deployment plan. Does anybody have experience with it?





          I have the following environment settings:


          set JAVA_HOME=C:\beawli\jrockit_150_11



          set ANT_HOME=C:\apache-ant-1.7.0



          set PATH=C:\apache-ant-1.7.0\bin;C:\beawli\jrockit_150_11\bin;C:\apache-ant-1.7.0\bin;C:\beawli\jrockit_150_11\bin;C:\oraclexe\app\oracle\product\10..2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\Program Files\Wave Systems Corp\Dell Preboot Manager\Access Client\v5;C:\Program Files\Common Files\Teleca Shared;C:\Program Files\QuickTime\QTSystem;



          set CLASSPATH=C:\beawli\wlserver_10.0\server\lib\weblogic.jar;.;





          I have an ear file with the following application.xml:



          <?xml version="1.0" encoding="UTF-8"?>

          <application xmlns="http://java.sun.com/xml/ns/j2ee"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee

          http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"

          version="1.4">

          <display-name>stufkletser-ear</display-name>

          <module>

          <web>

          <web-uri>stufkletser-ws.war</web-uri>

          <context-root>stufkletser-levent</context-root>

          </web>

          </module>

          </application>





          I created a deployment plan with the following command:

          java weblogic.PlanGenerator -all stufkletser-app.ear

          Generating plan for application stufkletser-app.ear

          Export option is: all

          Exporting properties...

          Saving plan to C:\ plan.xml...

          <20-jun-2008 12:24:19 uur CEST> <Info> <J2EE Deployment SPI> <BEA-260086> <The d

          escriptor information at C:\DOCUME~1\LEVENT~1\LOCALS~1\Temp\Levent Tutar\.\confi

          g\deployments\stufkletser-app.ear\plan\stufkletser-ws.war\WEB-INF\weblogic.xml was saved to configuration area.>

          <20-jun-2008 12:24:19 uur CEST> <Info> <J2EE Deployment SPI> <BEA-260072> <Saved configuration for application, stufkletser-app.ear>





          Editing plan.xml



          I replaced the following

          <variable>

          <name>WeblogicWebApp_ContextRoots_12139574589845</name>

          <value xsi:nil="true"></value>

          </variable>

          With

          <variable>

          <name>WeblogicWebApp_ContextRoots_12139574589845</name>

          <value>levent</value>

          </variable>



          And (for testing purposes)



          <variable>

          <name>SessionDescriptor_CookieMaxAgeSecs_121395745903116</name>

          <value xsi:nil="true"></value>

          </variable>



          <variable>

          <name>SessionDescriptor_CookieMaxAgeSecs_121395745903116</name>

          <value>123</value>

          </variable>



          Also added <operation>replace</operation> to two places:



          <variable-assignment>

          <name>SessionDescriptor_CookieMaxAgeSecs_121395745903116</name>

          <xpath>/weblogic-application/session-descriptor/cookie-max-age-secs</xpath>

          <operation>replace</operation>

          </variable-assignment>



          ….



          <variable-assignment>

          <name>WeblogicWebApp_ContextRoots_12139574589845</name>

          <xpath>/weblogic-web-app/context-root</xpath>

          <operation>replace</operation>

          </variable-assignment>





          Deploying the application with WLST:




          Content of deploy.py

          connect('weblogic', 'weblogic', 't3://localhost:8001')

          edit()

          startEdit()

          progress=deploy(appName='stufkletser-app',path='C:/stufkletser-app.ear',planPath='C:/ plan.xml')

          progress.getState()

          save()

          activate()





          java weblogic.WLST



          Initializing WebLogic Scripting Tool (WLST) ...



          Welcome to WebLogic Server Administration Scripting Shell



          Type help() for help on available commands



          wls:/offline> execfile('deploy.py')

          Connecting to t3://localhost:8001 with userid weblogic ...

          Successfully connected to Admin Server 'AdminServer' that belongs to domain 'els

          b_domain'.



          Warning: An insecure protocol was used to connect to the

          server. To ensure on-the-wire security, the SSL port or

          Admin port should be used instead.



          Location changed to edit tree. This is a writable tree with

          DomainMBean as the root. To make changes you will need to start

          an edit session via startEdit().



          For more help, use help(edit)



          Starting an edit session ...

          Started edit session, please be sure to save and activate your

          changes once you are done.

          Deploying application from C:\stufkletser-app.ear to targets (upload=false) ...

          You have an edit session in progress, hence WLST will not

          block for your deployment to complete.

          Started the Deployment of Application. Please refer to the returned WLSTProgress

          object or variable LAST to track the status.

          Saving all your changes ...

          Saved all your changes successfully.

          Activating all your changes, this may take a while ...

          The edit lock associated with this edit session is released

          once the activation is completed.

          Activation completed

          wls:/elsb_domain/edit>







          Result after deployment

          I see in weblogic console the following:

          Context Root /stufkletser-levent

          I expected /levent as context root.

          The other parameter has been set to 123.

          Session cookies max age (in seconds): 123



          Question:

          Why can’t I change the context root?

          Kind regards,

          Levent