Saturday, November 22, 2014
On November 22, 2014 by Kamlesh 2 comments
How to Deploy Application using WLST
We can use WLST to quickly
deploy an Application in a Weblogic Server.
Requirement:-
Requirement:-
·The
ear/war/rar/jar file (uploaded to a directory in the target WebLogic Server )
·A simple
WLST script
·Credentials
for the Weblogic Server (preferably, 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', 'weblogic',
't3://localhost:7001', adminServerName='AdminServer' )
print 'stopping and undeploying ....'
stopApplication('application')
print 'deploying....'
deploy('shoppingcart', 'c:/application.war',
targets='AdminServer')
startApplication('application')
print 'disconnecting from admin server....'
disconnect()
exit()
print WEBLOGIC : STOP
·Open a
Terminal Window / Command Prompt
·Run
the setDomainEnv.sh/ setDomainEnv.bat script to set the required
environment variables under <weblogic 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 underplaying ....
Stopping application………….
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 D:\application.war to
targets AdminServer (upload=fa
lse) ...
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……….
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.
On November 22, 2014 by Kamlesh No comments
WLST Server Start
The server of a
WebLogic domain can be started using different techniques. The best setup
depends on the technical requirements but also on the security/administration
guidelines of the company. The following section introduces the different
possibilities and will provide best practices information based on real project
experience.
Administration Server
The
administration server can be started in three different ways as explained in
the subsequent sections. You can start an administration server using a start
script or using WLST with or without the NodeManager. All starting mechanisms
have their own advantages and disadvantages. Readers are advised to define
their own strategy carefully, but keep it simple and stay with one of the
discussed methods for your environments.
Using WLST and NodeManager
The NodeManager
is normally used to start managed-servers. However, it can also be used to
start the administration server.
The nmConnect command
can be used to connect to the NodeManager using WLST. The credentials can be
given either using a user/password combination or a userconfig/keyfile
combination. The following is an example that uses username/password to connect
the NodeManager.
nmConnect([username, password], [host], [port], [domainName],
[domainDir], [nmType])
nmConnect([userConfigFile,
userKeyFile], [host], [port], [domainName], [domainDir], [nmType])
Exp:-
nmConnect('weblogic','<pw>','localhost','5556','TestDomain','/application/domains/TestDomain','SSL')
Connecting
to Node Manager ...
Successfully
connected to Node Manager.
wls:/nm/TestDomain>
The next script
demonstrates starting the administration server using the nmStart command.
This command must be provided with the name of the server, the domain
directory, and properties.
nmStart([serverName],
[domainDir], [props], [writer], [serverType])
Exp:-
wls:/nm/TestDomain>nmStart('AdminServer')
starting
server AdminServer
Server
AdminServer started successfully
wls:/nm/TestDomain>
Monitor the
status of the server using the NodeManager by entering the nmServerStatuscommand:
wls:/nm/TestDomain>nmServerStatus('AdminServer')
RUNNING
wls:/nm/TestDomain>
Example for
starting the NodeManager and then the AdminServer with the NodeManager:
print
'Start the NodeManager';
startNodeManager(verbose='false',NodeManagerHome='/opt/wls/nodemanager/xyz',
ListenPort='5556');
print 'Wait for
a short time to allow the nodemanager to start ...'
print 'Connect
to the Node Manager';
nmConnect(<user>,<password>,
'localhost', '5556', <domainName>, <domainLocation>, 'plain');
print
'Start the AdminServer using the NodeManager';
nmStart('AdminServer');
print 'Again
wait for a short while to allow the AdminServer to start ...'
print
'Connect to the AdminServer';
connect(<user>,
<password>, <url>);
It is better and much more secure to use
the secret key files as there is no need to provide user and password in the
readable script. This is also available for the NodeManager:
nmConnect([userConfigFile,
userKeyFile], [host], [port], [domainName], [domainDir], [nmType])
Exp;-
print
'Start the NodeManager';
startNodeManager(verbose='false',NodeManagerHome='/opt/wls/nodemanager/xyz',
ListenPort='5556');
print
'Wait for a short time to allow the nodemanager to start ...'
print
'Connect to the Node Manager';
nmConnect(userConfigFile='/opt/domainaccess/testNM/user',
userKeyFile='/opt/domainaccess/testNM/key','localhost','5556',<domainName>,
<domainLocation>, 'plain');
print
'Start the AdminServer using the NodeManager';
nmStart('AdminServer');
print
'Again wait for a short while to allow the AdminServer to start ...'
print
'Connect to the AdminServer';
connect(userConfigFile='/opt/domainaccess/testDomain/user',
userKeyFile='/opt/domainaccess/testDomain/key', <url>);
Using WLST without NodeManager
Using the
WLST startServer command,
the administration server can be started without using a NodeManager. The
server runs in a separate process from WLST, which means that exiting WLST does
not shutdown the server.
startServer([adminServerName],
[domainName], [url], [username], [password],[domainDir], [block], [timeout],
[serverLog], [systemProperties], [jvmArgs])
Exp:-
wls:/offline> startServer('AdminServer','TestDomain','t3://myTestServer:12345',
'admin','<pw>5','/application/domains/TestDomain','false',60000,jvmArgs='-XX:MaxPermSize=125m,
-Xmx512m, -XX:+UseParallelGC')
wls:/offline>
WLST Managed-Server
Similar
to the AdminServer, WebLogic also offers different ways to start
managed-servers. However, these differ from the possible ways to start an
administration server. The big difference is that the administration
server is already running and can be used (and will be used) to start the
managed-servers.
Using the
start script
Similar
to the admin server, WebLogic creates a startscript in the bin folder of the
domain during domain creation. This can be used to start the different
managed-servers by calling the script with the managed-server?s name. This
script is called startManagedWebLogic.sh.
Using the
NodeManager
If the
domain is enrolled with the NodeManager and the server start attributes are
configured correctly, then WLST can communicate with the NodeManager and start
the server based on the configuration.
start('Test_Domain_MS1','Server')
This
requires that the NodeManager on the target machine is started, the domain is
enrolled, and the server start attributes are configured.
The
managed-server can also be started using the AdminServer and the ServerLifeCycleRuntimeof
the managed-server. This also requires that the NodeManager responsible for
this managed-server is started.
connect('weblogic','xxxxx','t3://localhost:12345')
domainRuntime()
wls:/Test_Domain/domainRuntime>
cd ('/ServerLifeCycleRuntimes/Test_Domain_MS1')
cmo.start()
On November 22, 2014 by Kamlesh No comments
How to create WebLogic Domain
using Domain template:
1. Open an existing domain
template (assuming WebLogic Server is installed at c:/bea/ wlserver_10.3).
In this example, we open the Basic WebLogic Server Domain template.
wls:/offline/base_domain>
2. Configure
the domain.
cd('/')
create('myJmsSystemResource', 'JMSSystemResource')
cd('JMSSystemResource/myJmsSystemResource/JmsResource/NO_NAME_0')
e.Create a JMS queue and its
subdeployment.
myq=create('myQueue','Queue')
myq.setJNDIName('jms/myqueue')
myq.setSubDeploymentName('myQueueSubDeployment')
cd('/')
cd('JMSSystemResource/myJmsSystemResource')
create('myQueueSubDeployment',
'SubDeployment')
cd('/')
create('myDataSource', 'JDBCSystemResource')
cd('JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDriverParams','JDBCDriverParams')
cd('JDBCDriverParams/NO_NAME_0')
set('DriverName','com.pointbase.jdbc.jdbcUniversalDriver')
set('URL','jdbc:pointbase:server://localhost/demo')
set('PasswordEncrypted',
'PBPUBLIC')
set('UseXADataSourceInterface', 'false')
create('myProps','Properties')
cd('Properties/NO_NAME_0')
create('user', 'Property')
cd('Property/user')
cmo.setValue('PBPUBLIC')
cd('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDataSourceParams','JDBCDataSourceParams')
cd('JDBCDataSourceParams/NO_NAME_0')
set('JNDIName', java.lang.String("myDataSource_jndi"))
cd('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams')
cd('JDBCConnectionPoolParams/NO_NAME_0')
set('TestTableName','SYSTABLES')
cd('/')
assign('JMSServer', 'myJMSServer', 'Target', 'AdminServer')
assign('JMSSystemResource.SubDeployment', 'myJmsSystemResource.myQueueSubDeployment',
'Target', 'myJMSServer')
assign('JDBCSystemResource', 'myDataSource', 'Target', 'AdminServer')
How to create WebLogic Domain
using Domain template:
1. Open an existing domain
template (assuming WebLogic Server is installed at c:/bea/ wlserver_10.3).
In this example, we open the Basic WebLogic Server Domain template.
wls:/offline/base_domain>
2. Configure
the domain.
cd('/')
create('myJmsSystemResource', 'JMSSystemResource')
cd('JMSSystemResource/myJmsSystemResource/JmsResource/NO_NAME_0')
create('myJmsSystemResource', 'JMSSystemResource')
cd('JMSSystemResource/myJmsSystemResource/JmsResource/NO_NAME_0')
e.Create a JMS queue and its
subdeployment.
myq=create('myQueue','Queue')
myq.setJNDIName('jms/myqueue')
myq.setSubDeploymentName('myQueueSubDeployment')
cd('/')
cd('JMSSystemResource/myJmsSystemResource')
create('myQueueSubDeployment',
'SubDeployment')
cd('/')
create('myDataSource', 'JDBCSystemResource')
cd('JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDriverParams','JDBCDriverParams')
cd('JDBCDriverParams/NO_NAME_0')
set('DriverName','com.pointbase.jdbc.jdbcUniversalDriver')
set('URL','jdbc:pointbase:server://localhost/demo')
create('myDataSource', 'JDBCSystemResource')
cd('JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDriverParams','JDBCDriverParams')
cd('JDBCDriverParams/NO_NAME_0')
set('DriverName','com.pointbase.jdbc.jdbcUniversalDriver')
set('URL','jdbc:pointbase:server://localhost/demo')
set('PasswordEncrypted',
'PBPUBLIC')
set('UseXADataSourceInterface', 'false')
create('myProps','Properties')
cd('Properties/NO_NAME_0')
create('user', 'Property')
cd('Property/user')
cmo.setValue('PBPUBLIC')
cd('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDataSourceParams','JDBCDataSourceParams')
cd('JDBCDataSourceParams/NO_NAME_0')
set('JNDIName', java.lang.String("myDataSource_jndi"))
cd('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams')
cd('JDBCConnectionPoolParams/NO_NAME_0')
set('TestTableName','SYSTABLES')
set('UseXADataSourceInterface', 'false')
create('myProps','Properties')
cd('Properties/NO_NAME_0')
create('user', 'Property')
cd('Property/user')
cmo.setValue('PBPUBLIC')
cd('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcDataSourceParams','JDBCDataSourceParams')
cd('JDBCDataSourceParams/NO_NAME_0')
set('JNDIName', java.lang.String("myDataSource_jndi"))
cd('/JDBCSystemResource/myDataSource/JdbcResource/myDataSource')
create('myJdbcConnectionPoolParams','JDBCConnectionPoolParams')
cd('JDBCConnectionPoolParams/NO_NAME_0')
set('TestTableName','SYSTABLES')
cd('/')
assign('JMSServer', 'myJMSServer', 'Target', 'AdminServer')
assign('JMSSystemResource.SubDeployment', 'myJmsSystemResource.myQueueSubDeployment', 'Target', 'myJMSServer')
assign('JDBCSystemResource', 'myDataSource', 'Target', 'AdminServer')
assign('JMSServer', 'myJMSServer', 'Target', 'AdminServer')
assign('JMSSystemResource.SubDeployment', 'myJmsSystemResource.myQueueSubDeployment', 'Target', 'myJMSServer')
assign('JDBCSystemResource', 'myDataSource', 'Target', 'AdminServer')
On November 22, 2014 by Kamlesh No comments
Basic
concepts of WLST.
What is WLST?
It is a scripting tool offered by Weblogic.
Any way WLST is not only for a sense of control, it’s very
powerful and handy for troubleshooting, doing same thing repeatedly.
IBM’s
Websphere –> wsadmin
Oracle
Weblogic –> WLST
Please don’t get intimated by name. It’s very simple tool.
Few commands are there which are used mostly. We will discuss them.
We can use WLST in two modes
1. Online mode
–Online means, when we use WLST to connect to Admin or Managed
servers which are ACTIVE, online.
— Here, we can do all the domain configuration management activity that we can
do from Admin console
— we can change the domain configuration
2. Offline mode
— Offline means, when we are not connected to any ACTIVE server.
— Here we can create domain, create domain template, extend domain.
— We can connect to Node Manager and start/stop Managed servers or in fact
Admin server also.
Note: Without Node manager, we cannot start/stop Managed servers through WLST.
— Can’t view performance data in offline mode.
Why is it important to know about Online/Offline mode?
Because we should know what we can do and what we cannot. It’s
very simple.
When you
know about WLST commands, Just remember this
Node manager helps to start/stop servers. WLST
acts as an interface to Node manager in offline mode.
So,
How do we start (invoke) WLST?
wlst.sh/wlst.cmd is the
script which starts WLST. We will use below.
(In Linux)
$ .
.$DOMAIN_HOME/bin/SetDomainEnv.sh <——– To
set the environment.
$ .
.$MW_HOME/wlserver_10.3/common/bin/wlst.sh <— MW_HOME is Middleware home
(In
Window)
c:/DOMAIN_HOME/bin/SetDomainEnv.cmd
<——– To set the environment.
C:/MW_HOME/wlserver_10.3/common/bin/wlst.cmd <— MW_HOME is Middleware home
<WL_HOME>/common/bin/wlst.cmd
myscript.py
Example:
C:/Oracle/Middleware/wlserver_10.3/common/bin/wlst.cmd myscript.py
Initializing Weblogic Scripting Tool (WLST) …
Welcome to Weblogic server Administration Scripting Shell
Type help() for help on available commands
wls:/offline>
As you sees, by default, it connects in offline mode. To
issue any online command, first we need to “connect” to some
ACTIVE server instance.
syntax –>
wls:/offline>connect (‘username’,’password’,’url:port’)
wls:/offline>connect
(‘weblogic’,’weblogic1′,’t3://testserver.com:7001′)
Successfully connected to Admin Server ‘Testadmin’ that belongs to domain
‘testdomain’
wls:/testdomain/serverconfig>
To disconnect from a server
wls:/testdomain/serverconfig>disconnect
()
To exist from WLST
wls:/testdomain/serverconfig>exit
()
We can
invoke WLST by using following command also
$
$DOMAIN_HOME/java weblogic.WLST
Initializing Weblogic Scripting Tool (WLST) …
Welcome to Weblogic server Administration Scripting Shell
Type help() for help on available commands
wls:/offline>
— Here, we can do all the domain configuration management activity that we can do from Admin console
— we can change the domain configuration
— Here we can create domain, create domain template, extend domain.
— We can connect to Node Manager and start/stop Managed servers or in fact Admin server also.
Note: Without Node manager, we cannot start/stop Managed servers through WLST.
Node manager helps to start/stop servers. WLST acts as an interface to Node manager in offline mode.
Welcome to Weblogic server Administration Scripting Shell
Type help() for help on available commands
wls:/offline>
Successfully connected to Admin Server ‘Testadmin’ that belongs to domain ‘testdomain’
wls:/testdomain/serverconfig>
Initializing Weblogic Scripting Tool (WLST) …
Welcome to Weblogic server Administration Scripting Shell
Type help() for help on available commands
wls:/offline>
Thursday, October 23, 2014
Subscribe to:
Posts (Atom)
Search
AdSense
Recent Posts
Popular Posts
-
WLST Script for checking the health status of Weblogic Domain (Admin/Managed node) After long time writing something about WLST WLST...
-
WLST Script for checking the status of JDBC Datasource in Weblogic WLST has some good features like we can monitor the weblogic dom...
-
WLST Script for Monitoring the JMS status of Weblogic Domain After long time writing something about WLST WLST has some good feature...
-
WLST Server Start The server of a WebLogic domain can be started using different techniques. The best setup depends on the technical re...
-
How to Deploy Application using WLST We can use WLST to quickly deploy an Application in a Weblogic Server. Requirement:- · The ...
-
How to create WebLogic Domain using Domain template: 1. Open an existing domain template (assuming WebLogic Server is installed at c:...
-
Basic concepts of WLST. What is WLST? It is a scripting tool offered by Weblogic. Any way WLST is not only for a sense of control,...
-
Hi All, writing something about OPMN utility with oracle instance and Weblogic. WebLogic Server – Weblogic is J2EE application ...
-
Hadoop Distributed Filesystem (HDFS) Built to support high throughput, streaming reads and writes of extremely large files. NAS ...
-
Before diving into this implementation, I would suggest you to look at Spring Security Introduction first. Let's Start Most of the We...
Recent Posts
Sample Text
Blog Archive
-
▼
2019
(13)
-
▼
April
(13)
- Spring MVC vs Spring Boot
- Spring Security With Spring Boot Example
- What is Spring Security?
- Adding your own implementation in JPA
- Crud Operations using Spring Data JPA
- What is Spring Boot JPA?
- YAML and Application.Properties Configuration in S...
- How Controller works in Spring Boot?
- What is Annotation?
- Setting up Spring Boot
- Why Spring Boot?
- What is Spring Boot?
- Spring Boot Tutorials
-
▼
April
(13)
Total Pageviews
Find Us On Facebook
Powered by Blogger.