3

I have weblogic 12.4.2 running inside Linux and my development environment is in Windows. Currently, if I want to redeploy the app, I do maven clean install and login in to Linux with ssh client, kill process of weblogic, copy my jar files into domain's directory, and run weblogic again. I want a tool that copy's jar files in to appropriate location in the server and redeploys the app without need to restart weblogic and preferably does not depend on IDEs.

I found weblogic hot deploy, and fast swap to redeploy app on weblogic without restarting. And the weblogic.Deployer, Admin Console, wldeploy Ant Task , WebLogic Scripting Tool and weblogic maven plugin to deploy app on weblogic remotely. I searched about them but I'm not sure that which of them can do all these things together and what are their advantages and disadvantages.

If possible, please give comparison of existing tools. I saw similar questions but they only focused on redeploying without restarting or deploying remotely and I want both.

hamidreza75
  • 567
  • 6
  • 15
  • 2
    Every application server can redeploy an application without restarting the server. For WLS it is well documented [here](https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/depgd/understanding.html#GUID-F6E8BF0B-FBCF-44D2-A33F-13C4EF2E0031) including a section on "Deployment Tools". I dont think you can get a more complete answer here than in the official docs. – frifle Apr 19 '21 at 08:53
  • I read about hot deployment on that document, but normally if I replace some jar files in my domain, weblogic does not recognize or reload them. Do I need to do something for that? – hamidreza75 Apr 20 '21 at 11:25
  • 1
    An Application is usually deployed as .war or .ear-file. You .jar files should be part of those archives. A redeployments means to deploy the whole .war or .ear including your .jar. WLS also supports deployment of shared libraries. But as far as I know those are deployed as .ear as well. – frifle Apr 20 '21 at 13:14

1 Answers1

2

Yes, you can use the management REST API.

Here you can check specific examples on how to deploy/redeploy applications.

This REST API give you tools to deploy applications (EAR and WAR files) and start/stop them using only the curl tool. Check some examples:

# Stops a deployed application
curl -v --user ${USER}:${PASS} \
 -H X-Requested-By:MyClient \
 -H Accept:application/json \
 -H Content-Type:application/json \
 -X POST http://localhost:7001/management/weblogic/latest/domainRuntime/deploymentManager/appDeploymentRuntimes/${APP_NAME}/stop

# Deploy an application from a file
curl -v --user ${USER}:${PASS} \
 -H X-Requested-By:MyClient \
 -H Accept:application/json \
 -H Content-Type:multipart/form-data \
 -F "model={
   name:    'basicapp',
   targets: [ { identity: [ 'clusters' , 'Cluster1' ] } ]
 }" \
 -F "sourcePath=@/deployments/BasicApp/app/BasicApp.ear" \
 -F "planPath=@/deployments/BasicApp/plan/Plan.xml" \
 -H "Prefer:respond-async" \
 -X POST http://localhost:7001/management/weblogic/latest/edit/appDeployments

You can use shell aliases and shell scripts to automate certain operations.

jaguililla
  • 1,916
  • 18
  • 21
  • 1
    Do I need to restart weblogic after deploying ear or a module in an exploded ear? Whats the differences between management REST API vs other tools such as wlst or maven plugin in deployment? – hamidreza75 Apr 20 '21 at 05:07
  • You don't have to restart Weblogic after deploying an application with the management API. The main difference with the other tools you mention is that you don't need to install anything, you can use the management API from any environment (for example, CI/CD servers). Also, it is easy to integrate with shell scripts or Python. – jaguililla Apr 20 '21 at 14:43
  • I deploy my ap as exploded archive not ear archive. Can I only redeploy some module and does weblogic refresh hole app or only changed modules? – hamidreza75 Apr 21 '21 at 11:25
  • Sorry, I don't know those details – jaguililla Apr 21 '21 at 16:42
  • If this answer was of use to you, I would appreciate that you select it as the correct answer. Thanks! – jaguililla Apr 23 '21 at 17:55
  • your answer was somewhat useful. My friend and me upvoted your answer and you have 2 points and according to [stackoverflow bounty rools](https://stackoverflow.com/help/bounty), it wil give you 25 points automatically. If you agree, I'll give you half of the bounty because of these reasons: 1. You did not provide comparison between other existing tools. 2. You did not concentrate on redeployment options like on redeployment of one module of app, hot deploy, auto deploy, or fast swap. If you disAgree, please tell me on comments as soon as possible. Thanks. – hamidreza75 Apr 25 '21 at 21:19
  • 1
    Ok, I find it fair enough... I did my best, however, I'm not an expert on the subject. As a personal note: I would stick to Maven plugin for development (you can tie plugin's goals to the install phase) and use the Management REST API for everything else. I hope my answer helped you. Thanks for your feedback and honesty! – jaguililla Apr 26 '21 at 13:09