Monday, April 27, 2009

Using the WebLogic deployment plan to change your ear / war for production

With Weblogic you can use a deployment plan to change your environment settings so it works in your production environment. For example if you put your WSDL url of your web service proxy clients as a context parameter in the web.xml then you can change this by using a deployment plan. This plan is a xml file and can be easily changed. You can apply this plan even after deployment.
First let's take a look at the wsdl url parameter in the web.xml, The deployment plan will change this context parameter

<web-app xmlns:xsi="" xsi:schemaLocation=""
version="2.5" xmlns="">
<description>Empty web.xml file for Web Application</description>

To make this work, we need to generate a deployment plan. We will use your application ear or war file as input for this plan. This is the bat file I used for this.

set BEA_HOME=C:\oracle\MiddlewareJdev11g
call %BEA_HOME%\wlserver_10.3\server\bin\setWLSEnv.cmd
set PATH=%BEA_HOME%\jdk160_05\bin
set planname=HelloWorld.xml
set earfile=C:\projecten\workspace\11g_prod\ws_helloworld\webapp\deploy\helloworld.ear
java weblogic.PlanGenerator -all -plan %planname% %earfile%

This will generate a xml file. Change the deployment xml and add a new variable with the right url

<deployment-plan xmlns="" xmlns:xsi="" xsi:schemaLocation="" global-variables="false">
<!-- add the wsdl var -->

Now we can change the web.xml part where we use xpath to find the context parameter and replace the value with the just created variable

<module-descriptor external="false">

<!-- replace the wsdl url with the deployment url -->

The plan is finished and we can use this plan with the deployment. You can apply this plan on an ear in the WLS console or you can use this bat file.

