Pages - Menu

Showing posts with label Application deployment. Show all posts
Showing posts with label Application deployment. Show all posts

Application Deployment as a Library

Saturday, July 27, 2013

J2EE library support in WebLogic Server 9.x onwards provides an easy way to share one or more J2EE modules or JAR files among multiple Enterprise Applications. 


A J2EE library is a stand-alone J2EE module, multiple J2EE modules packaged in an Enterprise Application (EAR), or a plain JAR file that is registered with the J2EE application container upon deployment. 


After a J2EE library has been registered, you can deploy Enterprise Applications that reference the library. 


Each referencing application receives a copy of the shared J2EE library module(s) on deployment, and can use those modules as if they were packaged as part of the application itself.


you need to select "Install this application as a Library" during deployment then target it to the servers where deployed applications need to access these library files.


Quick Deployment using WLST

You can use WLST to quickly deploy an Application  File in a Weblogic Server.

What do you need ?

  • The ear/war/rar/jar  file ( uploaded to a directory in the target WebLogic Server )
  • A simple WLST script
  • Credentials for the Weblogic Server ( preferrably, the weblogic user ).


  • Write a simple WLST Script to do your work and save it as "deploy.py"
print '*** WEBLOGIC : START ***'
print 'connecting to admin server....'
connect( 'weblogic', 'webl0gic', 't3://localhost:7001', adminServerName='AdminServer' )
print 'stopping and undeploying ....'
stopApplication('shoppingcart')
print 'deploying....'
deploy('shoppingcart', 'c:/shoppingcart.war', targets='AdminServer')
startApplication('shoppingcart')
print 'disconnecting from admin server....'
disconnect()
exit()
print '*** WEBLOGIC : STOP ***'

  • Open a Terminal Window / Command Prompt
  • Run the setDomainEnv.sh ( or setDomainEnv.bat ) script to set the required environment variables under <domain>/bin.
  • run :-  java weblogic.WLST deploy.py

output -

*************************************************************************************************************



java weblogic.WLST sc

ript.py

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

*** WEBLOGIC : START ***
connecting to admin server....
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'bas
e_domain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

stopping and undeploying ....
Stopping application shoppingcart.
<Oct 20, 2010 2:10:43 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiat
ing stop operation for application, shoppingcart [archive: null], to AdminServer
 .>
Completed the stop of Application with status completed
Current Status of your Deployment:
Deployment command type: stop
Deployment State       : completed
Deployment Message     : no message
deploying....
Deploying application from c:\shoppingcart.war to targets AdminServer (upload=fa
lse) ...
<Oct 20, 2010 2:10:44 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiat
ing deploy operation for application, shoppingcart [archive: c:\shoppingcart.war
], to AdminServer .>
.Completed the deployment of Application with status completed
Current Status of your Deployment:
Deployment command type: deploy
Deployment State       : completed
Deployment Message     : no message
Starting application shoppingcart.
<Oct 20, 2010 2:10:48 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiat
ing start operation for application, shoppingcart [archive: null], to AdminServe
r .>
.Completed the start of Application with status completed
Current Status of your Deployment:
Deployment command type: start
Deployment State       : completed
Deployment Message     : no message
disconnecting from admin server....
Disconnected from weblogic server: AdminServer

Exiting WebLogic Scripting Tool.

<Oct 20, 2010 2:10:51 PM IST> <Warning> <JNDI> <BEA-050001> <WLContext.close() w
as called in a different thread than the one in which it was created.>
************************************************************************************************************

Deployment : Archive & Exploded Format

Archive Files
In most production environments, you will receive a deployable module as an archive file. An archive file is a single file that contains all of a J2EE module's classes, static files, directories, and deployment descriptor files. Archive files are created by using the jar utility to package the top-level directory of a J2EE module.
Modules that are packaged using the jar utility have specific file extension depending on the module type:
  • EJBs are packaged as .JAR files.
  • Web Applications are packaged as .WAR files.
  • Resource Adapters are packaged as .RAR files.
  • Enterprise Applications are packaged as .EAR files.
In most cases, you will deploy the archive file itself with no additional preparation.
Exploded Archive Directories
An exploded archive directory contains the same files and directories as a jar archive. However, the files and directories reside directly in your file system and are not packaged into a single archive file using the jar utility.
You may need to deploy a module as an exploded archive directory, rather than a single archive file, in the following circumstances:
  • You are deploying an EJB, Web Application, or Enterprise Application that performs direct file system I/O. In this case, the components that perform the I/O operations should have a physical filesystem directory in which to work.
  • You are deploying a Web Application or Enterprise Application that contains static files that you will periodically update. In this case, it is more convenient to deploy the module as an exploded directory, because you can update and refresh the static files without editing the archive.
 

Blogger news

Blogroll

Most Reading