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="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
<description>Empty web.xml file for Web Application</description>
<context-param>
<param-name>wsdlUrl</param-name>
<param-value>http://localhost:7001/ws_helloworld/HelloWorldServicePort?WSDL</param-value>
</context-param>
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="http://www.bea.com/ns/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/deployment-plan http://www.bea.com/ns/weblogic/deployment-plan/1.0/deployment-plan.xsd" global-variables="false">
<application-name>helloworld.ear</application-name>
<variable-definition>
<!-- add the wsdl var -->
<variable>
<name>wsdlUrl</name>
<value>http://localhost:7101/ws_helloworld/HelloWorldServicePort?WSDL</value>
</variable>
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">
<root-element>web-app</root-element>
<uri>WEB-INF/web.xml</uri>
<!-- replace the wsdl url with the deployment url -->
<variable-assignment>
<name>wsdlUrl</name>
<xpath>/web-app/context-param/[param-name="wsdlUrl"]/param-value</xpath>
<operation>replace</operation>
</variable-assignment>
</module-descriptor>
</module-override>
<config-root>C:\DOCUME~1\ebiemond\LOCALS~1\Temp\ebiemond\.\config\deployments\ear.ear\plan</config-root>
</deployment-plan>
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%
This sounds awesome!
ReplyDeleteI 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?
Hi
ReplyDeletedid 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.
thanks
Hi,
ReplyDeleteWe 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!
Hi,
ReplyDeletewhen you use ant or wlst to deploy your ears then you can provide the plan.
thanks Edwin
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.
ReplyDeleteIs 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?
Thanks!!
Hi,
ReplyDeletefirst 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
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.
ReplyDeleteNote: The same ear file needs to be deployed against seven data sources.
ganesh
Hi,
ReplyDeleteyou 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
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.
ReplyDeleteI 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 .
Hi,
ReplyDeleteI 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 )
thanks
Yes .. i need to deploy the same EAR file , in a single managed server for seven times and each pointing to different Data Source.
ReplyDeleteOk,
ReplyDeleteDeployment 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
http://4.bp.blogspot.com/_earSixbe3dw/SlCIWeMAgdI/AAAAAAAACms/UN20O5icQI4/s1600-h/adf_em_11.png
in the em site. part of this http://biemond.blogspot.com/2009/07/adf-web-applications-and-oracle.html
and you can use wlst and try to lookup the right mbeans and change the datasource after deployment.
thanks
Thanks Edvin. Will try the options. Thanks again for your time and ideas.
ReplyDeleteA concise article to learn, thanks.
ReplyDeleteAnother 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.
Hi Edwin,
ReplyDeleteIn 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.
Hi,
ReplyDeletethe 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.
thanks
Hi Edwin,
ReplyDeleteThanks 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.
Is it possible to change wsdl urls using deployment plan generated ?
ReplyDeleteHi,
Deleteyou 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.
thanks
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
<servlet>
<display-name>CalculatorService</display-name>
<servlet-name>CalculatorService</servlet-name>
<servlet-class>
org.apache.geronimo.samples.jws.CalculatorService
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CalculatorService</servlet-name>
<url-pattern>/calculator</url-pattern>
</servlet-mapping>
.....
</web-app>
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 ?
ReplyDeleteHi,
DeleteNo 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 http://biemond.blogspot.com/2011/10/working-with-human-worklist-api-and.html
where I load a property file or read a java parameter
and here I set this on the webservice ref
http://biemond.blogspot.com/2009/04/changing-wsdl-url-endpoint-in-jax-ws.html
thanks
Hi Biemond,
ReplyDeleteI 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.....
https://forums.oracle.com/forums/message.jspa?messageID=10648703#10648703
Regards,
Tarak
Hi,
Deletewas your problem in the schedular code or in the plan, maybe you can deploy it as an exploded war and see the changes.
thanks.
This comment has been removed by the author.
ReplyDeleteHi,
ReplyDeleteHow 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
http://docs.oracle.com/cd/E15315_09/help/oracle.eclipse.tools.weblogic.doc/html/deploymentPlanEditor.html
how this can help you.
Thanks
Hi Mak,
ReplyDeleteDid 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?
Hi,
ReplyDeleteI will try to make an OEPE demo workspace with an ear plus a war together with some plans
Thanks
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.
ReplyDeleteWhen 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:
/weblogic-application/library-ref/[context-root="null",library-name="adf.oracle.domain"]/specification-version
I'm wondering if simply changing context-root="null" to context-root="/wls" would resolve this.
Any thoughts would be appreciated.
hi,
Deleteyou 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
thanks
Hi,
ReplyDeleteThanks 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 "eclipselink.target-database" property to MySQL?
org.eclipse.persistence.jpa.PersistenceProvider
datasource1
Thanks~!
Hi,
DeleteDon'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
Thanks
Hi,
ReplyDeletejust 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:
/web-app/servlet/[servlet-name="SOASchedulerServlet"]/init-param/[param-name="cronExpr"]/param-value
It works fine
Cheers