set BEA_HOME=C:\oracle\MiddlewareJdev11g
call %BEA_HOME%\wlserver_10.3\server\bin\setWLSEnv.cmd
set PATH=%BEA_HOME%\jdk160_05\bin
set planname=HelloWorld.xml
set earfile=C:\projecten\workspace\11g_prod\ws_helloworld\webapp\deploy\helloworld.ear
java weblogic.Deployer -adminurl http://localhost:7101 -user weblogic -password weblogic -deploy -name HelloWorld -source %earfile% -targets DefaultServer -stage -plan %planname%


  1. This sounds awesome!

    I don't get this to work with BEA Weblogic 9.2 tho. The new values that I assign to the context-param just seem to be ignored when I deploy my ear with the modified deployment plan.

    Does this work with 9.2 or is a later version required?

  2. Hi
    did you generate the plan from your wls 9.2 home or from jdeveloper.

    and can you apply this plan in the wls console.

    and test this in wls 10.3.2, maybe you made a mistake.


  3. Hi,

    We deploy to the server using JDeveloper in development. Is there any way to have JDeveloper use a plan when it deploys?

    This is a WebService project.

    Thanks and EXCELLENT blog!

  4. Hi,

    when you use ant or wlst to deploy your ears then you can provide the plan.

    thanks Edwin

  5. We are using the built in functionality to deploy to the application server from JDeveloper in dev. On test then we are using the scripting tool.

    Is there ant way to specify a plan using the built in menus in JDeveloper when you say "Deploy to Application Server" and it drives you through the wizard?


  6. Hi,

    first i think dev should always work and you don't need a plan. probably you got your reasons.

    you can make your plugin, soa deployment has a plan support. This can be hard.

    or make a cmd script and add this to your jdev menu.

    thanks Edwin

  7. Hi, I'm using ADF 11g and my requirement is while deploying the app ear , i need to change the data source references. Since an ADF app stores the data sources at two files like web.xml and bc4j.xcfg , can i use a plan. xml to override these files.

    Note: The same ear file needs to be deployed against seven data sources.


  8. Hi,

    you have to change the Application module configuration so it uses a datasource. and in the application deployment disable jdbc connection deployment.

    now you only need to make the right datasource on every wls and then deploy the ears.

    that should work

  9. Thanks for your response Edwin. I did all you mentioned. I shall explain in details. My requirement is i have to deploy the same EAR file against seven data sources.

    I made the Application module configuration to use the custom data source . So the bc4j.xcfg file will have an element "<Custom JDBCDataSource="java:comp/env/jdbc/XXXDS>".

    In the deployment the option "Auto generate and Synchronize weblogic-jdbc.xml descriptors during deployment". is disabled.

    During deployment in a weblogic instance , i have to create a data source with the same name as in the bc4j.xcfg and in webl.xml.

    For the first time deployment i can do this matching the data source name as XXXDS.

    Say if i want to deploy the same EAR with data source name as XXXDS in the bc4j.xcfg and in web.xml, i have to create a data source in the server with the same name as XXXDS which is not possible.

    So to deploy the same ear in the same server , i need to change the Data source name in the bc4j.xcfg and web.xml at the time of deployment.

    Could you point me how to do this.

    Thanks again for your time .

  10. Hi,

    I don't really understand it. I only need to create a datasource once and I can deploy it many times.

    if I was you I would create on the wls a datasource with jdbc/XXXDS and use this as datasource in the bc4j.cfg not java:env...

    do you mean that you need to deploy this ear , 7 seven times on the same wls and use 7 different datasources.

    I know you can change the datasource after the deployment in the enterprise manager console. ( adf connections )


  11. Yes .. i need to deploy the same EAR file , in a single managed server for seven times and each pointing to different Data Source.

  12. Ok,

    Deployment plan won't work, the only thing you can is a custom ant deployment where you change the files and make a war/ ear

    or you can take a look at this

    in the em site. part of this

    and you can use wlst and try to lookup the right mbeans and change the datasource after deployment.


  13. Thanks Edvin. Will try the options. Thanks again for your time and ideas.

  14. A concise article to learn, thanks.

    Another simpler method to generate a deployment plan:
    using console, go to the configuration tab for your application, change one of the property there then click save. The console will create a deployment plan (you can specify the location & name) if the deployment plan doesn't exist yet.

    You can install the deployment plan also via console by redeploy your application while specifying the deployment plan.

    Caveat: if you have a non-dynamic properties in your deployment plan, updating will give you an exception "Non-dynamic properties were found to be updated", so you need to be sure to select "redeploy" instead of "update" on Update Application Assistant.

  15. Hi Edwin,

    In my SOA Application i had used a database adapter to write data into a table.and the JNDI of the outbound connection pool of the Database was : eis/DB/Target1
    . but for some requirements i have to change the location of database and my new outbound connection pool of the Database is : eis/DB/Target2

    [Server is same but database location is diiferent]

    I had generate the configuration file of the composite but unable to locate/change the JNDI of the Database in the Configuration file.

    Is it possible to change JNDI of tha database using configuration file?
    If possible please help.

    Thanks in Advance.

  16. Hi,

    the jndi location of the resource adapter is located in the wsdl of the database adapter.

    include this wsdl in your plan and changit.

    you can also overrule the datasource of the old resource adapter, by using the assign properties in the mediator or bpel.


  17. Hi Edwin,

    Thanks for your reply.
    I had tried the 2nd option and working fine. But can you please tell me the way to include the .wsdl file into the plan(configuration.xml)file.

    Thanks in advance.

  18. Is it possible to change wsdl urls using deployment plan generated ?

    1. Hi,

      you probably have a servlet definition in the web.xml , in the web.xml you can change the url-pattern for example. Everything you can put in the web.xml can be changed.


      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns="" version="2.5">



  19. Is it possible to change web service data control wsdl url using this method. I saw the post where you can change the wsdl and write to MDS but we are not on ps5 so cannot use that solution. Is there a way to have a context parameter and refer to it in webservice data control ?

    1. Hi,

      No you can't but you can generate a ws proxy on which you can generate a datacontrol. In the webservice ref you can do what you want.

      like I do here
      where I load a property file or read a java parameter

      and here I set this on the webservice ref


  20. Hi Biemond,

    I have a war file which will trigger my bpel process in every 5 mins. This war seems to work when i deployed using jdeveloper in Dev Env and change endpoints manually and deploy into the Test Env using Jdeveloper and working as expected. But if i go with Plan.xml and followed the process as explained by you and end result by service never got triggered.
    I generated deployment plan in same weblogic server and installed it through weblogic deployment screen and this one also giving the same result. So my doubt is do it taking the context params which i defined in web.xml or not. How to debug it? even i don't see valid information from the logs. Could you please help me?

    Here is the problem i post in oracle forum.. pleas help me.....


    1. Hi,

      was your problem in the schedular code or in the plan, maybe you can deploy it as an exploded war and see the changes.


  21. This comment has been removed by the author.

  22. Hi,

    How do did you generate this plan, I think there is something wrong with version , namespace etc.
    can you try to use OEPE and use the wizard to generate a plan with the help of the pluging

    how this can help you.


  23. Hi Mak,
    Did you get solution for overiding init-params defined in web.xml?
    I tried, It changes config-params but I am not able to override web.xml using Plan.xml.
    Any suggestion how to override init-param in web.xml?

  24. Hi,

    I will try to make an OEPE demo workspace with an ear plus a war together with some plans


  25. I need to proxy from a web server via the WLS plugin to multiple ADF apps on multiple wls servers. I do this by using the ppath attribute of the plugin (e.g. ppath='/wls/em/*') and the PathTrim directive (e.g. PathTrim='/wls') to strip off the leading /wls since the context root of the app is simply "/em" on WLS. I am using the Fusion Middleware Console webapp as a proof-of-concept.

    When I configure the plugin to delegate the requests to WLS it forwards to the server but the EM app login page is not displayed. Looking at the page source, I see that it returns a reference to the absolute URIs like "/em/adf/..." which are not accurate since we need to prefix all paths with /wls.

    Is it possible to use a deployment plan to change the URI of the ADF libraries themselves? I generated a deployment plan for em.ear, and it's a little overwhelming (1800+ lines). I see lots of variable assignments that look like this:


    I'm wondering if simply changing context-root="null" to context-root="/wls" would resolve this.

    Any thoughts would be appreciated.

    1. hi,

      you can add this to the weblogic.xml of the war and use this
      weblogic-web-app -> session-descriptor -> context-root

      don't know if you can do this in the ear and the weblogic-application.xml


  26. Hi,
    Thanks for your great article regarding this deployment plan, just one question:
    is it possible to use this mechanism to modify property value?? for example, inside persistence.xml, can I modify value of "" property to MySQL?



    1. Hi,

      Don't think so cause it mostly in a jar inside the web-inf/lib folder and I also think it can only change JEE or WebLogic deployment descriptors


  27. Hi,
    just to tell that we found the solution for overiding init-params defined in web.xml.
    You need to develop an XPath that includes "servlet" element and it's name, as follows:
    It works fine