Note: entry level. Applies only to novice who has contacted WebLogic.
Premise:
The server is weblogic11g.
Already WebLogic project: Project1
Existing directory structure:
D:\tmp\index.htm
D:\tmp\pic.jpg
Now you want to set the D:\tmp as a virtual directory.
List two methods, I prefer to use the second method.
method One: Through the original project, configure the virtual directory
In the project's Web.xml sibling directory, create a new Weblogic.xml file. The contents are as follows:
<?xml version= "1.0" encoding= "UTF-8"?> <wls:weblogic-web-app xmlns:wls= "http:// Xmlns.oracle.com/weblogic/weblogic-web-app "xmlns:xsi=" Http://www.w3.org/2001/XMLSchema-instance "xsi: schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http:// Xmlns.oracle.com/weblogic/weblogic-web-app HTTP://XMLNS.ORACLE.COM/WEBLOGIC/WEBLOGIC-WEB-APP/1.1/ Weblogic-web-app.xsd "> <wls:weblogic-version>10.3.3</wls:weblogic-version> <WLS:CONTEXT-ROOT&G T;project1</wls:context-root> <wls:container-descriptor> <wls:prefer-web-inf-classes>tr Ue</wls:prefer-web-inf-classes> </wls:container-descriptor> <!--Configure virtual directory--> <virtual -directory-mapping> <local-path>d:</local-path> <URL-PATTERN>/TMP/*</URL-PATTERN&G
T </virtual-directory-mapping> </wls:weblogic-web-app>
Configuration complete, restart WebLogic. The access path for IE is described below:
Http://localhost:7001/project1 access to the first page of the project
Http://localhost:7001/project1/tmp access to the configured virtual directory
If you change the code for the configuration virtual directory to:
<virtual-directory-mapping>
<local-path>d:/tmp</local-path>
<url-pattern>/* </url-pattern>
</virtual-directory-mapping>
Then Http://localhost:7001/project1 becomes the access to the virtual directory, not the original item's home page.
Method Two: Configure the virtual directory via WebLogic
1, under the Virtual directory folder, new/web-inf/web.xml.
namely D:/tmp/web-inf/web.xml
The contents are as follows:
<web-app>
</web-app>
Description: Web.xml write Web-app empty tag.
If you do not write, you cannot access the virtual directory (404); it is useless to write more, such as Project name, welcome page, etc., even if configured, will not take effect.
2, modify the domain directory/config/config.xml (the article last attached to the WLS console to configure the method.) )
(Example: C:\Oracle\Middleware\user_projects\domains\lzy\config\config.xml)
Found it
<app-deployment>
<name>_auto_generated_ear_</name>
... Slightly
</app-deployment>
Add the following statement after the label:
<app-deployment>
<name>tmp</name>
<target>AdminServer</target>
< module-type>war</module-type>
<source-path>D:\tmp</source-path>
< Deployment-order>100</deployment-order>
<security-dd-model>DDOnly</security-dd-model>
</app-deployment>
Configuration complete, restart WebLogic. The access path for IE is described below:
Http://localhost:7001/project1 access to the first page of the project
HTTP://LOCALHOST:7001/TMP access the configured virtual directory ("Note" Here is the D:\TMP directory name for TMP.) )
3. (Optional steps) Configure the name of the virtual directory that is different from the folder
I do not want to use the name TMP as access path, how to do.
Create a new weblogic.xml under d:/tmp/web-inf/
namely D:/tmp/web-inf/weblogic.xml
The contents are as follows:
<?xml version= "1.0" encoding= "UTF-8"?> <wls:weblogic-web-app xmlns:wls=
"http://xmlns.oracle.com/" Weblogic/weblogic-web-app "xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "xsi:schemalocation=" http:// Java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/ Weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.1/weblogic-web-app.xsd ">
<wls: Context-root>lzy</wls:context-root>
Configuration complete, restart WebLogic. The access path for IE is described below:
Http://localhost:7001/project1 access to the first page of the project
http://localhost:7001/tmp Invalid path 404
Http://localhost:7001/lzy access to the configured virtual directory
Attach: Configure via WLS console
1, start WebLogic, open ie, access http://localhost:7001/console, login.
2, click to deploy-> installation:
Enter D:/TMP in the path of the installation page and click Next.
Each subsequent page is "next" directly.
3, back to the deployment page, start adding "tmp".
Complete.