YOUR FEEDBACK
NGASI Releases AppServer Manager 8.1
Dave Jenkins wrote: The remote server management is a welcomed added feature...
SOA World Conference
Virtualization Conference
$200 Savings Expire May 16, 2008... – Register Today!

2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts

SYS-CON.TV
TOP THREE LINKS YOU MUST CLICK ON


Strategies for WebLogic Domain Configuration
Manual and templating options, Part 1

Digg This!

A domain contains configuration information for a BEA WebLogic Server instance. It has configuration information about servers, clusters, and machines. A domain also contains configuration information about resources such as Java DataBase Connectivity (JDBC) connection pools, JDBC data sources, connection factories, and Java Message Service (JMS) queues. In addition, it contains configuration information about the applications deployed to the instance. The domain configuration information is persisted in a config.xml file. In this article, I evaluate various strategies for WebLogic domain configuration.

The config.xml can be directly manipulated (e.g., hand-editing the file). However, most tools evaluated in the article will manipulate the config.xml indirectly. Most tools (e.g., WebLogic Console) manipulate Java Management eXtension (JMX) Management Beans (MBeans). The WebLogic Server instance persists the state of the MBeans in the config.xml file.

Domain Configuration and JMX

The config.xml file contains persistent information about a WebLogic Server instance. When a WebLogic Server instance is started, WebLogic Server reads the config.xml file and deploys the resources and applications. The resources and applications have corresponding JMX MBeans. The server exposes configuration information via these MBeans. There are many different types of MBeans. In this article, I focus on MBeans that correspond to entries in the config.xml file.

When an attribute value of an MBean is changed at runtime, the new value is made persistent by storing it in the config.xml file. For example, when an MBean attribute value is changed in the WebLogic Server Console, the attribute value is also saved in the config.xml file. Thus, the configuration attribute value is available between server restarts since the configuration attribute value is persisted in the config.xml file.

The following section describes different alternatives for domain creation and configuration, and classifies the different options available.

Options, Options, and More Options

Fortunately, many different ways to create and configure a domain are available. The most common way to create a domain is through the Domain Configuration Wizard and the most common way to configure the domain is by using the WebLogic Console. Many other alternatives are possible, including:
  • Using domain configuration wizard
  • Using domain configuration template
  • Using silent scripts
  • Using WLShell scripts
  • Using WLST scripts
  • Using Java code and the JMX Application Programming Interface (API) directly
  • Using a token replacement (e.g., Bedrock)
  • Using weblogic.Admin command
  • Using wlconfig and wldeploy Ant tasks
  • Hand-editing the config.xml file
The following is a way to classify the above options based on the technique utilized for domain configuration:
  • Manual: WebLogic Console, Complete Domain Configuration Wizard
  • Template: Custom token replacement scripts (e.g., using Ant), Bedrock, Complete Template, Extension Template
  • Scripting: Silent, WLShell, WLST, Ant
  • Programmatic using Java
Another way to classify the above options is by whether they ship with the WebLogic platform:
  • Included (and supported): WebLogic Console, Complete Domain Configuration Wizard, Complete Template, Extension Template, Silent Script, Ant
  • Additional: WL Shell, WLST, Custom token replacement scripts, Bedrock
Yet another way to classify these options is by whether they make changes while the server is online or offline. Online changes are made while an instance of the server is running. The online changes are made to JMX MBeans and persisted to config.xml file by the server. Modifying the config.xml directly while the server is running is not recommended!
  • Online: WebLogic Console, ANT, WLST
  • Offline: Complete Domain Configuration Wizard, Complete Template, Extension Template, silent scripts, WLShell, custom token replacement scripts, Bedrock
In order to demonstrate various strategies for domain configuration, you will create a domain and make changes to it.

High-Level Objectives

You will achieve the following objectives using different strategies for domain creation and configuration. Please do not follow these steps right now. I will ask you to create and configure the domain later employing a different strategy each time.
  1. Create a WebLogic Workshop domain
  2. Change the server debug level to info.
  3. Change the server to enable debug to stdout
  4. Configure a JDBC Connection Pool named semJDBCConnectionPool
  5. Configure a JDBC data source named jdbc/semJDBCDataSource with JNDI name jdbc/semJDBCDataSource
  6. Configure a JMS Connection Factory named semJMSConnectionFactory
  7. Configure a JMSJDBCStore named semJMSJDBCStore
  8. Configure a JMSServer named semJMSServer
  9. Configure semJMSServer's store to semJMSJDBCStore
  10. Configure a JMS Queue named PersonQueue with JNDI name jms/PersonQueue
  11. Deploy the sample application: SEMApp Enterprise ARchive (EAR)
  12. Verify the domain configuration by testing the application
