Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Application Server  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Administrative Tasks Using the weblogic.Admin Command-Line Utility
sams



发贴: 0
积分: 0
于 2003-03-27 10:53 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Administrative Tasks Using the weblogic.Admin Command-Line Utility
By Kumar Allamraju

WebLogic Server (WLS) provides several ways to configure servers, clusters, machines, JDBC connection pools, JMS servers, and so on, using the following:

* Domain Configuration wizard: GUI tool
* Admin console: Browser-based GUI interface
* Programmatic JMX API interface
* weblogic.Admin command-line utility

The command-line interface comes in handy if you want to integrate this tool into Perl or Ant scripts for administration and management efficiency, if you can't access the Admin console through a browser, or if you prefer using command-line tools over a GUI interface.

In this section we'll focus on doing admin tasks using the weblogic.Admin command-line utility. I've assumed that you're using WLS 7.0, although the same syntax should work fine in the 6.x release.

Before invoking the weblogic.Admin utility, set the WLS development environment. In Windows it's setWLSEnv.cmd; in Unix platforms it's setWLSEnv.sh. These files are located under $WL_HOME/user_projects/your-domain folder.Let's try some basic MBean commands using WebLogic. Admin utility.

1. To create a server named "WLDJServer", use the following example:

java weblogic.Admin -url {admin-serverl url} -username {admin-user}
-password
{admin-password} CREATE -mbean {object_name}

where object_name is in the form of

"domain-name:Name={server name}:Name,Type={type ofMbean}"

Example:

java weblogic. Admin -url {admin-serverl url} -username {admin-user}
-password
{admin-password} CREATE -mbean "WLDJDomain: Name=WLDJServer, Type=Server"

where "WLDJDomain" is your domain name. After executing the above command, write the entries shown in Listing 1 into config.xml.

Listing 1

<Server Name="WLDJServer">
<COM Name="WLDJServer"/>
<IIOP Name="WLDJServer"/>
<JTAMigratableTarget Cluster="" Name="WLDJServer" UserPreferredServer=
"WLDJServer"/>
<KernelDebug Name="WLDJServer"/>
<Log Name="WLDJServer"/>
<SSL Name="WLDJServer"/>
<ServerDebug Name="WLDJServer"/>
<ServerStart Name="WLDJServer"/>
<WebServer Name="WLDJServer"/>
</Server>

2. To create a cluster named "WLDJCluster", use the following example:

java weblogic. Admin -url {admin-serverl url} -username {admin-user}
-password
{admin-password} CREATE -mbean {object_name}

where object_name is in the form of

"domain-name:Name={cluster name}:Name,Type={type of Mbean}"

Example:

java weblogic.Admin -url {admin-serverl url} -username {admin-user}
-password
{admin-password} CREATE -mbean WLDJDomain:Name=WLDJluster,Type=Cluster"

After executing the above command, write the following into config.xml:

<Cluster Name="WLDJCluster"/>

3. To set/change the configuration attributes of this Mbean, use the weblogic.Admin SET option:

java weblogic.Admin -url {admin-serverl url} -username {admin user}
-password
{admin password} SET -mbean "{object_name}" -property {property_name}
{property_value}

where property_name can be one of the Mbean attributes, such as MulticastAddress, ClusterAddress, and InterfaceAddress, and so on.

Example:

java weblogic. Admin -url {admin-server url} -username {admin user}
-password
{admin password} SET -mbean "mydomain:Name=WLDJCluster,Type=Cluster"
-property "MulticastAddress" "224.0.0.1"

After executing the above command, write the following entries into config.xml:

<Cluster MulticastAddress="224.0.0.1" Name="WLDJCluster"/>

4. To assign the managed server created in step 1 to a cluster, use weblogic.Admin SET:

java weblogic. Admin -url {admin-serverl url} -username {admin user}
-password
{admin password} SET -mbean "{object_name}" -property {property_name}
{property_value}

Example:

java weblogic. Admin -url {admin-server url} -username {admin-user}
-password
{admin-password} SET -mbean "mydomain:Name=WLDJServer,Type=Server"
-property Cluster "WLDJDomain:Name=WLDJCluster,Type=Cluster"

The above command will update the config.xml with the following entries:

<Server Cluster="WLDJCluster" Name="WLDJServer">
</Server>

5. To view configuration attributes of a particular Mbean, use weblogic.Admin GET:

java weblogic.Admin -url {admin-server url} -username {admin-user}
-password
{admin-password} -pretty GET -type {Config Mbean}

where ConfigMBean could be ServerConfig, ExecuteQueueConfig, DomainConfig, and so on.

Example:

java weblogic.Admin -url {admin-server url} -username {admin-user}
-password
{admin-password} -pretty GET -type ServerConfig.

6. To view runtime statistics of a particular Mbean, use weblogic.Admin GET:

java weblogic.Admin -url {admin-server url} -username {admin-user}
-password
{admin-password} -pretty GET -type {ConfigMbean}

where ConfigMBean could be ServerConfig, ExecuteQueueConfig, DomainConfig, and so on.

Example:

java weblogic. Admin -url {admin-server url} -username {admin-user}
-password
{admin-password} -pretty GET -type ServerRuntime.

7. To create a connection pool, use weblogic.Admin CREATE_POOL:

java weblogic. Admin -url {admin-server url} -username {admin-user}
-password
{admin-password} -pretty CREATE_POOL {pool_string}

Example:

java weblogic. Admin -url {admin-server url} -username {admin-user}
-password
{admin-password} -pretty CREATE_POOL WLDJ817ThinPool
"url=jdbc:oracle:thin:
@baybridge:1521:bay817,driver=oracle.jdbc.driver.OracleDriver,
initialCapacity=1,maxCapacity=1,
props=user=SCOTT;password=tiger;"

Summary
The weblogic.Admin utility provides a powerful command-line interface to accomplish administrative tasks that can be done using the WebLogic console. This tool comes in handy for administrators and infrastructure teams who can use it to integrate with Ant or Perl scripts, thereby automating the build process.

References
http://e-docs.bea.com/wls/docs70/ adminguide/cli.html#1146603

About the Author
Kumar Allamraju is a senior developer relations engineer at BEA Systems in the WebLogic server support division. Kumar has five years of experience in object-oriented programming and in J2EE-related technologies.

Copyright © 2002 SYS-CON Media, Inc.




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923