weblogic.Deployer usage

Below article provides some sample usages of the weblogic.Deployer utility.

weblogic.Deployer is a Java-based deployment tool that provides administrators and developers command-line based deployment operations.

Deploy application on admin server:

java weblogic.Deployer -adminurl url -username username -password password -name myapp -deploy c:/myapps/myapp.ear

Deploy individual modules in application to different targets:

java weblogic.Deployer -adminurl url -username username -password password -name myapp -targets mywar@webserver,myjar@ejbserver -deploy c:/myapps/myapp.ear

Undeploy application from specified targets:

java weblogic.Deployer -adminurl url -username username -password password -name myapp -undeploy -targets server1,server2..

Redeploy application on current targets:

java weblogic.Deployer -adminurl url -username username -password password  -name myapp -redeploy

Redeploy individual module in an application:

java weblogic.Deployer -adminurl url -username username -password password -name myapp -redeploy -targets moduleA@serverA,moduleA@serverB

Partially redeploy, for example, to update a JSP in a exploded webapp:

java weblogic.Deployer -adminurl url -username username -password password -name myapp -redeploy mywar/index.jsp

The path of JSP to be updated is relative to the root of the  application. If a directory is specified the entire subtree is updated.

Multiple servers sharing the same physical deployment:

java weblogic.Deployer -adminurl url -username username -password password -name myapp -targets server1,server2 -nostage -deploy c:/myapps/myapp.ear

The -nostage option indicates that the application is available on all target servers at the same path and hence server should not copy files to the managed servers.

Deploy the first application version on admin server:

java weblogic.Deployer -adminurl url -username username -password password -name myapp -deploy c:/myapps/myapp_v1.ear

Perform Production Redeployment of a new application version on admin server:

java weblogic.Deployer -adminurl url -username username -password password -name myapp -redeploy -source c:/myapps/myapp_v2.ear

Note: The above feature is used for Side By Side deployment strategies ideally preferred for production environments.

Refer the below article know more about Side By Side deployment.

https://weblogic-wonders.com/weblogic/2009/12/02/side-by-side-deploymentversioning/

Deploy application to administration mode on admin server:

java weblogic.Deployer -adminurl url -username username -password password -name myapp -deploy c:/myapps/myapp.ear -adminmode

Note: The above feature is ideally used for sanity testing so that the application can process only admin requests.

Transition application from administration mode to running on admin server:

java weblogic.Deployer -adminurl url -username username -password password  -name myapp -start

Transition application from running to administration mode on admin server:

java weblogic.Deployer -adminurl url -username username -password password  -name myapp -stop -adminmode

Deploy a library on admin server:

java weblogic.Deployer -adminurl url -username username -password password -name mylib -library -libspecver 1.0 -libimplver 2.0 -deploy c:/myapps/mylib.jar

Note: This feature would deploy the file as library rather than as an application.

Deploy an application on admin server with a deployment plan:

java weblogic.Deployer -adminurl url -username username -password password  -plan c:/myapps/myapp/plan/plan.xml -deploy c:/myapps/myapp/app/myapp.jar

Note: The above feature uses plan.xml to help administrators easily change an application’s WebLogic Server configuration for a specific environment without modifying existing Java EE or WebLogic-specific deployment descriptors.

Refer the below article for a sample usage of plan.xml

https://weblogic-wonders.com/weblogic/2009/11/29/plan-xml-usage-for-message-driven-bean/

Update an application configuration:

java weblogic.Deployer -adminurl url -username username -password password -plan c:/myapps/myapp/plan/newplan.xml -name myapp -update

Deploy a queue to a specific JMS server:

java weblogic.Deployer -adminurl url -username username -password password -submoduletargets myqueue@myjmsmodule@JMSServer -deploy c:/myapps/myapp/app/myapp.ear

For documentation on weblogic.Deployer refer the below link:-

http://download.oracle.com/docs/cd/E14571_01/web.1111/e13702/wldeployer.htm

For trouble shooting deployment issues refer the below article.

https://weblogic-wonders.com/weblogic/2010/11/30/deployment-issues-on-weblogic-server/

Note: In the above examples we are specifying the username and password in plain text format and that could cause a  security issue.

You can use the STOREUSERCONFIG feature of the weblogic.Admin utility which generates userconfig file and userkey file containing an encrypted username and password.

Refer the below article for more information on userconfig and  userkey files.

https://weblogic-wonders.com/weblogic/2009/11/30/steps-to-use-userconfig-file-and-userkey-file/

For example, deploying an ear file using the userConfigFile feature is below.

java weblogic.Deployer -userconfigfile C:/bea103/storeconfig/config-file -userkeyfile C:/bea103/storeconfig/keyfile -name myapp -targets MS1,MS2 -deploy  C:/myapps/myapp.ear

Best Regards,

Wonders Team. 🙂

