Weblogic部署项目三种方式

来源:互联网 发布:富士施乐2011网络设置 编辑:程序博客网 时间:2024/05/16 18:35


    在weblogic中部署项目通常有三种方式:第一,在控制台中安装部署;第二,将部署包放在domain域中autodeploy目录下部署;第三,使用域中配置文件config.xml 进行项目的部署。


控制台部署


1  启动weblogic服务,登录到weblogic控制台页面,输入用户名和密码,登录到控制台里面


2  点击左侧的部署


3  在右侧点击安装按钮,准备进行项目安装


4  看到路径输入框,可以在下面选择要部署的项目的位置


5  也可以直接输入要部署的包的位置,敲回车


6  点击下一步即可


7  继续下一步


8  点击完成按钮


9   保存前面各步的设置


10  保存完成后,会看到激活更改的提示,且不需要重启。


11  这时便可以进行测试了,输入项目名称,看到了项目的欢迎页面,即项目部署成功。


如果前面的步骤操作完成了,但依然无法访问项目的话,可以参考下面的补充步骤

补充步骤

补1  点击部署,勾选上项目,点击启动


补2  待启动后,项目状态为活动,健康状况为OK时,继续测试。



autodeploy自动部署


自动部署时不需要登录控制台,在domain域的主目录下面有个autodeploy目录,直接将项目包拷贝到autodeploy目录下面就可以了。

autodeploy目录里面有个readme.txt 文档,打开看一下,这里摘第一段出来

This autodeploy directory provides a quick way to deploy applicationsto a development server. When the WebLogic Server instance is runningin development mode, applications and modules in this directory are automatically deployed.

主要说什么呢,就是开发模式下面,当weblogic启动时,会自动部署autodeploy目录下面的项目。


将部署包servletDemo.war 丢到autodeploy目录下面,启动startWeblogic.cmd ,进行servletDemo的访问,依然可以看到

欢迎页面。


config.xml配置文件部署


config.xml文件在domain域的config目录下面,config.xml主要配置了domain域的一些相关信息

我们要部署项目,该在哪里配置呢

<?xml version='1.0' encoding='UTF-8'?><domain xmlns="http://xmlns.oracle.com/weblogic/domain" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/security/xacml http://xmlns.oracle.com/weblogic/security/xacml/1.0/xacml.xsd http://xmlns.oracle.com/weblogic/security/providers/passwordvalidator http://xmlns.oracle.com/weblogic/security/providers/passwordvalidator/1.0/passwordvalidator.xsd http://xmlns.oracle.com/weblogic/domain http://xmlns.oracle.com/weblogic/1.0/domain.xsd http://xmlns.oracle.com/weblogic/security http://xmlns.oracle.com/weblogic/1.0/security.xsd http://xmlns.oracle.com/weblogic/security/wls http://xmlns.oracle.com/weblogic/security/wls/1.0/wls.xsd">  <name>base_domain</name>  <domain-version>12.1.3.0.0</domain-version>  <security-configuration>    <name>base_domain</name>    <realm>      <sec:authentication-provider xsi:type="wls:default-authenticatorType">        <sec:name>DefaultAuthenticator</sec:name>      </sec:authentication-provider>      <sec:password-validator xmlns:pas="http://xmlns.oracle.com/weblogic/security/providers/passwordvalidator" xsi:type="pas:system-password-validatorType">        <sec:name>SystemPasswordValidator</sec:name>        <pas:min-password-length>8</pas:min-password-length>        <pas:min-numeric-or-special-characters>1</pas:min-numeric-or-special-characters>      </sec:password-validator>    </realm>    <default-realm>myrealm</default-realm>    <credential-encrypted>{AES}xLPXh4gcT6JErTB+toxRZ1pQpAS+MGMuqnnXzu/OsxWMQTB8152ggdbUlhkSXUGC9f959oL7tIzyZiu9XdeajlkK9vAu9cQlCKLLUaUMyl5Ty4C0uuJA99b14eR7oIu4</credential-encrypted>    <node-manager-username>weblogic</node-manager-username>    <node-manager-password-encrypted>{AES}n3LLdgmAsocPRoYUrFfR2waWOlEz6KDFsp7+gByNeo8=</node-manager-password-encrypted>  </security-configuration>  <server>    <name>AdminServer</name>    <listen-address></listen-address>  </server>  <embedded-ldap>    <name>base_domain</name>    <credential-encrypted>{AES}21z8vCiCbuaYqsSj5t5+y6qvEY8dE3NdNr0zDG+K3EdwWEubzk9Vmx79Di43oxqX</credential-encrypted>  </embedded-ldap>  <configuration-version>12.1.3.0.0</configuration-version>  <admin-server-name>AdminServer</admin-server-name></domain>

我们的项目部署信息添加在configuration-version 和 admin-server-name 之间

<configuration-version>12.1.3.0.0</configuration-version>  <app-deployment>  <name>servletDemo</name>  <target>AdminServer</target>  <module-type>war</module-type>  <source-path>C:\Users\ZhangQi\Desktop\servletDemo</source-path>  <security-dd-model>DDOnly</security-dd-model>    </app-deployment>  <admin-server-name>AdminServer</admin-server-name>


刚开始进行config.xml 配置文件部署的时候,出现了404,修改了下配置就可以了

将部署的war包解压为文件夹的形式,然后

<module-type>war</module-type> 里面的war修改为 dir 即可

<app-deployment>  <name>servletDemo</name>  <target>AdminServer</target>  <module-type>dir</module-type>  <source-path>C:\Users\ZhangQi\Desktop\servletDemo</source-path><security-dd-model>DDOnly</security-dd-model><staging-mode>nostage</staging-mode>  </app-deployment>


然后启动weblogic服务即可。


三种部署方式都能达到部署项目的目的,至于三种部署方式的利弊,明天再说说吧。

今天太晚了,睡觉了,晚安!




3 0