weblogic 11G 虚拟目录映射weblogic.xml配置


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

映射的方法基本上是,在工程中添加weblogic.xml文件添加相应配置了
配置过程中有这几个问题:
1、weblogic.xml 在哪里?? 也可以下载我的附件
weblogic.xml 指的是你某个应用下的WEB-INF即跟你web.xml同级的weblogic.xml(如果没有就自己新建一个,不过要注意DTD什么的)weblogic 11G就如下可以有两种
Java代码
  1. <?xmlversion="1.0"?>
  2. <weblogic-web-app
  3. xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-apphttp://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"
  6. >

  • <?xmlversion="1.0"encoding="UTF-8"?>
  • <wls:weblogic-web-appxmlns:wls="http://www.bea.com/ns/weblogic/weblogic-web-app"
  • xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsdhttp://www.bea.com/ns/weblogic/weblogic-web-apphttp://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">

  • 2、怎么配置映射路径??
    同样针对两种DTD也有两种
    <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\...
    <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\..

    相关文章

    php输出xml格式字符串
    J2ME Mobile 3D入门教程系列文章之一
    XML轻松学习手册
    XML入门的常见问题(一)
    XML入门的常见问题(三)
    XML轻松学习手册(2)XML概念