J2ee doc Configuration Guide

Source: Internet
Author: User

J2ee doc Configuration Guide

Keywords: Java

Disclaimer: This document is translated by freehero and cannot be used for commercial purposes without the consent of the author. You can freely copy and disseminate it. This document is only for your understanding of j2ee. Due to the limited author's ability, it is recommended that you read the English document at the same time, the author is not responsible for the consequences of the wrong generation of translation, you are welcome to discuss the freehero@163.net

J2ee Configuration Guide

1. Introduction
This article describes the configuration of the j2ee environment. All the files involved are in the oncfig directory under the j2ee installation directory. These files are all text files,

You can have any text editor to edit them.
Normally, you do not need to change these files. However, if the database driver you are using is not cloudscape, you need

Configure according to the content in this chapter.

2. JDBC driver
After the default j2ee is installed, the cloudscape database (a demo database provided by sun) is supported. If your ejb uses jdbc instead

Is to connect to the cloudscape database, you need to follow the instructions below to configure. (If you are not sure that this version of j2ee supports your use

For the jdbc driver, go to 11111 to view the relevant information .)

3. Driver location
You must copy the driver file (. jar file) to the $ J2EE_HOME/lib/system directory. Make sure that the file is included in

J2EE_CLASSPATH environment variable.

4. J2EE_CLASSPATH environment variable
The j2ee server connects to the database through the JDBC driver. Location of the driver file (. jar file) through the J2EE_CLASSPATH environment variable

. You can set this variable in the command line before starting j2ee. However, we recommend that you set the J2EE_CLASSPATH variable in the script. Editing

The user configuration file is a required step during installation. In unix, the user configuration file is/bin/userconfig. sh, and in windows nt, it is

Bin/userconfig. bat
Note: You should remove the driver file (. jar file) from the CLASSPATH environment variable at the same time ).

5. JDBC 1.0 driver
To configure the jdbc1.0 driver, edit jdbc. drivers and jdbc. CES in the config/default. properties file.

Attribute Value. Note that the driver file must be included in the J2EE_CLASSPATH environment variable.
Jdbc. drivers attributes

The value of the jdbc. drivers attribute is the jdbc Driver Class Name separated by a series of colons. The format is as follows:
Jdbc. drivers = <classname >:< classname> :...
For example:
Jdbc. drivers = oracle. jdbc. driver. OracleDriver: testutil. MyDriver

Jdbc. CES Attribute Value

The jdbc. datasources attribute value consists of two parts: the jndi name of datasource and the url of the database. Typical

The condition is that the jndi name is the logical name of the database, and rul specifies the actual location of the database. The jndi name and url are both specified in the ejb encoding process.

. For details about the rul format, see the documentation of the jdbc driver provider.
The jdbc. datasources syntax is as follows:
Jdbc. datasources = <jndi_datasource> | <url >|< jndi_datasource >|< url>...
| The symbol has two functions. First, it separates several jndi_datasource; second, it separates

Jndi_datasource> and <url> elements.
The syntax of the jndi_datasource element is as follows:
It starts with the jdbc keyword and jndi_name is the datasouce name specified in the jndi directory.
For example:
Jdbc. datasources = jdbc/Oracle | jdbc: oracle: thin @ rtc: 1521: acct | jdbc/MyDB | jdbc: test

6. JDBC2.0 driver supported by JTA
To configure the JDBC2.0 driver of JTA, you need to set the following attribute values:
Xadatasource. <n>. jndiname
Xadatasource. <n>. classname
Xadatasource. <n>. dbuser
Xadatasource. <n>. dbpassword
Xadatasource. <n>. prop. <property-name>
You must also include the jdbc driver file in the J2EE_CLASSPATH environment variable.

Jdbc20.datasources attributes
The value of the jdbc20.datasources attribute is connected with the jndi name to locate the position of datasouce (which is a parameter of the lookup method)

The jdbc20.datasources syntax is as follows:

Jdbc20.datasources = <jndi_datasource> | <jndi_XA_datasource> | <jndi_datasource> | <jndi_XA_datasource>

| Has two functions: first, separate jndi_datasource and <jndi_XA_datasource> and form a pair. Second, separate each pair

Jndi_datasource> and <jndi_XA_datasource> elements.
<Jndi_datasource> the same syntax as jndi_XA_datasource:
Start with the jdbc keyword. Jndi_name is the datasource name, which points to the jndi directory.
For example:
Jdbc20.datasources = jdbc/Merant | jdbc/XAMerant | jdbc/Finch | jdbc/XAFinch

