Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

Strategies for WebLogic Domain Configuration

Manual and templating options, Part 1

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.
  • More Stories By 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.

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


    IoT & Smart Cities Stories
    Headquartered in Plainsboro, NJ, Synametrics Technologies has provided IT professionals and computer systems developers since 1997. Based on the success of their initial product offerings (WinSQL and DeltaCopy), the company continues to create and hone innovative products that help its customers get more from their computer applications, databases and infrastructure. To date, over one million users around the world have chosen Synametrics solutions to help power their accelerated business or per...
    Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
    @DevOpsSummit at Cloud Expo, taking place November 12-13 in New York City, NY, is co-located with 22nd international CloudEXPO | first international DXWorldEXPO and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time t...
    When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...
    SYS-CON Events announced today that IoT Global Network has been named “Media Sponsor” of SYS-CON's @ThingsExpo, which will take place on June 6–8, 2017, at the Javits Center in New York City, NY. The IoT Global Network is a platform where you can connect with industry experts and network across the IoT community to build the successful IoT business of the future.
    IoT is rapidly becoming mainstream as more and more investments are made into the platforms and technology. As this movement continues to expand and gain momentum it creates a massive wall of noise that can be difficult to sift through. Unfortunately, this inevitably makes IoT less approachable for people to get started with and can hamper efforts to integrate this key technology into your own portfolio. There are so many connected products already in place today with many hundreds more on the h...
    The best way to leverage your Cloud Expo presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering Cloud Expo and @ThingsExpo will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at Cloud Expo. Product announcements during our show provide your company with the most reach through our targeted audiences.
    CloudEXPO New York 2018, colocated with DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
    Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
    Disruption, Innovation, Artificial Intelligence and Machine Learning, Leadership and Management hear these words all day every day... lofty goals but how do we make it real? Add to that, that simply put, people don't like change. But what if we could implement and utilize these enterprise tools in a fast and "Non-Disruptive" way, enabling us to glean insights about our business, identify and reduce exposure, risk and liability, and secure business continuity?