22 comments

  1. How cna i deploy libraries using weblogic deployer . I want to deploy it in a remote server .
    Please help me out .
    I tried this option it gives me this error :
    C:\OFM_TEST\user_projects\domains\base_domain>java weblogic.Deployer -adminurl t
    3://10.1.9.88:6501 -username weblogic -password weblogic -deploy -upload C:/D
    ELETE/WLST_Deploy_Test/sew-infrastructure-lib-1-0-1.war -targets BusinessServer
    1 -library -name sew-infrastructure-lib-1-0-1
    weblogic.Deployer invoked with options: -adminurl t3://10.1.9.88:6501 -username
    weblogic -deploy -upload C:/DELETE/WLST_Deploy_Test/sew-infrastructure-lib-1-0-
    1.war -targets BusinessServer1 -library -name sew-infrastructure-lib-1-0-1

    [Deployer:149105]An attempt was made to deploy a library located at ‘/usr/appl/b
    ea92/user_projects/domains/EMC/./servers/Admin/upload/sew-infrastructure-lib-1-0
    -1/app/sew-infrastructure-lib-1-0-1.war’ with name ‘sew-infrastructure-lib-1-0-1
    ‘ that is different from the one specified in the manifest of the library: ‘sew-
    infrastructure-lib’.

    1. Hi Kiran,

      The command you are using is correct.
      java weblogic.Deployer -adminurl t3://10.1.9.88:6501 -username weblogic -password weblogic -deploy -upload C:/DELETE/WLST_Deploy_Test/sew-infrastructure-lib-1-0-1.war -targets BusinessServer
      1 -library -name sew-infrastructure-lib-1-0-1

      This error occurs when you attempt to specify a name that is different from the one in the manifest of the library in the source location.
      Solution: Perform deployment again without specifying the name of the library.

      You can look out for the Manifest.mf file and make the changes accordingly.
      Do let us know, how it goes.

      Regards,
      Wonders Team. 🙂

  2. Hello Anand,

    Can you please let me know if there is an option to deploy my war file to the virtual host and the ejb module to the cluster members?

    Regards,
    Kiran

  3. Good work Weblogic wonders team. Expective more and active discussion in the future. Kudos

  4. Hi,

    I’m trying to update a JSP using the -redeploy. After running the command, i’m getting the message as redeploy completed on Server.

    But, when I check the application, my changes are not reflecting.

    Please help me. Thanks in advance.

    -Yusuf

    1. Hi Yusuf,

      Can you tell me the weblogic server version you are using?

      Also, please let me know the complete command you execute to redeploy the application. Is this the one? —
      java weblogic.Deployer -adminurl url -username username -password password -name myapp -redeploy mywar/index.jsp

      Best Regards,
      Divya

  5. Hi Divya,

    I’m using 9.2. I’ve deployed the application as exploded directory.

    And, yes, the same i’m using.

    Regards,
    Yusuf

  6. Hi Divya,

    I’m using the version 9.2

    This is the actual command I’m using.

    java weblogic.Deployer -adminurl http://localhost:7001/console -user weblogic -password admin2468 -name myApplication -redeploy myWar/login.jsp

    I tried to do redeploy by touching the REDEPLOY file in autodeploy folder too. Even, that’s not working.

    Could it be possible that, my extended directory itself having some issues? But, java changes are getting reflected automatically. I’m facing issues only with the static files.

    Please help me out.

    Thanks & Regards,
    Yusuf

    1. Hi Yusuf,

      Can you try the exact below command:

      java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic -password admin2468 -name MyApplication -redeploy

      Let me know if this helps.

      Regards,
      Divya

  7. Hi Divya,

    Still I’m not able to redeploy my JSP.

    I checked the -listapps command. Its returning correct value. Which means the command java weblogic.Deployer -adminurl http://localhost:7001 -username weblogic -password admin2468 is fine in my machine. Only -redeploy is mystery for me 🙁

    Thanks & Regards,
    Yusuf

  8. Hi Yusuf,

    You might want to check for the bug 8182370 with oracle support for this issue.

    Best Regards,
    Divya Dureja

  9. i ‘ve installed oer 11g in wls 10.3.3. The installation was successful, but am unable to access the login page of oer server.

    kindly hepl me..

  10. Am getting the following error while undeploying the application

    Exception in thread “main” java.lang.NoClassDefFoundError: weblogic.Deployer
    at gnu.java.lang.MainThread.run(libgcj.so.7rh)
    Caused by: java.lang.ClassNotFoundException: weblogic.Deployer not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
    at java.net.URLClassLoader.findClass(libgcj.so.7rh)
    at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
    at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
    at gnu.java.lang.MainThread.run(libgcj.so.7rh)

    Am using the following command to undeploy it

    java weblogic.Deployer -adminurl http://217.78.215.196:7001/console -username Weblogic -password Awfweb1# -name Artemis -undeploy -targets awf_Preprod

    Thanks in advance
    Regards,
    Dhana

    1. Hi Dhana,

      Set the Weblogic Classpath

      Go to wlserver\bin and run the script setWLSEnv.sh/setWLSEnv.bat

  11. Hi,

    Am still getting following error even after running the setWLSEnv.bat.

    “Exception in thread “main” java.lang.NoClassDefFoundError: weblogic.Deployer”

    Please anybody let me know where should i run this command?

    1. you need to set your environment first.. go to WL_HOME\server\bin and execute setWLSEnv.cmd from the command prompt..

  12. Hi,

    I am trying to redeploy a war on admin server running on ssl port 7002 but getting below exception:
    Command : java weblogic.Deployer -adminurl t3s://:7002 -username weblogic -password ***** -name -redeploy

    Error :
    Unable to connect to ‘t3s://:7002’: Destination , 7002 unreachable; nested exception is:
    javax.net.ssl.SSLException: Received fatal alert: unexpected_message; No available router to destination. Ensure the url represents a running admin server and that the credentials are correct. If using http protocol, tunneling must be enabled on the admin server.

Comments are closed.