I feel that it is well written, so I will share it with you!
Preface
WebLogic is a superior performance J2EE server, and its users in China are growing rapidly. However, there is basically no Chinese information about it, not to mention its experience. The following are some of my experiences in using weblogic6.0 and I will share them with you.
1. Install weblogic6.0
Weblogic6.0 comes with JDK 1.3, so you can directly install JDK without having to install JDK in advance. On the Win2000 platform, it is an EXE file and can be directly run. On the UNIX platform, the installation package is *. binfile, run it with SH. It is best to add the console option of-I console (if not added, classnofound and other errors may be reported) as follows:
Sh weblogic60_sol.bin-I console Console
Note:
1. The tmp directory of the UNIX system (the path indicated by the environmental variable tmpdir or tmp_dir) should have enough space, because weblogic6.0 first decompress the file to the tmp directory of the system before installation. If the tmp directory space is insufficient, an error will occur. You can set tmpdir to a directory with sufficient space.
2. If an error occurs during installation by a common user, try to use the root user for installation. It is generally about environment variables and permissions.
3. You can install the software on the supervisor.
2. Connection to the Oracle database
Weblogic6.0 accesses Oracle through the Oracle client. Therefore, you must correctly install the Oracle client on the machine where weblogic6.0 is located. Weblogic6.0 provides JDBC driver support for Oracle type2, which is a dynamic Connection Library (NT is. DLL, UNIX is. so) file, under $ wl_home/bin, several directories starting with OCI. Which directory of the database file is used depends on the version of the Oracle server and client and the version of the Oracle API. For more information, see the online documentation of weblogic6.0. Add the path of these databases to the system environment variables. Otherwise, weblogic6.0 reports the following error when accessing the database:
Java. SQL. sqlexception: system. loadlibrary threw java. Lang. unsatisfiedlinkerror
With the message ''no weblogicoci37 in Java. Library. path ''.....
Add it to the PATH environment variable in Win2000, for example:
Set Path = D:/weblogic6.0/wlserver6.0/bin/oci816_7; C:/orant816/bin; % PATH %
On the nix platform, add the file to the system's library path. For example, on Sun, add it to the LD_LIBRARY_PATH environment variable. The method is as follows:
Export LD_LIBRARY_PATH =/BEA/weblogic6.0/oci816_8: $ ORACLE_HOME/lib
On the HP platform, add it to the shlib_path environment variable, for example:
Export shlib_path =/BEA/weblogic6.0/lib/hpux11/oci816_8: $ ORACLE_HOME/lib
3. Set resource access permissions in weblogic6.0
Weblogic6.0 allows you to set access control tables for almost all resources managed by weblogic6.0, including EJB, JSP, Servlet, pool, JMS, RMI, JNDI, and JDBC. When you first access resources in the access control table, a dialog box is displayed in weblogic6.0 asking you to enter the password and password. If the password is incorrect three times, the following error is returned:
Error 401 -- unauthorized xxx
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.2 401 unauthorized
You can set the access permission in either of the following ways:
1. Set in the console of weblogic6.o and save the result to filerealm. in properties, weblogic6.0 file realm is used. it is easy to set access control tables for JSP, server, and a directory. I tried it many times but failed. It can be used by web users (access through browsers) and normal users (access through Java clients, etc.
2. Set in Web. xml and weblogic. XML to work only for Web users. The following is an example of this method.
For example, in a web application named orderwebapp, all the customer's order files are placed in the/orders directory, and only the manager can browse the files in this directory. Its web. xml and weblogic. XML can be set as follows:
* ************************* Web. XML *************************
<! Doctype web-app public "-// Sun Microsystems, Inc. // DTD web application 1.2 //" http://java.sun.com/j2ee/dtds/web-app_2_2.dtd ">
<Web-app>
<Security-constraint>
<Web-resource-collection>
<Web-resource-Name> secureorderseast </Web-resource-Name>
<Description> Security constraint for resources in the orders directory </description>
<URL-pattern>/orders/* </url-pattern>
<Http-method> post </HTTP-method>
<Http-method> Get </HTTP-method>
</Web-resource-collection>
<Auth-constraint>
<Description> constraint for orders </description>
<Role-Name> Manager </role-Name>
</Auth-constraint>
<User-data-constraint>
<Description> SSL not required </description>
<Transport-guarantee> none </transport-guarantee>
</User-data-constraint>
</Security-constraint>
<Security-role>
<Description> managers </description>
<Role-Name> Manager </role-Name>
</Security-role>
</Web-app>
Description: The resource access control table defined in <security-constraint>. In <web-resource-collection>, define the resource and its access method. in <auth-constraint>, define the role that can access the resource; in <user-data-constraint>, determine whether to use SSL to establish a connection between the WebLogic Server and the client. Define the role name in <security-role>.
* ************************ Weblogic. XML *************************
<! Doctype weblogic6.0-web-app public "-// BEA Systems, Inc. // DTD web application 6.0 // en" "http://www.bea.com/servers/wls600/dtd/WEBLOGIC6.0-web-jar.dtd">
<Weblogic6.0-web-app>
<Security-role-assignment>
<Security-role-assignment>
<Role-Name> Manager </role-Name>
<Principal-Name> Peter </Principal-Name>
<Principal-Name> Bill </Principal-Name>
</Security-role-assignment>
</Weblogic6.0-web-app>
Note: <security-role-assignment> defines the users corresponding to the roles defined in Web. xml. These users must be defined on the console of weblogic6.0.
When you enter http: // localhost: 7001/orderwebapp/orders/order100.html in the browser, weblogic6.0 requires that you enter the user name and password. Only Peter is allowed, and Bill can access the file.
I found that. set <security-role-assignment> in XML, and define the user name and web in the console of weblogic6.o. in XML, the role name in <security-role> is the same. Then the user can access the protected resources. If you are in weblogic. <security-role-assignment> is set in XML. users with the same name as the role in <security-role> cannot access protected resources, only users defined in <security-role-assignment> can access protected resources.
Iv. jsp settings and debugging
In weblogic6.0, JSP must be placed in a web application to access it. The JSP configuration is in weblogic. XML, as shown below:
<! Doctype weblogic6.0-web-app public "-// BEA Systems, Inc. // DTD web application 6.0 // en" "http://www.bea.com/servers/wls600/dtd/WEBLOGIC6.0-web-jar.dtd">
<Weblogic6.0-web-app>
<JSP-Descriptor>
<JSP-param>
<Param-Name>
Pagecheckseconds
</Param-Name>
<Param-value>
1
</Param-value>
</JSP-param>
<JSP-param>
<Param-Name>
Verbose
</Param-Name>
<Param-value>
True
</Param-value>
</JSP-param>
</JSP-Descriptor>
</Weblogic6.0-web-app>
More important: pagecheckseconds. Set the interval at which weblogic6.0 checks whether the content of the JSP file has changed and needs to be re-compiled, equal to 0, every call is re-compiled (usually used in the debugging environment), equal to-1 and never re-compiled (usually used in the running environment ). When you access a JSP file under a web application for the first time, weblogic6.0 compiles it into a class file and places it in the corresponding directory:
1. If a web application is published in the directory structure
WEB-INF/_ tmp_war_examplesserver_examplesserver _ * directory.
2. If the Web applicaton is assigned as a war file, place it in:
... /Applications/. wl_temp_do_not_delete/WEB-INF/_ tmp_war_examplesserver_examplesserver _ * directory.
When debugging JSP, in order to make every time the latest page is accessed, in addition to setting pagecheckseconds = 0, ie should not cache the page. The settings are as follows:
Check the newer versions of the page stored in/tools/Internet Options/General/settings/to check whether the page is accessed each time. If you still cannot see the latest page, you can delete the class file corresponding to the JSP under the directory described above and force weblogic6.0 to be recompiled.
5. Password Management
When weblogic6.0 is started, you will be prompted to enter the password. If you do not want to enter the password every time you start, you can create a paddword. ini file and save the password in this file. You can also use-dpassword = password to add the password to the startup script. The password can be changed in security in the weblogic6.o console.
Vi. Use of the weblogic6.o Console
The console of weblogic6.o can only be started in ie5.0 or later versions. If the proxy server is set for IE, the console of weblogic6.o may not start, the proxy server settings should be removed from/tools/Internet Options/connection/LAN Settings. Almost all configurations can be completed in the weblogic6.0 console. Unlike weblogic5.1, you sometimes need to directly modify the configuration file.
VII. config. xml file
Every time weblogic6.0 is started successfully, the config. xml file is automatically backed up to config. xml. Booted (in the same directory ). If the content in config. XML is changed,
Weblogic6.0 cannot be started successfully. It can be used to overwrite the corrupted config. xml. If. the resources registered in XML (such as an EJB or war file) are deleted. Every time weblogic6.0 is started, an error message is displayed. You can manually mount the EJB or war in config. you will not be prompted to delete the registration items in XML. Always back up this file.
8. Access to the default web application
Weblogig has a default web application. If an HTTP (https) request cannot be processed by the specified web application, the default application is automatically processed, if the default application cannot be processed, an error is returned. To access http: // localhost: 7001/myweb/My. jsp. If myweb does not contain my. jsp, and the default application contains my. jsp, the result is returned to the browser. The default web application is defaultwebapp_examplesserver under applications. It can only be arranged in the form of a directory structure, not a war file. If this directory is deleted, the directory will be automatically generated when weblogic6.0 is started. You do not need to add the web application name when accessing the web application. For example, there is a test under the defaultwebapp directory. JSP: http: // localhost: 7001/test. JSP can access this JSP, but http: // localhost: 7001/defaultwebapp_examplesserver/test. JSP access fails.
Note: access files in other web applications. You must add the web application name.
IX. Precautions for cluster configuration
1. Set a gateway
When configuring a cluster, the default gateway must be configured for each server. If no gateway is configured, the Manager server cannot connect to the Administrator server. In Win2000, you can add it directly in the control panel. in UNIX, set the IP address with router add IP address. The IP address can be the IP address of the server, and change the last section to 1, for example, 192.168.1.111 can use 192.168.1.1 as the default gateway. Use netstat-Rn in UNIX to view the default gateway of the system.
2. weblogic6.0 runs in cluster mode, and the license containing the cluster license is used.
3. Invalid multicastaddress
Valid multicastaddress ranges from 224.0.0.0 to 239.255.255.255.
Use utils. multicasttest in weblogic6.0 to test whether the multicastaddress is normal. For example:
Java utils. multicasttest-n test-A 237.0.0.1
-N specifies a name to identify the process.
-IP address to be tested by
4. The versions of weblogic6.0 server in a cluster must be the same, and the listening ports should also be the same.
5. It is best not to deploy any applications in the administrator sever and enlarge the applications on the managed server.
10. Deploy applications in weblogic6.0
1. Applications in weblogic6.0 can be divided into three types, which correspond to different descriptive files, extensions, or directory structures:
(1) *. jar: Is the EJB compressed package (there are 3 Description file ejb-jar.xml, weblogic6.0-ejb-jar.xml, weblogic6.0-cmp-rdbms-jar.xml)
(2) *. War: A web application package that only contains JSP and Servlet (there are two description files: Web. xml and webloigc. XML)
(3) *. Ear: a J2EE enterprise application package containing EJB and web application (one description file, application. XML)
Note: they cannot be mixed. For example, Web applicatoin cannot be packaged into A. Ear file.
2. weblogic6.0 applications are released in two ways:
(1) It is stored in the applications directory of weblogic6.0 as a directory and is suitable for the development stage.
(2) It is stored in the applications directory of weblogic6.0 in the form of a compressed package. It is suitable for running stage and can be packaged using jar, such as D:/test> jar CF testwar. War *
Package all files in the test directory into a testwar. War file.
3. There are two ways to deploy weblogic6.0 applications.
(1) Static layout: Apply to config. you can add a file in XML on the console of weblogic6.o. weblogic6.0 automatically copies the corresponding compressed package of the application to the applicaitons directory. If you modify the application, you need to reconfigure it.
(2) Dynamic Layout: Not in config. you can directly copy the compressed package or directory to the applications directory. weblogic6.0 will automatically detect the file. when weblogic6.0 is started, it automatically performs Dynamic Layout for applications that are not statically arranged in the applications directory.
4. Example:
If an application contains EJB, JSP, and Servlet, the layout steps are as follows:
(1) generate the ejb jar file. The best JAR file corresponds to an EJB
(2) generate a war file for the web application, register it in Web. xml and weblogic. XML, and configure Servlet and JSP.
(3) create an application. xml file and set the attributes of the application. Package application. XML, *. jar, *. war into a *. Ear file.
(4) register the application on the console of weblogic6.o or copy the ear file to the applicaiton directory. This is done everywhere.
11. classpath in weblogic6.0 6.0
Classpath in weblogic6.0 6.0 is much simpler than classpath in 5.1. Let's make a summary of it:
1. You only need to set the following classpath for weblogic6.0 6.0 to start.
Set % wl_home %/lib/weblogic6.0 _ sp. jar; % wl_home %/lib/weblogic6.0.jar
If you want to use its cloudscape database, add:
% Wl_home %/samples/eval/cloudscape/lib/cloudscape. Jar
2. The class referenced in EJB must be in the classpath of the system before it can be accessed.
3. If it is a Web applicatoin servlet, JSP references other classes, put them to the Web applicatoin/WEB-INF/classes directory weblogic6.0 can access. Of course, if you set the paths of these classes in the system classpath, weblogic6.0 can also be accessed. When calling, weblogic6.0 will copy the classes under the WEB-INF/classes/.. /applications /. wl_temp_do_not_delete /..... /In the WEB-INF, whether it is the packaged ear, war file or directory mode not packaged.
4. If an EJB is called in the JSP file of a web application, that is, JSP is the client of the EJB, you only need to import it in the JSP file. For example, a JSP calls the EJB: COM. test. BBS. jar. The import format is as follows:
<% @ Page import ="
Javax. Naming .*,
Javax. EJB .*,
Java. RMI. RemoteException,
Java. RMI. Remote,
Java. util .*,
Java. SQL .*,
Com. Test. bbs .*
"%>
Of course, the com. Test. bbs. jar file must be correctly configured.
When the web application is deployed as a war file, Com. Test. bbs. jar does not need to be in the classpath of the system or the WEB-INF/classes of the Web application, the JSP can be called for use. However, if a web application is stored in applications in a directory, the classes in the EJB must be accessed in the system classpath. Put it under the web-INF/classes/of the Web application. The JSP cannot access this EJB. You can add com. Test. bbs. jar to the classpath of the system. For example, you can set the classpath when weblogic6.0 is started as follows:
Set classpath =.;./lib/weblogic6.0 _ sp. jar;./lib/weblogic6.0.jar; D:/weblogic6.0/wlserver6.0/config/examples/applications/xcjing_ejb_bbsok.jar
You can also copy bbshome. Class. bbsbean. Class and BBs. Class to a specified path in the classpath of the system. For example, the classpath started by weblogic6.0 is as follows:
Classpath =.;./lib/weblogic6.0 _ sp. jar;./lib/weblogic6.0.jar; D:/weblogic6.0/wlserver6.0/config/examples/serverclasses
You can copy the preceding three files to D:/weblogic6.0/wlserver6.0/config/examples/serverclasses. This jsp can also be accessed.
5. If an application uses EJB and classpath in JSP, set the same as above. If the EJB in the application references other classes, these classes must be in the system classpath before they can be accessed.