WebLogic Domain Configuration Policy-manual and template options, part 1

Source: Internet
Author: User
The domain contains the configuration information of the BEA Weblogic server instance. It contains configuration information about servers, clusters, and machines. The domain also contains resources, such as Java database connectivity (JDBC), connection pool, JDBC data source, connection factory, and Java Message Service (JMS) queue and other configuration information. In addition, the domain contains configuration information about the applications deployed on the instance. The domain configuration information is saved in the config. xml file. In this article, I will evaluate various WebLogic domain configuration policies.

You can directly manipulate the config. xml file (for example, manually edit the file ). However, most of the tools evaluated in this article will indirectly manipulate config. xml. Most tools (such as WebLogic console) process Java Management Extensions (JMX) Management beans (mbeans ). The Weblogic server instance saves the mbean status in the config. xml file.

Domain Configuration and JMX
The config. xml file contains the persistence information about the Weblogic server instance. When the Weblogic server instance is started, the WebLogic Server reads the config. xml file and deploys resources and applications. Resources and applications have corresponding mbeans. The server uses these mbeans to access configuration information. There are many different types of mbeans. In this article, I mainly discuss the mbean corresponding to the entry in the config. xml file.
If the mbean attribute value is changed at runtime, the new value will be saved in the config. xml file to make it a persistent value. For example, if you modify the mbean property value in the Weblogic server console, the property value will also be saved in the config. xml file. Therefore, you can use the configuration property value during server restart because the configuration property value is permanently saved in the config. xml file.
The following describes how to create and configure a domain and classify different available options.
Numerous options
Fortunately, you can use many different methods to create and configure domains. The most common method to create a domain is to use Domain Configuration Wizard (Domain Configuration Wizard), and the most common method to configure a domain is to use the Weblogic console. There are many other available methods, including:

 

  • Use Domain Configuration Wizard
  • Use domain configuration templates
  • Use a silent script
  • Use wlshell scripts
  • Use wlst script
  • Use Java coding and JMX Application Programming APIs directly)
  • Use the mark substitution method (for example, Bedrock)
  • Use WebLogic administrator commands
  • Use wlconfig and wldeploy ant tasks
  • Manually edit the config. xml file

The following is a way to classify the above options based on the technology used in the configuration domain:

  • Manual: Weblogic console, complete Domain Configuration Wizard
  • Template: Custom symbol substitution script (for example, ant), bedrock, full template, and extended template
  • Script: silent, wlshell, wlst, ant
  • Java programming

Another way to classify the above options is to determine whether they are released along with the Weblogic Platform:

  • Including (and supported): Weblogic console, full Domain Configuration Wizard, full template, extended template, silent script, ant
  • Others: WL shell, wlst, custom symbol substitution script, Bedrock

Another way to classify the above options is to determine whether to modify the options when the server is online or offline. When the server instance is running, modify it online. The JMX mbean is modified online by the server and saved in the config. xml file. When the server is running, we recommend that you do not directly modify the config. xml file.

  • Online: Weblogic console, ant, wlst
  • Offline: Full Domain Configuration Wizard, full template, extended template, silent script, wlshell, custom symbol substitution script, Bedrock

To illustrate various domain configuration policies, you will create a domain and modify it.

Advanced Objectives
Using different domain creation and configuration policies, you will achieve the following goals: do not follow these steps immediately. Later, I will ask you to create and configure domains each time using different policies:

  1. Create a WebLogic Workshop domain
  2. Change the server debugging level to information level
  3. Change the server to enable debugging of standard output (stdout)
  4. Configure a JDBC connection pool named semjdbcconnectionpool
  5. Configure a JDBC data source named JDBC/semjdbcdatasource whose JNDI name is JDBC/semjdbcdatasource
  6. Configure a JMS connection factory named semjmsconnectionfactory
  7. Configure a jmsjdbcstore named semjmsjdbcstore
  8. Configure a jmsserver named semjmsserver
  9. Configure a semjmsserve repository named semjmsjdbcstore
  10. Configure a JMS queue named personqueue, whose JNDI name is JMS/personqueue
  11. Deploy the sample application: semapp enterprise archive (EAR)
  12. Test the application and verify the domain configuration.

For each policy, some steps, such as domain creation, database configuration, and validation configuration, are common. The following sections describe these steps.

