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 = : :...
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 = | | | ...
| The symbol has two functions. First, it separates several jndi_datasource; second, it separates
Jndi_datasource> and Element.
The syntax of the jndi_datasource element is as follows:
JDBC/
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:
Jdbc20.datasources
Xadatasource. . Jndiname
Xadatasource. . Classname
Xadatasource. . Dbuser
Xadatasource. . Dbpassword
Xadatasource. . Prop. 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 = | | |
| Has two functions: first, separate jndi_datasource and And form a pair. Second, separate each pair
Jndi_datasource>, Element.
The same syntax as jndi_xa_datasource:
JDBC/
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. The jndiname attribute specifies the JNDI Name Of The Xa datasource. Syntax:
Xadatasource. . Jndiname = JDBC/
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. . Dbuser and xadatasource. The. dbpassword attribute specifies the database user and password. Generally
Users have administrator permissions (for more information, see 2222 the distributed. transaction. Recovery ).
Xadatasource. . Prop. Specifies the value associated with a specific property 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/ / /EJB
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/ /EJB/ejbd
HTTP $ j2ee_home/ /EJB/httpd
Deployed application $ j2ee_home/ /EJB/
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
If you use the public key to access https, the authentication information is stored in /. Keystore file. At the same time, user-home is
The return value of system. getproperty ("user. Home.
Keystore is a typical password file. The default password is changeit. Can be modified in the web. properties File
The value of the keystore. Password attribute to change the password.
Anyone role
In the security panel of the Application Deployment Tool, the method is assigned to the anyone role by default. This result
Yes. All users and groups can call it. If you do not target a specific role, every user or user can call it. Yes
Set anyone. Role. name in the auth. properties file to change the default anyone role.
The condition for passivation: Memory limit
When the EJB container begins to deactivate an EJB, it stores the EJB in the attached storage and tries to re-allocate the memory. Default Condition
If the memory usage exceeds MB, the passivation starts. You can edit the config/Default. properties file.
Passivation. Threshold. Memory attribute value to modify the default value.
Passivation. Threshold. Memory = 128000000.
The value must be a positive integer. It often happens when you reduce this value.
JNDI name server host
If the JNDI name server and J2EE server are not on the same machine, you must change the host in the config/ORB. properties file.
Attribute Value.
Host = localhost
HTTP document root
By default, the document for HTTP and HTTPS services is public_html. You can edit DocumentRoot in the web. properties File
Attribute Value to change it.
DocumentRoot = public_html/