For each strategy, certain steps such as domain creation, database configuration, and verifying the configuration are common. The following sections describe these steps.

Domain Creation

Follow these steps to create a WebLogic Workshop domain using the Domain Configuration Wizard. Do not perform these steps right now. I will ask you to perform these steps later when I explain the different strategies in detail.
  1. Launch Domain Configuration Wizard (e.g., on Windows select Start > All Programs > BEA WebLogic Platform > Configuration Wizard)
  2. Select Create a new WebLogic Configuration and click Next
  3. Select Basic WebLogic Workshop Domain and click Next
  4. Select Express and click Next
  5. Specify User name as system
  6. Specify User password and Confirm user password as password and click Next
  7. Select Development Mode and click Next
  8. Specify Configuration Name as something meaningful and click Create
  9. Click Done
Before you can configure the domain, you need to configure the database. The database configuration occurs after the domain is created, but before the domain is configured.

Database Configuration

All the examples use PointBase as the database. Starting an instance of WebLogic Server (of Workshop Domain) also starts PointBase. Set up user, schema, and tables in that instance of PointBase. Do not perform these steps right now. I will ask you to perform these steps later when I explain the different strategies in detail.
  1. Verify that an instance of WebLogic Server is running
  2. Launch PointBase Console (e.g., on Windows select Start > All Programs > BEA WebLogic Platform > Examples > WebLogic Workshop > PointBase Console)
  3. In the Connect to the database dialog specify the following
  4. Verify that the database URL is jdbc:pointbase:server://localhost:9093/workshop
  5. Verify User as WebLogic
  6. Specify Password as WebLogic
  7. Create a new user (e.g., Ctrl + u) named sem with password as sem
  8. Disconnect from the database (DBA Menu and Disconnect from Database)
  9. Connect to database (DBA Menu and Connect to Database or F3) using sem as the User and sem as the Password
  10. Create a schema (e.g., Ctrl + h) named sem
  11. Copy and paste contents of db/sem.sql into Enter SQL Commands window
  12. Select Execute All toolbar item
  13. Verify that sem schema is populated with tables
Once the domain is created, the database is configured, and the domain is configured with resources and the sample application, the set-up needs to be verified.

Verifying the Domain Configuration

To verify that the domain is properly created and configured, run simple JUnit tests. The included source code example contains a sample application as well as an Ant file that runs JUnit tests. Copy sample-build.properties to build.properties and edit the entries in build.properties to suit your environment. The creation of build.properties needs to happen only once. I will ask you to invoke the following command later, once you have created and configured a domain.


ant - v code fact.

If the tests run successfully, then the application is deployed properly and the resources are configured correctly. If there are any exceptions and the tests fail, then the application or the resources are not configured or deployed correctly. Carefully review and analyze the stack traces and proceed to debug the problem.

Once the tests run successfully, shut down the WebLogic Server instance e.g., the domain directory/stopWebLogic.bat or sh). Always shut down the WebLogic Server instance using the script instead of drastic means such as ctrl+c.

Manual Express Configuration

Using the steps described in the Domain Creation section, create a new domain with SEMDomain-Manual-Express as the Configuration Name. Start the WebLogic Server instance and use the steps described in the Database Configuration section to configure the database.

On many different projects, I have successfully done manual configuration using the WebLogic Server Console.

