`
收藏列表
标题 标签 来源
weblogic 虚拟目录配置 weblogic,虚拟目录配置 weblogic 11G 虚拟目录映射weblogic.xml配置
.
碰到中文问题请参考我另一篇文章http://tianshidehuhuan.iteye.com/blog/1206805 

一直配置一直404...发了我一天多时间 这里记录下来~ 
没配置成功原因基本上是我理解错误了认为跟tomcat jboos 配置一个样了 

映射的方法基本上是,在工程中添加weblogic.xml文件再添加相应配置了 

配置过程中有这几个问题: 
1、weblogic.xml 在哪里?? 也可以下载我的附件 
    weblogic.xml 指的是你某个应用下的WEB-INF即跟你web.xml同级的weblogic.xml(如果没有就自己新建一个,不过要注意DTD什么的)weblogic 11G就如下可以有两种 

Java代码  
1.①   
2.<?xml version="1.0"?>   
3.  
4.<weblogic-web-app   
5.    xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app"  
6.    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
7.    xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"  
8.>  
①
<?xml version="1.0"?>

<weblogic-web-app
	xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"
>


Java代码  
1.②   
2.<?xml version="1.0" encoding="UTF-8"?>   
3.<wls:weblogic-web-app xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-web-app"  
4.    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
5.    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">  
②
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://www.bea.com/ns/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://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">

2、怎么配置映射路径?? 
    同样针对两种DTD也有两种 

Java代码  
1.①   
2.       
3.        <context-root>/</context-root>    //设置在根路径即可访问该服务 如:http://localhost:7001/....   
4.        <virtual-directory-mapping>   
5.        <local-path>d:/cq</local-path>   
6.        <url-pattern>/utan/*</url-pattern>   
7.    </virtual-directory-mapping>  
①
	
        <context-root>/</context-root>    //设置在根路径即可访问该服务 如:http://localhost:7001/....
        <virtual-directory-mapping>
		<local-path>d:/cq</local-path>
		<url-pattern>/utan/*</url-pattern>
	</virtual-directory-mapping>

说明: 
    1)你D盘上面的路径结构应该为 d:\cq\utan [将需要的资源放入utan下面] 
    2)资源访问路径为 http://localhost:7001/utan/... == d:\cq\utan\... 

Java代码  
1.②   
2.    <wls:context-root>webtest</wls:context-root>   
3.    <wls:virtual-directory-mapping>   
4.        <wls:local-path>d:/cq</wls:local-path>   
5.        <wls:url-pattern>/images/*</wls:url-pattern>   
6.        <wls:url-pattern>*.jpg</wls:url-pattern>   
7.    </wls:virtual-directory-mapping>  
②
	<wls:context-root>webtest</wls:context-root>
	<wls:virtual-directory-mapping>
		<wls:local-path>d:/cq</wls:local-path>
		<wls:url-pattern>/images/*</wls:url-pattern>
		<wls:url-pattern>*.jpg</wls:url-pattern>
	</wls:virtual-directory-mapping>

说明:   
1)我特意配成这样用于访问特定资源了,要求您在 d:/cq上创建名为 images 的目录。这允许 servlet 容器在 images 目录下找到适用于多个 Web 应用程序的图像。 
2)资源访问路径为 http://localhost:7001/webtest/images/.. == d:\cq\images\.. 

参考: 
1) 
http://edocs.weblogicfans.net/wls/docs92/webapp/weblogic_xml.html#wp1039396 



Global site tag (gtag.js) - Google Analytics