搞死人的contextRoot;weblogic9.2

默认情况下:

两个app-deployment同时部署到了一台weblogic服务器的同一个domain下面的时候

/mysite/www/www/WEB-INF/weblogic.xml

/mysite/vvv/vvv/WEB-INF/weblogic.xml

中同时配置了  <context-root>/</context-root>    ;此时,启动或重启weblogic或应用本身是失败的;

需要到/bea/user_projects/domains/base_domain/config/修改config.xml(注意8.1和9.2的写法不同)

修改定义app-deployment段

  <app-deployment>
    <name>vv2</name>
    <target>AdminServer,vv</target>#这里默认是AdminServer和app-deployment名同时有;修改成只有vv
    <module-type>war</module-type>
    <source-path>/mysite/vv/vv2.0</source-path>
    <security-dd-model>DDOnly</security-dd-model>
  </app-deployment>

修改成:

  <app-deployment>
    <name>vv2</name>
    <target>vv</target>#修改成只有vv
    <module-type>war</module-type>
    <source-path>/mysite/vv/vv2.0</source-path>
    <security-dd-model>DDOnly</security-dd-model>
  </app-deployment>

 

这样,多个不同域名链接到不同应用并都设置了contextRoot为根/的时候;各应用能正确启动并被不同域名访问;

==================================================

有应用需要从weblogic8.1迁移到weblogic9.2

结果 登录,注册按钮总是404;apache是配置正确的;

访问的时候多加一层目录也能请求到,比如:

http://www.999.com.cn/666_index/index.jsp

http://www.999.com.cn/www/666_index/index.jsp

 

于是修改应用目录/999/www/www/WEB-INF/下的weblogic.xml

添加

<?xml version="1.0" encoding="UTF-8"?> <weblogic-web-app>     <context-root>/www</context-root>     </weblogic-web-app>

 

<?xml version="1.0" encoding="UTF-8"?> <weblogic-web-app>     <context-root>/</context-root>     </weblogic-web-app>

 

后来发现根/被 另外一个域名抢占了,比如:

/999/gg/gg2.0/WEB-INF/下也有weblogic.xml,其中也有定义使用/

 

==================

 

控制台里Virtual Hosts的配置部分有:

Virtual Host Names:

 

Network Access Point Name:

 

 

结论:只和contextRoot相关;和virtual host names  network access point name无关;

 

修改为产品模式(另一种是开发模式)

Home > Summary of Servers > AdminServer > base_domain

Configuration->

  General  
true

################################################################################################

下面是一些参考资料:

http://blog.csdn.net/z69183787/article/details/8592950

在 Weblogic控制台中,Admin Console -> Servers -> DefaultServer(admin) -> Protocols -> HTTP -> Default WebApp Context Root:

 

修改为Web应用的 Java EE Web Context Root,保存,不需要重启Weblogic。

 

 

http://crazycat03.iteye.com/blog/444884

///配置文件信息

\bea\user_projects\domains\test_domain\config

<virtual-host>
    <name>def</name>
    <target>AdminServer</target>
    <virtual-host-name>def.yourname.com</virtual-host-name>
  </virtual-host>
  <virtual-host>
    <name>www</name><!--主工程-->
    <target>AdminServer</target>
    <virtual-host-name>www.yourname.com</virtual-host-name>
  </virtual-host>

 <app-deployment>
    <name>abc</name>
    <target>www</target>
    <module-type>war</module-type>
    <source-path>D:\workspace\abc\WebRoot</source-path>
    <security-dd-model>DDOnly</security-dd-model>
  </app-deployment>
  <app-deployment>
    <name>def</name>
    <target>def</target>
    <module-type>war</module-type>
    <source-path>D:\workspace\def\WebRoot</source-path>
    <security-dd-model>DDOnly</security-dd-model>
  </app-deployment>

 

 

=============================

或者修改服务的启动文件或者commenv文件,增加set PRODUCTION_MODE=true.

 

就是这一段
@rem Set Production Mode.   When set to true, the server starts up in production mode.   When
@rem set to false, the server starts up in development mode.   The default is false.
set STARTMODE=true

http://blog.csdn.net/wlzjsj/article/details/7731861

开发模式修改成生产模式,可以从weblogic控制台中修改,重启即可生效

但是反过来从生产模式修改成开发模式是不可以从控制台中修改的,需要修改相关配置文件和启动脚本:
以下仅供参考,有待进一步验证
环境 weblogic92

