通过weblogic管理后台console进行发布本地项目的时候,它会默认以WEB-INF的上一级目录作为访问路径,如,假如你的项目WEB-INF目录的上一层是WebRoot,那么发布后,访问的路径默认是:http://hostname:port/WebRoot,怎么样才能把WebRoot修改成其他内容呢? 解决方法就是在WEB-INF目录下增加weblogic.xml文件,内容如下: /test true 其中标签之间的内容就是替换WebRoot的内容,只要改成你相应的内容即可,此时的访问变为http://hostname:port/test
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app>
<context-root>/test</context-root>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>