WebLogic domain configuration method

Source: Internet
Author: User

WebLogic domain configuration method

Translation: Unknown
Author: Prakash malani

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:

Create a WebLogic Workshop domain
Change the server debugging level to information level
Change the server to enable debugging of standard output (stdout)
Configure a JDBC connection pool named semjdbcconnectionpool
Configure a JDBC data source named JDBC/semjdbcdatasource whose JNDI name is JDBC/semjdbcdatasource
Configure a JMS connection factory named semjmsconnectionfactory
Configure a jmsjdbcstore named semjmsjdbcstore
Configure a jmsserver named semjmsserver
Configure a semjmsserve repository named semjmsjdbcstore
Configure a JMS queue named personqueue, whose JNDI name is JMS/personqueue
Deploy the sample application: semapp enterprise archive (EAR)
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:

Start Domain Configuration Wizard (for example, on Windows, choose Start> All Programs> BEA Weblogic Platform> Configuration Wizard)
Select create a new WebLogic configuration and click Next
Select basic WebLogic Workshop domain and click Next
Select express and click Next
Specify user name as System
Specify user password, set confirm user password to password, and click Next
Select the Development Mode and click Next.
Specify the configuration name as a meaningful name and click Create
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:

Verify that an instance of Weblogic server is running
Start the pointbase Console (for example, on Windows, choose Start> All Programs> BEA Weblogic Platform> examples> WebLogic Workshop> pointbase console)
In the connect to the database dialog box, specify the following items
The URL for verifying the database is JDBC: pointbase: SERVER: // localhost: 9093/Workshop
Verify that the user is WebLogic
Password: Weblogic
Create a new user (for example, CTRL + U). The user name is SEM, and the password is also SEM.
Disconnect from the database (DBA menu and disconnect from database)
Use SEM as user and SEM as password to connect to the database (DBA menu and connect to database or F3)
Create a mode (for example, CTRL + H) and name it SEM
Copy and paste the DB/SEM. SQL content to the enter SQL commands window.
Select the execute all toolbar entry
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

Confirm Weblogic server is running
Start Weblogic server console (for example, http: // localhost: 7001/console)
Log on to the console
Select servers/cgserver
Select the logging Tab
Check the debug to stdout check box
From the drop-down list, select stdout severity threshold as info
Select Apply
Configure the connection pool

Confirm Weblogic server is running
Start the Weblogic server console (for example, http: // localhost: 7001/console)
Log on to the console
Select Services/jdbc/connection pools
Select configure a new JDBC connection pool
Select pointbase from the Database Type drop-down list
From the database driver, select pointbase's driver (Type 4) versions: 4.x
Select continue
Specify name as semjdbcconnectionpool
Specify the database name as workshop
Specify the host name as localhost
Port 9093
Specify the database user name as SEM
Specify password as SEM
Specify Confirm Password as SEM
Select continue
Test driver Configuration
Create and deploy
Configure data sources

Confirm Weblogic server is running
Start the Weblogic server console (for example, http: // localhost: 7001/console)
Log on to the console
Select Services/jdbc/Data sources
Select configure a new JDBC Data Source
Specify JDBC/semjdbcdatasource as the name
Specify the JNDI name as JDBC/semjdbcdatasource
Select emulate two-phase commit for non-XA driver
Select continue
Specify the pool name as semjdbcconnectionpool
Select continue
Click Create to determine the data source target.
Configure the JMS connection Factory

Confirm Weblogic server is running
Start the Weblogic server console (for example, http: // localhost: 7001/console)
Log on to the console
Select Services/JMS/connection factories
Select configure a new JMS connection Factory
Specify name as semjmsconnectionfactory
Set the JNDI name to JMS/semjmsconnectionfactory.
Select create
As the target and deployed on cgserver
Select Configuration tab
Select the transactions subtab
Select XA connection factory Enabled
Select Apply
Configure the jms jdbc Library

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

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

Confirm Weblogic server is running
Start the Weblogic server console (for example, http: // localhost: 7001/console)
Log on to the console
In the left-side Navigation Pane, select Services/JMS/servers/semjmsserver/destinations
Select configure a new JMS queue
Set Name To personqueue
Set the JNDI name to JMS/personqueue.
Select create
Select redelivery subtab
Specify redelivery limit to 3
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

Confirm Weblogic server is running
Start the Weblogic server console (for example, http: // localhost: 7001/console)
Log on to the console
In the left-side Navigation Pane, select Services/JMS/servers/semjmsserver/destinations
Select configure a new JMS queue
Specify name as semappweb. queue. asyncdispatcher_error
Specify the JNDI name as semappweb. queue. asyncdispatcher_error
Select create
Select redelivery subtab
Specify redelivery limit to 0
Select Apply
In the left-side Navigation Pane, select Services/JMS/servers/semjmsserver/destinations
Select configure a new JMS queue
Specify name as semappweb. queue. asyncdispatcher
Specify the JNDI name as semappweb. queue. asyncdispatcher.
Select create
Select redelivery subtab
Set error destination to semappweb. queue. asyncdispatcher_error.
Select Apply
Now you are ready to deploy the application.

Deploy applications

Confirm Weblogic server is running
Start the Weblogic server console (for example, http: // localhost: 7001/console)
Log on to the console
In the left-side Navigation Pane, select deployments/applications.
Select deploy a new application
Browse to the location of the semapp. Ear File
Select semapp. Ear
Select continue
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:

Start the configuration template Builder (on Windows, choose Start> All Programs> BEA Weblogic Platform> other development tools> Configuration template builder)
Select create a configuration template and click Next
Select basic WebLogic Workshop domain and click Next
Select an existing pre-configured and working SEM domain (for example, semdomain-manual-Express) and click Next
Specify name as semtemplate-complete
Specify author (for example, Bart)
Specify category (for example, SEM)
Specify description and click Next
Click Next in the subsequent dialog box to take the default value.
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
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

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

Change the value of the Credential attribute of the securityconfiguration element ""
Modify the credential attribute value of the embeddedldap element ""
Change the value of the cgpool Password attribute to "WebLogic"
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.

Source
Http://www.sys-con.com/story? StoryID = 47096 & De = 1

Author Profile
Prakash malani has rich experience in architecture, design, and software development. He has engaged in software development in many application fields, such as entertainment, finance, retail, medicine, communication and interactive TV. He prefers to practice and study advanced technologies, such as Java 2 Enterprise Edition (J2EE), Unified Modeling Language (UML), and Extensible Markup Language (XML ). He also teaches best practices and design patterns at institutions such as the California State Polytechnic University Pomona campus. He has published many articles in industry-renowned publications, such as javaworld and WebLogic developers journal. He is currently helping organize Los Angeles Bea Users Group (labeaug ).

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.