Domain creation
Use Domain Configuration Wizard to create a WebLogic Workshop domain following these steps. Do not perform these steps immediately. Later, when I explain different strategies in detail, I will ask you to perform these steps:

  1. Start Domain Configuration Wizard (for example, on Windows, choose 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, set confirm user password to password, and click Next
  7. Select the Development Mode and click Next.
  8. Specify the configuration name as a meaningful name and click Create
  9. Click Done

You need to configure the database before you can configure the domain. The Database Configuration occurs after the domain is created and before the domain is configured.

Database Configuration
All examples Use pointbase as the database. The instance that starts WebLogic Server (workshop domain) also starts pointbase. Create a user, schema, and table in a pointbase instance. Do not perform these steps immediately. Later, when I explain different strategies in detail, I will ask you to perform these steps:

  1. Verify that an instance of Weblogic server is running
  2. Start the pointbase Console (for example, on Windows, choose Start> All Programs> BEA Weblogic Platform> examples> WebLogic Workshop> pointbase console)
  3. In the connect to the database dialog box, specify the following items
  4. The URL for verifying the database is JDBC: pointbase: SERVER: // localhost: 9093/Workshop
  5. Verify that the user is WebLogic
  6. Password: Weblogic
  7. Create a new user (for example, CTRL + U). The user name is SEM, and the password is also SEM.
  8. Disconnect from the database (DBA menu and disconnect from database)
  9. Use SEM as user and SEM as password to connect to the database (DBA menu and connect to database or F3)
  10. Create a mode (for example, CTRL + H) and name it SEM
  11. Copy and paste the DB/SEM. SQL content to the enter SQL commands window.
  12. Select the execute all toolbar entry
  13. Verify that the SEM mode has been used for Table Production

Once a domain is created, you need to configure the database and configure the domain with resources and sample applications. You need to verify the setting process.

Verify Domain Configuration
To verify that the created and configured domain is correct, run the simple JUnit test program. The source code example contains a sample application and an ant file that runs the JUnit test. Copy the sample-build.properties to build. properties and edit the entries in build. properties to suit your environment. Build. properties only needs to be created once. Once you create and configure a domain, I will ask you to call the following command:

Ant-v code fact.

If the test program runs successfully, the application is correctly deployed and the resources are correctly configured. If any exceptions occur and the test fails, the application or resources are not configured or the deployment is incorrect. Carefully check and analyze stack tracking and debug problems.

Once the test program runs successfully, shut down the Weblogic server instance (for example, the domain directory/stopweblogic. bat or sh ). The WebLogic Server is always disabled using scripts rather than intense means (such as Ctrl + C.

Manual quick (Express) Configuration
Use the steps described in the create a Domain Section and use semdomain-manual-express as the configuration name to create a new domain. Start the Weblogic server instance and use the steps described in the Database Configuration section to configure the database.
In many different projects, I have successfully completed manual configuration multiple times using the Weblogic server console.

Change log record level

  1. Confirm Weblogic server is running
  2. Start Weblogic server console (for example, http: // localhost: 7001/console)
  3. Log on to the console
  4. Select servers/cgserver
  5. Select the logging Tab
  6. Check the debug to stdout check box
  7. From the drop-down list, select stdout severity threshold as info
  8. Select Apply

Configure the connection pool

  1. Confirm Weblogic server is running
  2. Start the Weblogic server console (for example, http: // localhost: 7001/console)
  3. Log on to the console
  4. Select Services/jdbc/connection pools
  5. Select configure a new JDBC connection pool
  6. Select pointbase from the Database Type drop-down list
  7. From the database driver, select pointbase's driver (Type 4) versions: 4.x
  8. Select continue
  9. Specify name as semjdbcconnectionpool
  10. Specify the database name as workshop
  11. Specify the host name as localhost
  12. Port 9093
  13. Specify the database user name as SEM
  14. Specify password as SEM
  15. Specify Confirm Password as SEM
  16. Select continue
  17. Test driver Configuration
  18. Create and deploy

Configure data sources

  1. Confirm Weblogic server is running
  2. Start the Weblogic server console (for example, http: // localhost: 7001/console)
  3. Log on to the console
  4. Select Services/jdbc/Data sources
  5. Select configure a new JDBC Data Source
  6. Specify JDBC/semjdbcdatasource as the name
  7. Specify the JNDI name as JDBC/semjdbcdatasource
  8. Select emulate two-phase commit for non-XA driver
  9. Select continue
  10. Specify the pool name as semjdbcconnectionpool
  11. Select continue
  12. Click Create to determine the data source target.

Configure the JMS connection Factory

  1. Confirm Weblogic server is running
  2. Start the Weblogic server console (for example, http: // localhost: 7001/console)
  3. Log on to the console
  4. Select Services/JMS/connection factories
  5. Select configure a new JMS connection Factory
  6. Specify name as semjmsconnectionfactory
  7. Set the JNDI name to JMS/semjmsconnectionfactory.
  8. Select create
  9. As the target and deployed on cgserver
  10. Select Configuration tab
  11. Select the transactions subtab
  12. Select XA connection factory Enabled
  13. Select Apply

Configure the jms jdbc Library

  1. Confirm Weblogic server is running
  2. Start the Weblogic server console (for example, http: // localhost: 7001/console)
  3. Log on to the console
  4. In the left-side Navigation Pane, select Services/JMS/stores.
  5. Select configure a new jms jdbc store
  6. Specify name as semjmsjdbcstore
  7. Set connection pool to semjdbcconnectionpool.
  8. Select create

Configure the JMS Server

  1. Confirm Weblogic server is running
  2. Start the Weblogic server console (for example, http: // localhost: 7001/console)
  3. Log on to the console
  4. In the left-side Navigation Pane, select Services/JMS/Stores
  5. Select configure a new JMS Server
  6. Specify name as semjmsserver
  7. Select from the drop-down list and set persistence store to semjmsjdbcstore.
  8. Select create
  9. Set the target semjmsserver to cgserver

Configure a JMS queue

  1. Confirm Weblogic server is running
  2. Start the Weblogic server console (for example, http: // localhost: 7001/console)
  3. Log on to the console
  4. In the left-side Navigation Pane, select Services/JMS/servers/semjmsserver/destinations
  5. Select configure a new JMS queue
  6. Set Name To personqueue
  7. Set the JNDI name to JMS/personqueue.
  8. Select create
  9. Select redelivery subtab
  10. Specify redelivery limit to 3
  11. Select Apply

Now you have configured application resources. However, you still need to configure the resources related to the workshop before deploying the application.

Configure resources related to workshop

  1. Confirm Weblogic server is running
  2. Start the Weblogic server console (for example, http: // localhost: 7001/console)
  3. Log on to the console
  4. In the left-side Navigation Pane, select Services/JMS/servers/semjmsserver/destinations
  5. Select configure a new JMS queue
  6. Specify name as semappweb. queue. asyncdispatcher_error
  7. Specify the JNDI name as semappweb. queue. asyncdispatcher_error
  8. Select create
  9. Select redelivery subtab
  10. Specify redelivery limit to 0
  11. Select Apply
  12. In the left-side Navigation Pane, select Services/JMS/servers/semjmsserver/destinations
  13. Select configure a new JMS queue
  14. Specify name as semappweb. queue. asyncdispatcher
  15. Specify the JNDI name as semappweb. queue. asyncdispatcher.
  16. Select create
  17. Select redelivery subtab
  18. Set error destination to semappweb. queue. asyncdispatcher_error.
  19. Select Apply

Now you are ready to deploy the application.

Deploy applications

  1. Confirm Weblogic server is running
  2. Start the Weblogic server console (for example, http: // localhost: 7001/console)
  3. Log on to the console
  4. In the left-side Navigation Pane, select deployments/applications.
  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 test program as described in the verification domain configuration section.
There are also other manual policies that use Domain Configuration Wizard. One choice is to create and configure a brand new domain by selecting the custom option (instead of express. When the wizard prompts you to create resources, such as JDBC connection pools, follow the steps for creating and deploying resources. Another option is to use Domain Configuration Wizard to configure a created domain. In step 1st of Domain Configuration Wizard, select extend an existing WebLogic configuration. Create the above domain and leave it as an exercise. However, using these policies may not be able to complete all configurations, such as the redelivery attribute configuration of the destination.
To successfully use the manual policy, you need to save a Configuration Guide for the project. This Configuration Guide contains the step-by-step instructions described above. However, manual configuration is tedious and time-consuming. Setting another domain requires additional time and effort. More importantly, this process is prone to errors. Minor configuration errors, such as the spelling of the JNDI name, can cause a lot of troubleshooting and debugging work.
The options for automatic domain creation and configuration should be the first choice. Java is a powerful language that allows you to directly manipulate mbeans using Java. However, this method is a low-level method. There are other options, such as templates and scripts. In the manual template, use the tag to template config. xml. Replace the tag with the actual value later. The manual template method requires a thorough understanding of the config. xml file. In some projects, I have used manual templates. Bedrock is an ant-based tool that supports such templates. However, Bedrock does not seem to be effectively maintained. Another important template technology is the use of domain templates. This technology does not require a deep understanding of config. xml. Template creation is well supported by the template creation tool. The next section describes how to use the template creation tool to automatically configure domains using the template.

Domain Template
When you manually create a domain, you use the workshop template. But what is a template? The template is a Java archive (jar) file containing configuration information, and is a part of the config. xml file. There are two types of templates: Full templates and extended templates. You can use a full template to create a new domain. The preceding workshop template is an example of a complete template. The extension template can be used to expand a domain. The defaultwebapp template used later is an example of the extended template.
How to Create a template? There is a special tool called the configuration template builder that can help complete, whether it is a full template or an extended template. There are two methods to create a template. The first method is to expand an extension template. The second method is to create a template based on the existing domain. In the next section, you will create a full template based on the existing domain.

Full Template
In this section, I will illustrate how to create a full template based on an existing pre-configured and working domain. Follow these steps to create a full template:

  1. Start the configuration template Builder (on Windows, choose 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 pre-configured and working SEM domain (for example, semdomain-manual-Express) and click Next
  5. Specify name as semtemplate-complete
  6. Specify author (for example, Bart)
  7. Specify category (for example, SEM)
  8. Specify description and click Next
  9. Click Next in the subsequent dialog box to take the default value.
  10. In create template, specify a name for the template (for example, semtemplate-complete), observe and remember the location of the template JAR file % bea_home %/user_templates/, and click Create
  11. Click Done

Now, create a new domain based on the full template. Follow these steps to create a full domain:

Create a domain based on a full Template

  1. Start the Domain Configuration Wizard (on Windows, choose Start> All Programs> BEA Weblogic Platform> Configuration Wizard)
  2. Select create a new WebLogic configuration and click Next
  3. Browse to the location of the full template (% bea_home %/user_templates), instead of selecting one of the default templates
  4. Select semtemplate-complete and click Next
  5. Click Next in the subsequent dialog box to take the default value.
  6. Specify configuration name as meaningful content (for example, semdomain-complete), and click Create
  7. Click Done

However, starting the Weblogic server instance in this domain fails. The encrypted security credential conflict. Manually modify the config. xml file as follows:

Modify config. xml

  1. Change the value of the Credential attribute of the securityconfiguration element ""
  2. Modify the credential attribute value of the embeddedldap element ""
  3. Change the value of the cgpool Password attribute to "WebLogic"
  4. Change the value of semjdbcconnectionpool password to "SEM"

Verify that the domain works properly by following the steps described in the verification domain configuration section.
Another important template policy is to create an extension template, for example, an extension defawebwebapp template and an extension template that configures all required resources. Create the extension template, create a domain, and extend the domain with the extension template for exercises.

Conclusion
Manual editing of the config. xml file for domain configuration is an error-prone and dangerous method. Another extreme method, however, is tedious to configure domains by writing Java code. You can use the Weblogic console and Domain Configuration Wizard to configure the domain. However, both methods are manual and may be highly repetitive and time-consuming. When I explored an automation solution, I evaluated the template method. Please pay attention to my next article, which will evaluate the script policy. I hope this article will help you to be prepared when selecting tools and technologies that automate domain configuration.

Bibliography
· To discuss this article or ask questions, please start here: www.bartssandbox.com.

About the author
Prakash malani has rich experience in building, designing and developing object-oriented software, and has developed software in many application fields, such as entertainment, retail, medical, communication, and interactive TV. He practiced and guided some advanced technologies, such as J2EE, UML, and XML. Prakash has published various articles on a variety of industry-leading publications.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.