1 Reply Latest reply: May 15, 2013 9:10 AM by Anton_ RSS

    Map Resource References via WLST

    Anton_
      Hello,

      I used to deploy ears via Enterprise Manager Fusion Middleware Control (EM), now moving to WLST I'm facing some problems.

      (1) How to change Application Name and Context Root of Web Modules of the deployment. When deploying via EM those are html fields with value from web.xml, I assume (Step 3 of 4). You can either hit "Next" and accept those values or you enter new application name and context root (what I need to do). How to change the values via WLST script? After googling a lot I think I need to modify the deployment plan somehow, right? I used to create a new deployment plan for every deployment, ideally in WLST script I would do something like: create new deployment plan like WL usually creates with defaults, then change application name and context root. Is it possible?

      (2) In Step 4 of 4 you can modify Deployment Settings -> Deployment Tasks -> Configure Web Modules, then you click on a pencil, and you see the module name and "Map Resource References" where you can provide a value for your references defined in web.xml. For example, you develop locally against data source testDS. In the dialog I describe you see "jdbc/testDS" and you can enter a value for this reference like "jdbc/DScreatedOnWLInstance". I have already created the data source but I don't know how to map it via WLST. I could not find something related to this on the net but maybe I didn't used the right key words ;-)

      Thanks you in advance for helping a newbie.

      Any hint appreciated.

      Kind regards,
      Anton

      Edit: any ideas maybe?

      Edited by: Anton_ on Apr 24, 2013 11:57 PM

      UPDATE: I'm trying to solve my issue 1 using the deployment plan (deploy(... planPath='plan.xml' ...)) Unfortunately it's not working like expected. I'm overwriting the value of context root (defined in weblogic.xml) in the plan.xml (only a part of plan.xml without variable-definition etc.):
      <module-override>
        <module-name>ContextRootFromWeblogicXmlInJDev.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>
          <variable-assignment>
            <name>ContextRootIActuallyWant</name>
            <xpath>/weblogic-web-app/context-root</xpath>
            <operation>replace</operation>
          </variable-assignment>
        </module-descriptor>
      </module-override>
      Result:

      Wenn I expand the deployment's (ear) tree in the Admin Console under Deployments I see one module (ContextRootFromWeblogicXmlInJDev) and two web services. When deploying manually via Enterprise Manager the name of the module is ContextRootIActuallyWant and not ContextRootFromWeblogicXmlInJDev. If I click on the module and then click on the "Configuration" tab the I see an entry "Context Root: ContextRootIActuallyWant" (BTW the documentation of this entry on the right says: "Specifies context root to override the default value(name of exploded directory or name of the WAR file minus the ".war" extension)"). But this value does not override the context root of ContextRootFromWeblogicXmlInJDev although ContextRootIActuallyWant is present under Configuration tab.

      The value in weblogic.xml (what I'm trying to replace with plan.xml) takes priority over the name of the war or the value in application.xml.

      I have tried to access the WSDL of web service with context root specified under configuration tab instead of present one, but this does not work. Also updating the deployment with the plan.xml.

      Just don't know what I'm missing.

      Thanks in advance for any hint.

      Edited by: Anton_ on May 8, 2013 12:26 AM
        • 1. Re: Map Resource References via WLST
          Anton_
          Just to share the solution.

          Solved it following way:

          deployed like I usually deploy via EM and then used "Fetch Deployment Plan" in EM (you can actually fetch the plan in admin console, too, I think). And then modified that plan.xml istead of creating my own. The advantage is: EM does the magic, you only have to copy the solution ;-)

          The problem for me was, that I was not modifiying the appropriate deployment descriptor because I haven't seen the descriptor's xml file in JDeveloper. This xml was generated by JDev when using "Deploy to EAR". Only realised that after I have unzipped the generated ear.