Xadatasource Properties
Xadatasource. <n>. jndiname attribute specifies the jndi name of XA DataSource. Syntax:
Xadatasource. <n>. jndiname = jdbc/<jndi_XA_datasource>
N indicates each group of xadatasource. The first jdbc2.0 driver n is 0, and the next one is 1, 2, and so on. Jndi_XA_datasource element and

The value specified by jdbc20.datasources corresponds.
The xadatasource. <n>. dbuser and xadatasource. <n>. dbpassword attribute specifies The database user and password. Generally

Users have administrator permissions (for more information, see 2222 The distributed. transaction. recovery ).
Xadatasource. <n>. prop. <property_name> specifies the value associated with a specific attribute value. The actual value may be a jdbc driver.
For example:
Xadatasource.0.jndiname = jdbc/XAMerant
Xadatasource.0.classname = com. merant. sequelink. jdbcx. datasource. SequeLinkDataSource
Xadatasource.0.prop. url = jdbc: sequelink: // mypc: 5000/[Oracle]

7. Transactions

You can edit the config/default. properties file to control the transaction occurrence and timeout settings.
Distributed. transaction. recovery attribute
This attribute controls whether distributed transactions occur. The following conditions must be met:
The scope of transactions during cross-database operations.
The j2ee program uses the jdbc2.0 JTA driver to access the database.
When a fault occurs, the components of the transaction can be submitted or rolled back in accordance with the two-segment submission protocol.
When a transaction occurs, the transaction can be committed or rolled back after the server restarts.
The value of distributed. transaction. recovery is true or false. The default value is false after j2ee is installed.
Distributed. transaction. recovery = false

Transaction. time attribute
In the ejb that applies container-managed transactions, you can control the time-out interval of transactions by setting the value of transaction. timeout.

. For example:
Transaction. timeout = 5
After the configuration, if the transaction is not completed within five seconds, the j2ee transaction manager will roll back it.
When j2ee is installed for the first time, a value of 0 in timeout indicates that no timeout occurs.
Only ejbs that use iner-managed to manage transactions are affected by timeout. For bean-managed and JTA

In transactions, You can reference the setTransactionTimeout method of UserTransaction. You can also create

REFERENCE The setTransactionTimeout method, such as servlets and jsp.

8. Port

The TCP/IP Port is required for j2ee. You can modify the port number of the corresponding file in the config directory. The following table lists the port numbers and corresponding files.

Ejbs 9191 EJB. properties http. port = 9191
HTTP 8000 web. properties port = 8000
HTTPS 7000 web. properties https. port = 7000
Naming and Directory 1050 orb. properties port = 1050

Port 9191 is used to provide the stub class required for client download.
8000 provide http Services
7000 provide https service
1050 orb-based port used by the jndi Name Service

9. Log Files

The j2ee server has several log files. By default, these files are stored in the logs directory. Edit config/default. properties

You can change the default directory for the log. directory attribute.
Log. directory = logs

You can also edit the default. properties file to change the name of the log file. For example, you can modify

Value to modify the name of the output. log file.
Generally, log files are determined by the j2ee startup mode. (Single or multiple VM (virtual machine) Mode)
Single VM Log File
The default mode is Single VM. In this case, the log file is located
$ J2EE_HOME/<logs>/Logs is specified by the log. directory attribute in the default. properties file. The host element is the computer name.
Generate the following files.
System. out
System. err
Event. log
Output. log
Error. log
The system. out and system. err files include the output of System. out and System. err in ejb. If you run j2ee-verbose

Parameter, the output is written to stdout (standard output) and stderr (standard error. Output ). The system. out and system. err log files are not

Create. Audit. lo is created only when the audit attribute value in the config/auth. properties file is true.

Multiple VM logs

If you use j2ee-mutiVM to start the server, the ejb and http services are started independently on your own virtual machine. For each depploy

Applications are also running in their own virtual machines. Log files are the same as the preceding log files, but they are stored in different directories.
The directory is as follows:
EJB $ J2EE_HOME/<logs>/ejb/ejbd
HTTP $ J2EE_HOME/<logs>/ejb/httpd
Deployed application $ J2EE_HOME/<logs>/ejb/<app-name>

Web server logs
Edit the content in the web. properties file to change the name of the log file created by the web server.

10. Security

Unauthorized User
For j2ee, when an unauthorized user attempts to call the ejb container, j2ee must have an unauthorized user in the general sense.

Yes. In j2ee, the username is guest and the password is guest123. You can modify the user name and password in the auth. properties file.

Default. principal. name = guest
Default. principal. password = guest123

Keystore password <

Related Article

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.