Weblogic创建新域
查看weblogic环境变量
bash-4.2$ echo $MW_HOME bash-4.2$ |
为空说明并没有域,我们创建完后,再次查看,如果有就表示配置成功
设置环境变量
bash-4.2$ cat ~/.bashrc cat: /home/weblogic//.bashrc: 没有那个文件或目录 |
如果没有这个文件或者目录,我们就自己创建
bash-4.2$ vi ~/.bashrc # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # User specific aliases and functions export MW_HOME="/home/weblogic12/wls_12c" export WL_HOME="/home/weblogic12/wls_12c/oracle_common" |
创建完毕后设置完执行 source ~/.bashrc
bash-4.2$ source ~/.bashrc [weblogic@localhost /]$ echo $MW_HOME /home/weblogic12/wls_12c |
创建自定义domain的文件夹路径
[weblogic@localhost ~]$ mkdir -p /home/weblogic12/wls_12c/user_projects/domains/base_domain/ |
进入weblogic中的common的bin目录下
[weblogic@localhost /]$ cd /home/weblogic12/wls_12c/wlserver/common/bin/ [weblogic@localhost bin]$ pwd /home/weblogic12/wls_12c/wlserver/common/bin |
运行wlst.sh 开始设置域,在bin目录下
[weblogic@localhost bin]$ ./wlst.sh WARNING: This is a deprecated script. Please invoke the wlst.sh script under oracle_common/common/bin. Initializing WebLogic Scripting Tool (WLST) ... Jython scans all the jar files it can find at first startup. Depending on the system, this process may take a few minutes to complete, and WLST may not return a prompt right away. Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands wls:/offline> readTemplate('/home/weblogic12/wls_12c/wlserver/common/templates/wls/wls.jar') 警告: readTemplate 已过时。在 selectTemplate 后请使用 loadTemplates 以取代 readTemplate。 wls:/offline/base_domain>cd('Servers/AdminServer') wls:/offline/base_domain/Server/AdminServer>set('ListenAddress','') wls:/offline/base_domain/Server/AdminServer>set('ListenPort', 7201) wls:/offline/base_domain/Server/AdminServer>cd('../..') wls:/offline/base_domain>cd('Security/base_domain/User/weblogic') wls:/offline/base_domain/Security/base_domain/User/weblogic>cmo.setPassword('weblogic123') wls:/offline/base_domain/Security/base_domain/User/weblogic>setOption('OverwriteDomain', 'true') wls:/offline/base_domain/Security/base_domain/User/weblogic>writeDomain('/home/weblogic12/wls_12c/user_projects/domains/base_domain') wls:/offline/base_domain/Security/base_domain/User/weblogic>closeTemplate() wls:/offline>exit() Exiting WebLogic Scripting Tool. [weblogic@localhost bin]$ |
备注
1.只需要输入 wls:…>后边的命令就行了 2.set(‘ListenAddress’,’’) 这个我默认为空,不设置也可以 3.set(‘ListenPort’, 7001) welogic域监听的端口号,修改成自己想要设置的 4.cmo.setPassword(‘weblogic123’) 设置域的登录密码 5.writeDomain(’/home/weblogic12/wls_12c/user_projects/domains/base_domain’) 设置上边新建的目录为新建域的工作目录 6.其他的基本是固定 |
设置完成后看base_domain目录下的文件,有很多文件这说明成功
[weblogic@localhost bin]$ cd /home/weblogic12/wls_12c/user_projects/domains/base_domain/ [weblogic@localhost base_domain]$ ls autodeploy config init-info resources startWebLogic.sh bin console-ext lib security common fileRealm.properties nodemanager servers [weblogic@localhost base_domain]$ |
启动
方式一,按ctrl +c服务停止。
[weblogic@localhost base_domain]$ sh startWebLogic.sh |
方式二,将启动日志写入到nohup.out文件中
[weblogic@localhost base_domain]$ nohup sh startWebLogic.sh & [1] 7149 [weblogic@localhost base_domain]$ nohup: 忽略输入并把输出追加到"nohup.out" |
查看日志
[weblogic@localhost base_domain]$ tail -1000f nohup.out |
查看服务
[weblogic@localhost base_domain]$ ps -ef|grep java |
停止服务
[weblogic@localhost base_domain]$ kill -9 7200 |
登录管理后台
http://127.0.0.1:7001/console/
输入设置的用户名 weblogic 密码 weblogic123 即可。