经过weblogic管理后台console进行发布本地项目的时候, 它会默认以WEB-INF的上一级目录做为访问路径, 如,假如你的项目WEB-INF目录的上一层是WebRoot, 那么发布后,访问的路径默认是:http://hostname:port/WebRoot。 怎么样才能把WebRoot修改为其余内容呢? 解决方法就是在WEB-INF目录下增长weblogic.xml文件, 内容以下:java
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd"> <context-root>/test</context-root> <container-descriptor> <prefer-web-inf-classes>true</prefer-web-inf-classes> </container-descriptor> </weblogic-web-app>
其中<context-root>标签之间的内容就是替换WebRoot的内容,只要改为你相应的内容便可, 此时的访问变为http://hostname:port/testweb
修改http://localhost:7001/后面的context,在weblogic.xml文件里改成xxx/便可(xxx是项目名称)app