1、修改启动脚本XX_domain\bin\startWebLogic.cmd
找到如下行,然后在此行前增加一行内容set PRODUCTION_MODE="quxt"
if "%PRODUCTION_MODE%"=="true" (
修改后如下:
set PRODUCTION_MODE="quxt"
if "%PRODUCTION_MODE%"=="true" (

2、修改config下的config.xml,找到并删除如下内容
<production-mode-enabled>true</production-mode-enabled>

 

 

http://blog.csdn.net/sytigeryhl/article/details/3430177

两个项目同时部署到了一台weblogic服务器的同一个域 myweb 下面

并在控制台中配置了2个虚拟主机 web1 和 web2 ,Virtual Host Names分别对应两个域名

project1 和 project2 的 WEB-INF 目录下的 weblogic.xml 文件(内容一样):

 

<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">  
<weblogic-web-app>
<jsp-descriptor>
    <jsp-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </jsp-param>
    <jsp-param>
         <param-name>compilerSupportsEncoding</param-name>
         <param-value>true</param-value>
    </jsp-param>
  </jsp-descriptor>
  <context-root>/</context-root>
</weblogic-web-app>

 

 

 

域 myweb  的 config 目录下的 config.xml 文件:

<?xml version='1.0' encoding='UTF-8'?>
<domain xmlns="http://www.bea.com/ns/weblogic/920/domain" xmlns:sec="http://www.bea.com/ns/weblogic/90/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90/security/xacml http://www.bea.com/ns/weblogic/90/security/xacml.xsd http://www.bea.com/ns/weblogic/90/security http://www.bea.com/ns/weblogic/90/security.xsd http://www.bea.com/ns/weblogic/920/domain http://www.bea.com/ns/weblogic/920/domain.xsd http://www.bea.com/ns/weblogic/90/security/wls http://www.bea.com/ns/weblogic/90/security/wls.xsd">
  <name>myweb</name>
  <domain-version>9.2.0.0</domain-version>
  <security-configuration>
    <name>myweb</name>
    <realm>
      <sec:authentication-provider xsi:type="wls:default-authenticatorType"></sec:authentication-provider>
      <sec:authentication-provider xsi:type="wls:default-identity-asserterType">
        <sec:active-type>AuthenticatedUser</sec:active-type>
      </sec:authentication-provider>
      <sec:role-mapper xmlns:xac="http://www.bea.com/ns/weblogic/90/security/xacml" xsi:type="xac:xacml-role-mapperType"></sec:role-mapper>
      <sec:authorizer xmlns:xac="http://www.bea.com/ns/weblogic/90/security/xacml" xsi:type="xac:xacml-authorizerType"></sec:authorizer>
      <sec:adjudicator xsi:type="wls:default-adjudicatorType"></sec:adjudicator>
      <sec:credential-mapper xsi:type="wls:default-credential-mapperType"></sec:credential-mapper>
      <sec:cert-path-provider xsi:type="wls:web-logic-cert-path-providerType"></sec:cert-path-provider>
      <sec:cert-path-builder>WebLogicCertPathProvider</sec:cert-path-builder>
      <sec:name>myrealm</sec:name>
    </realm>
    <default-realm>myrealm</default-realm>
    <credential-encrypted>{3DES}4UdT68Z06xRn4qZ18yDNkjqqgAGtQzmrzjCKMCGczlnByRq/AHqr65PQ56bjoholvKVy8kc0Ovd9IYBpYAjYkCdY4kDKxWtZ</credential-encrypted>
    <node-manager-username>myweb</node-manager-username>
    <node-manager-password-encrypted>{3DES}edeVCH+SZ7E3E2p8NC6q7Q==</node-manager-password-encrypted>
  </security-configuration>
  <server>
    <name>AdminServer</name>   
    <ssl>
      <enabled>false </enabled>
    </ssl>
    <listen-address></listen-address>
  </server>
  <embedded-ldap>
    <name>myweb</name>
    <credential-encrypted>{3DES}uo89S01vWPfXXxWr+KTuUVOoOzQTkN/P/jJd2QIOpVU=</credential-encrypted>
  </embedded-ldap>
  <configuration-version>9.2.0.0</configuration-version>
  <app-deployment>
    <name>project1</name>
    <target>web1</target>
    <module-type>war</module-type>
    <source-path>autodeploy/project1</source-path>
    <security-dd-model>DDOnly</security-dd-model>
  </app-deployment>
  <app-deployment>
    <name>project2</name>
    <target>web2</target>
    <module-type>war</module-type>
    <source-path>autodeploy/project2</source-path>
    <security-dd-model>DDOnly</security-dd-model>
  </app-deployment>
  <virtual-host>
    <name>web1</name>
    <target>AdminServer</target>
    <web-server-log>
      <number-of-files-limited>false</number-of-files-limited>
    </web-server-log>
    <virtual-host-name>www.a.com</virtual-host-name>
  </virtual-host>
  <virtual-host>
    <name>web2</name>
    <target>AdminServer</target>
    <web-server-log>
      <number-of-files-limited>false</number-of-files-limited>
    </web-server-log>
    <virtual-host-name>www.b.com</virtual-host-name>
  </virtual-host>
  <admin-server-name>AdminServer</admin-server-name>
  <jdbc-system-resource>
    <name>mywebDB</name>
    <target>AdminServer</target>
    <descriptor-file-name>jdbc/mywebDB-6667-jdbc.xml</descriptor-file-name>
  </jdbc-system-resource>
</domain>
重启服务器即可。

 

 

你可能感兴趣的:(weblogic)