So I gave it a try…
With the help of a blog post of Jay senSharma it actually was quite an easy job.
Step 1:
I copied the MIDDLEWARE_HOME\wlserver_10.3\server\bin\setWLSEnv.cmd to C:\Hudson_Slave_Node\workspace, and renamed it to deployWLS.cmd
Step 2
I created a python script file called deployDummy.py and added it to the same directory.
This is the content of the python file
connect('weblogic','weblogic1','t3://localhost:7101')
edit()
startEdit()
deploy('dummy_application1','C:\Hudson_Slave_Node\workspace\trunk\dummy.ear',targets='DefaultServer')
save()
activate()
startApplication(' dummy_application1')

Step 3:
I changed the bottom of deployWLS.cmd to look like:
…
@echo Your environment has been set.
@echo Deploy to WLS
java weblogic.WLST C:\Hudson_Slave_Node\workspace\deployDummy.py
@echo Deploy to WLS Finished
:finish
Step 4:
I added a new ‘Windows batch command’ Build step in Hudson that executes the deployWLS.cmd file.

Step 5:
Grab a pint of (Belgium) Beer, sit down, relax and see how the job is now done for you... :-)
Troubleshooting
If you receive the following error:
weblogic.application.ModuleException:
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:290)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare ModuleListenerInvoker.java:93)
...
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: weblogic.common.ResourceException: java.security.PrivilegedActionException: weblogic.common.ResourceException: java.security.PrivilegedActionException: weblogic.common.ResourceException: No credential mapper entry found for password indirection user=cm for data source CM
at weblogic.jdbc.common.internal.DataSourceConnectionPoolConfig.getPoolProperties(DataSourceConnectionPoolConfig.java:84)
...
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:252)
You have to adjust your application properties in a way that they‘ll not include the weblogic-jdbc.xml. It’s not possible to automatically deploy your ear file with this option. So uncheck this option and add a DataSource with the correct JNDI name via the WLS console.


References
Jaysensharma's Blog
Forum: WebLogic Server - Upgrade / Install / Environment / Migration
Thread: WLST to deploy ear file
Using the WebLogic Scripting Tool
WLST Command and Variable Reference
Nice!
ReplyDeleteJust adding that "blog post of Jay senSharma" has moved to middlewaremagic.com/weblogic/?p=303
Thanx!