Changing the Logging Level

  1. Make sure WebLogic Server is running
  2. Launch the WebLogic Server Console (e.g., http://localhost:7001/console)
  3. Log into the Console
  4. Select Servers / cgServer
  5. Select Logging tab
  6. Check Debug to Stdout checkbox
  7. Select Stdout Severity Threshold as Info from the drop down list
  8. Select Apply

Configuring the Connection Pool

  1. Make sure WebLogic Server is running.
  2. Launch the WebLogic Server Console (e.g., http://localhost:7001/console)
  3. Log into the Console
  4. Select Services/JDBC/Connection Pools
  5. Select Configure a new JDBC Connection Pool
  6. Select PointBase from the Database Type dropdown list
  7. Select PointBase's Driver (Type 4) Versions: 4.X from Database Driver
  8. Select Continue
  9. Specify Name as semJDBCConnectionPool
  10. Specify Database Name as workshop
  11. Specify Host Name as localhost
  12. Specify Port as 9093
  13. Specify Database User Name as sem
  14. Specify Password as sem
  15. Specify Confirm Password as sem
  16. Select Continue
  17. Test the driver configuration
  18. Create and deploy

Configuring the DataSource

  1. Make sure WebLogic Server is running
  2. Launch the WebLogic Server Console (e.g., http://localhost:7001/console)
  3. Log into the Console
  4. Select Services / JDBC / Data Sources
  5. Select Configure a new JDBC data Source
  6. Specify Name as jdbc/semJDBCDataSource
  7. Specify JNDI Name as jdbc/semJDBCDataSource
  8. Select Emulate Two-Phase Commit for non-XA Driver.
  9. Select Continue
  10. Specify Pool Name as semJDBCConnectionPool
  11. Select Continue
  12. Target the data source by clicking on Create

Configuring the JMS Connection Factory

  1. Make sure WebLogic Server is running
  2. Launch the WebLogic Server Console (e.g., http://localhost:7001/console)
  3. Log into the Console
  4. Select Services / JMS / Connection Factories
  5. Select Configure a new JMS Connection Factory
  6. Specify Name as semJMSConnectionFactory
  7. Specify JNDI Name as jms/semJMSConnectionFactory.
  8. Select Create
  9. Target and deploy on cgServer
  10. Select Configuration tab
  11. Select Transactions sub tab
  12. Select XA Connection Factory Enabled
  13. Select Apply

Configuring the JMS JDBC Store

  1. Make sure WebLogic Server is running
  2. Launch the WebLogic Server Console (e.g., http://localhost:7001/console)
  3. Log into the Console
  4. Select Services / JMS / Stores in the left navigation pane
  5. Select Configure a new JMS JDBC Store
  6. Specify Name as semJMSJDBCStore
  7. Select Connection Pool as semJDBCConnectionPool
  8. Select Create

Configuring the JMS Server

  1. Make sure WebLogic Server is running
  2. Launch the WebLogic Server Console (e.g., http://localhost:7001/console)
  3. Log into the Console
  4. Select Services/JMS/Servers in the left navigation pane
  5. Select Configure a new JMS Server
  6. Specify Name as semJMSServer
  7. Specify Persistence Store as semJMSJDBCStore by selecting it from the dropdown list
  8. Select Create
  9. Target the semJMSServer to the cgServer

Configuring the JMS Queue

  1. Make sure WebLogic Server is running
  2. Launch the WebLogic Server Console (e.g., http://localhost:7001/console)
  3. Log into the Console
  4. Select Services/JMS/Servers/semJMSServer /Destinations in the left navigation pane
  5. Select Configure a new JMS Queue
  6. Specify Name as PersonQueue
  7. Specify JNDI Name as jms/PersonQueue
  8. Select create
  9. Select the Redelivery sub tab
  10. Specify Redelivery Limit as 3
  11. Select Apply
Now you are done configuring the application resources. However, before you can deploy the application, you still need to configure workshop-related resources.

Configuring Workshop-Related Resources

  1. Make sure WebLogic Server is running
  2. Launch the WebLogic Server Console (e.g., http://localhost:7001/console)
  3. Log into the Console
  4. Select Services/JMS/Servers/semJMSServer/ Destinations in the left navigation pane
  5. Select Configure a new JMS Queue
  6. Specify Name as SEMAppWeb.queue.AsyncDispatcher_error.
  7. Specify JNDI Name as SEMAppWeb.queue.AsyncDispatcher_error
  8. Select Create
  9. Select the Redelivery sub tab
  10. Specify Redelivery Limit as 0
  11. Select Apply
  12. Select Services/JMS/Servers/semJMSServer/ Destinations in the left navigation pane
  13. Select Configure a new JMS Queue
  14. Specify Name as SEMAppWeb.queue.AsyncDispatcher
  15. Specify JNDI Name as SEMAppWeb.queue.AsyncDispatcher
  16. Select Create
  17. Select the Redelivery sub tab
  18. Select Error Destination as SEMAppWeb.queue.AsyncDispatcher_error
  19. Select Apply
You are now ready to deploy the application.

Deploying the Application

  1. Make sure WebLogic Server is running
  2. Launch the WebLogic Server Console (e.g., http://localhost:7001/console)
  3. Log into the Console
  4. Select Deployments/Applications in the left navigation pane
  5. Select Deploy a new Application
  6. Browse to the location of the SEMApp.ear file
  7. Select SEMApp.ear
  8. Select Continue
  9. Select Deploy
Once the application is successfully deployed, restart the server. Run the tests as described in the Verifying the Domain Configuration section.

Other manual strategies are possible using the Domain Configuration Wizard. One option is to create and configure a brand new domain by selecting the Custom (instead of the Express) option. When you are prompted to create resources such as JDBC Connection Pools in the wizard, follow the steps to create and deploy the resources. Another option is to configure an already created domain using the Domain Configuration Wizard. In the very first step of the Domain Configuration Wizard, select Extend an existing WebLogic configuration. Creating the domains as described above is left as an exercise for you. However, not all of the configuration is possible using these strategies, such as configuring a destination's Redelivery attribute.

In order to use the manual strategies successfully, a project needs to maintain a configuration guide. The configuration guide contains the step-by-step instructions as described above. However, the manual process is tedious and time consuming. Setting up another domain takes extra time and effort. Moreover, the process is error-prone. Small configuration errors, such as misspelling a JNDI name, can lead to serious troubleshooting and debugging.

Automated options to create and configure a domain are preferred. Java is a powerful language and the MBeans can be directly manipulated with it. However, this approach is too low level. There are alternative approaches such as templating and scripting. In manual templating, the config.xml is templated with tags. The tags are later replaced with actual values. The manual templating approach requires a very deep and thorough understanding of config.xml file. I have used manual templating on some projects. Bedrock is an Ant-based tool that supports such templating. However, Bedrock does not seem to be actively maintained. Another important templating technique is using a domain template. This technique does not require an in-depth knowledge of the config.xml. The creation of templates is nicely supported via the Configuration Template Builder tool. The next section discusses automating domain configuration via templating using the Configuration Template Builder tool.

Domain Template

When you created the domain manually, you used the workshop template. But, what is a template? A template is a Java ARchive (JAR) file that contains configuration information; a relevant snippet of config.xml file. There are two types of templates: complete and extension. With a complete template, a new domain is created using the template. The workshop template used above is an example of a complete template. With an extension template a domain is extended. The DefaultWebApp template used later is an example of an extension template.

How do you create a template? A special tool named Configuration Template Builder helps. A template, either complete or extension, is created in two ways. First, a template is an extension to another extension template. Second, a template is based on an existing domain. In the next section, you will create a complete template based on an existing domain.

Complete Template

In this section, I will illustrate creation of a complete template based on an existing, preconfigured, and working domain. Follow these steps to create a complete template.
  1. Launch Configuration Template Builder (On Windows select Start > All Programs > BEA WebLogic Platform > Other Development Tools > Configuration Template Builder)
  2. Select Create a Configuration Template and click Next
  3. Select Basic WebLogic Workshop Domain and click Next
  4. Select an existing, preconfigured, and working SEM domain (e.g., SEMDomain-Manual-Express) and click Next
  5. Specify Name as SEMTemplate-Complete
  6. Specify Author (e.g., Bart)
  7. Specify Category (e.g., SEM)
  8. Specify Description and click Next
  9. Take the defaults by clicking Next on the subsequent dialogs
  10. In Create Template, specify a name for the template (e.g., SEMTemplate-Complete), observe and remember the location of the template JAR file %BEA_HOME%/user_templates/, Click Create
  11. Click Done
Now, create a new domain based on the complete template. Follow these steps to create a complete domain.

Domain Creation Based on Complete Template

  1. Launch Domain Configuration Wizard (On Windows select Start > All Programs > BEA WebLogic Platform > Configuration Wizard)
  2. Select Create a new WebLogic Configuration and click Next.
  3. Instead of selecting one of the default templates, browse to location of complete template (%BEA_HOME%/user_templates)
  4. Select SEMTemplate-Complete and click Next.
  5. Take the defaults by clicking Next on the subsequent dialogs
  6. Specify Configuration Name as something meaningful (e.g., SEMDomain-Complete) and click Create
  7. Click Done
However, starting a WebLogic Server instance of this domain fails! The encrypted security credentials conflict. Make the following changes manually to the config.xml file.

Changes to config.xml

  1. Change SecurityConfiguration element's Credential attribute's value to ""
  2. Change EmbeddedLDAP element's Credential attribute's value to ""
  3. Change cgPool Password attribute's value to "weblogic"
  4. Change semJDBCConnectionPool Password attribute's value to "sem"
Follow the steps described in Verifying the Domain Configuration to verify that the domain is working properly.

Another important templating strategy is to create an extension template; for example, an extension template that extends DefaultWebApp template and configures all the necessary resources. Creating the extension template, creating a domain, and extending the domain with the extension template are left as an exercise for you.

Conclusion

Domain configuration by hand-editing the config.xml file is error-prone and dangerous. On the other extreme, domain configuration by writing Java code is tedious. Common alternatives include domain configuration by using the WebLogic Console or Domain Configuration Wizard. However, both alternatives are manual and likely to be repetitive and time-consuming. In search of automated solutions, I evaluated templating. Please stay tuned for my next article, which will evaluate scripting strategies. I hope this article helps you make a knowledgeable and informed decision about choosing tools and techniques for automating domain configuration.

References

  • To discuss the article and ask questions start here: www.bartssandbox.com. Free membership is required.
  • About Prakash Malani
    Prakash Malani has extensive experience in architecting, designing, and developing object-oriented software and has done software development in many application domains such as entertainment, retail, medicine, communications, and interactive television.He practices and mentors leading technologies such as J2EE, UML, and XML. Prakash has published various articles in industry- leading publications.

    BEA WEBLOGIC LATEST STORIES
    Microsoft To Keynote 4th International Virtualization Conference & Expo
    Mike Neil is general manager for virtualization strategy in the Windows Server Division at Microsoft. Mike is focused on the delivery of the Windows virtualization technology, including Windows Server 2008 Hyper-V, Microsoft Hyper-V Server and Virtual PC 2007. Mike also directs the tec
    3rd International Virtualization Conference & Expo: Themes & Topics
    From Application Virtualization to Xen, a round-up of the virtualization themes & topics being discussed in NYC June 23-24, 2008 by the world-class speaker faculty at the 3rd International Virtualization Conference & Expo being held by SYS-CON Events in The Roosevelt Hotel, in midtown
    Virtualization Meets DaaS - Desktop-as-a-Service
    After a $1.5 million angel round, Desktone, which was started in 2006 by Eric Pulier, who also started SOA Software, US Interactive and IVT, picked up $17 million in first-round funding about a year ago from Highland Capital Partners, SoftBank Capital, Citrix Systems and the China-base
    Engelbart's Usability Dilemma: Efficiency vs Ease-of-Use
    The mouse was the original idea of Doug Engelbart who was the head of the Augmentation Research Center (ARC) at Stanford Research Institute. Engelbart's philosophy is best embodied, in my opinion, in the design of another device that he invented, the five-finger keyboard - with keys li
    Web 2.0 Is Fundamentally About Empowering People
    'Unlocking content to be remixed into new business value' is the driver of Web 2.0 in the enterprise, says Rod Smith, IBM VP of Emerging Internet Technologies, in this Exclusive Q&A with Jeremy Geelan on the occasion of IBM's release of a new technology created by IBM researchers, code
    Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
    Here is a question that I have been pondering on and off for quite a while: Why do 'cool kids' choose Ruby or PHP to build websites instead of Java? I have to admit that I do not have an answer. Why do I even care? Because I am a Java developer. Like many Java developers, I get along w
    SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
    SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
    Click to Add our RSS Feeds to the Service of Your Choice:
    Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
    myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
    Publish Your Article! Please send it to editorial(at)sys-con.com!

    Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

    SYS-CON FEATURED WHITEPAPERS

    MOST READ THIS WEEK
    ADS BY GOOGLE
    BREAKING NEWS FROM THE WIRES
    AmberPoint Extends SOA Governance to Apache ServiceMix, BEA AquaLogic Service Bus 3.0, BEA WebLogic Integration, Cisco ACE XML Gateway, JBoss Enterprise Application Platform and Oracle Fusion
    AmberPoint announced today that it has extended the reach of its runtime SOA governance