In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to configure J2EE, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
1. Introduction
Introduce the configuration of the j2ee environment, all the files involved are in the oncfig directory under the j2ee installation directory, these files are text files, you can have any text editor to edit them.
Usually, you don't need to change these files. However, if you are using a database driver other than cloudscape, you need to follow the contents of this chapter to configure.
2.JdbC driver
The default j2ee installation supports the cloudscape database (a demo database provided by sun). If your EJB uses a JDBC that is not connected to the cloudscape database, you need to configure it as you know below. If you are not sure that this version of j2ee supports the jdbc driver you are using, please go to 11111 to see the relevant information. )
3. Driving position
You must copy the driver file (.jar file) to the $J2EE_HOME/lib/system directory. And make sure that the file is included in the environment variable of J2EE_CLASSPATH.
4.J2EE_CLASSPATH environment variable
J2ee server connects to the database through the JDBC driver. The location of the driver file (.jar file) is located through the environment variable of J2EE_CLASSPATH. You can set this variable on the command line before starting j2ee. However, we recommend that you set the J2EE_CLASSPATH variable in the script. Editing the user profile is a necessary step during installation. In unix, the user profile is / bin/userconfig.sh,windows nt is bin/userconfig.bat
Note: you should also remove the driver file (.jar file) from the CLASSPATH environment variable.
five. JDBC 1.0 driver
To configure the jdbc1.0 driver, edit the jdbc.drivers and jdbc.datasources attribute values of the config/default.properties file. Again, note that the driver file must be included in the J2EE_CLASSPATH environment variable.
Jdbc.drivers attribute
The value of the jdbc.drivers attribute is the class name driven by jdbc with a series of colon splits. The format is as follows:
Jdbc.drivers=::. . .
For example:
Jdbc.drivers=ORACLE.jdbc.driver.OracleDriver:testutil.MyDriver
Jdbc.datasources attribute value
The jdbc.datasources attribute value consists of two parts, one is the name of the jndi of the datasource, and the other is the url of the database. Typically, the jndi name is the logical name of the database, and rul specifies the actual location of the database. Both the jndi name and url are specified during the ejb encoding process. For the format of rul, please refer to the documentation of the jdbc driver provider.
The syntax of jdbc.datasources is as follows:
Jdbc.datasources= |. . .
| symbols have two functions. First, it separates several jndi_datasource; second, it separates jndi_datasource > and elements in each jndi_datasource.
The syntax for the jndi_ datasource element is as follows
Jdbc/
Starting with the jdbc keyword, 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 that supports JTA
To configure the JDBC2.0 driver for JTA, you need to set the values of the following properties:
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 attribute
The value of the jdbc20.datasources property is concatenated with the jndi name to locate the location of the datasouce (which is the parameter of the lookup method).
The syntax of jdbc20.datasources is as follows:
Jdbc20.datasources= | |
| |
There are two functions: first, to separate jndi_datasource and form a pair, and second, to separate each pair of jndi_datasource >, elements.
Have the same syntax as jndi_XA_datasource:
Jdbc/
The beginning of 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 attribute
The xadatasource..jndiname attribute specifies the jndi name of the XA DataSource. The syntax is as follows:
Xadatasource..jndiname=jdbc/
N represents each group of xadatasource. The first jdbc2.0 driver n is 0, the next one is 1Jet 2, and so on. Jndi_XA_datasource elements and
The value specified by jdbc20.datasources corresponds to
The The xadatasource..dbuser and xadatasource..dbpassword attributes specify the database user and password. Usually this user has administrator privileges (see 2222 The distributed.transaction.recovery for more information).
Xadatasource..prop. Specifies the value associated with a specific property value. The actual value may be the 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. Business
You can edit the config/default.properties file to control transaction occurrence and timeout settings.
Distributed.transaction.recovery attribute
This attribute controls whether distributed things happen or not. To the extent that these things can happen, the following conditions must be met:
The scope of things when operating across libraries.
J2ee program accesses database through jdbc2.0 JTA driver
When a failure occurs, the various components of the thing can be committed or rolled back in a manner that conforms to the two-segment commit protocol.
When things happen, things can be committed or rolled back after server is restarted.
The value of distributed.transaction.recovery is true or false. J2ee defaults to false after installation.
Distributed.transaction.recovery=false
Transaction.time attribute
In the EJB that applies container-managed things, you can control the time-out interval of things by setting the value of transaction.timeout. For example:
Transaction.timeout=5
After setting up, if the thing is not finished within 5 seconds, the j2ee transaction manager will roll it back.
When j2ee is installed for the first time, a value of 0 of timeout indicates that there is no timeout.
Only ejb that uses container-managed to manage things is affected by timeout. As for bean-managed and JTAtransactions, you can refer to UserTransaction's setTransactionTimeout method. You can also refer to setTransactionTimeout methods in other builds, such as servlets and JSP.
8. Port
TCP/IP port is required for j2ee. Modify the corresponding file in the config directory to change the port number. The following table shows the port number and the corresponding file.
EJB 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 stub classes needed for client download.
8000 provide http services
7000 provide https services
1050 Port used by orb-based jndi naming service
9. Log file
J2ee server has several log files. By default, these files are in the logs directory. Edit the
The log.directory property can change the default directory.
Log.directory=logs
You can also edit the default.properties file to change the name of the log file. For example, you can change the name of the the output.log file by changing the value of the log.output attribute.
Generally speaking, the log file is determined by the mode in which j2ee is started. (single or multiple VM (virtual machine) mode)
Single VM log file
The default is Single VM mode. In this case, the log file located in $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 the j2ee-verbose parameter, the output is written to stdout (standard output) and stderr (standard error). Output). System.out and system.err log files are not created. Audit.lo is created only if the value of the audit attribute in the config/auth.properties file is true.
Multiple VM log
If you use j2ee-mutiVM to start server,ejb and http services in your own virtual machine as a separate service. Each depploy application also runs in its own virtual machine. The log file is the same as above, but in a different directory.
The catalogue is as follows:
EJB $J2EE_HOME//ejb/ejbd
HTTP $J2EE_HOME//ejb/httpd
Deployed application $J2EE_HOME//ejb/
Web server log
By editing the contents of the web.properties file, you can change the name of the log file created by web server.
The above is all the content of this article "how to configure J2EE". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.