1. 安装JDK软件
1.1)jdk版本选择
由于jdk编译出class文件是一个二进制文件,其中前四个字节是magic位,第五到第六个字节对应于minor和major。class文件的minor和major可以通过ultraedit或java自己编程工具来查看(javap -v [ServiceImpl.class] 或 javap -verbose [ServiceImpl.class] 使用时替换成自己编译出来的class文件即可)。
major | minor | Java platform version |
45 | 3 | 1.0 |
45 | 3 | 1.1 |
46 | 0 | 1.2 |
47 | 0 | 1.3 |
48 | 0 | 1.4 |
49 | 0 | 1.5 |
50 | 0 | 1.6 |
51 | 0 | 1.7 |
52 | 0 | 1.8 |
2. 安装weblogic软件
2.1)图形界面安装
若在第9步勾选自动配置向导,则会自动跳到域创建向导界面,如下:
配置控制台登录账号密码:
域模式选择:
配置监听端口和地址IP
2.2)字符界面安装
2.2.1)Create Response File
[ENGINE] Response File Version=1.0.0.0.0 [GENERIC] ORACLE_HOME=/ups/app/oracle/middleware INSTALL_TYPE=WebLogic Server MYORACLESUPPORT_USERNAME= MYORACLESUPPORT_PASSWORD=<SECURE VALUE> DECLINE_SECURITY_UPDATES=true SECURITY_UPDATES_VIA_MYORACLESUPPORT=false PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PWD=<SECURE VALUE> COLLECTOR_SUPPORTHUB_URL=
For Fusion Middleware Installer you need a response file like the following, saved as "${HOME}/fmw_infr.rsp".
[ENGINE] Response File Version=1.0.0.0.0 [GENERIC] ORACLE_HOME=/ups/app/oracle/middleware INSTALL_TYPE=Fusion Middleware Infrastructure MYORACLESUPPORT_USERNAME= MYORACLESUPPORT_PASSWORD=<SECURE VALUE> DECLINE_SECURITY_UPDATES=true SECURITY_UPDATES_VIA_MYORACLESUPPORT=false PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PWD=<SECURE VALUE> COLLECTOR_SUPPORTHUB_URL=
2.2.2)Oracle inventory location
vi /ups/software/oraInst.loc inventory_loc=/ups/app/oracle/oraInventory inst_group=oinstall
2.2.3)静默安装命令
# WLS $JAVA_HOME/bin/java -Xmx1024m -jar /ups/software/fmw_12.2.1.0.0_wls.jar -silent -responseFile ${HOME}/wls.rsp -invPtrLoc /ups/software/oraInst.loc # Infrastructure $JAVA_HOME/bin/java -Xmx1024m -jar /ups/software/fmw_12.2.1.0.0_infrastructure.jar -silent -responseFile ${HOME}/fmw_infr.rsp -invPtrLoc /ups/software/oraInst.loc
2.2.4)查看weblogic版本
. $WLS_HOME/server/bin/setWLSEnv.sh java weblogic.version
2.2.5)创建域
1)通过响应文件创建
vi ${HOME}/create_domain.rsp
read template from "/home/weblogic/oracle/wlserver/common/templates/wls/wls.jar"; set JavaHome "/usr/java/jdk1.8.0_121/"; set ServerStartMode "dev"; find Server "AdminServer" as AdminServer; set AdminServer.ListenAddress ""; set AdminServer.ListenPort "7001"; //set AdminServer.SSL.Enabled "true"; //set AdminServer.SSL.ListenPort "8002"; //We can directly create a new managed server. create Server "server_1" as server_1; set server_1.ListenAddress "192.168.50.85"; set server_1.ListenPort "7011"; //set server_1.SSL.Enabled "true"; //set server_1.SSL.ListenPort "8004″; //Create Machine create Machine "Machinename_1" as Machinename; //use templates default weblogic user find User "weblogic" as u1; set u1.password "weblogic123"; //create a new user create User "weblogic2" as u2; set u2.password "weblogic123"; write domain to "/home/weblogic/oracle/user_projects/domains/base_domain/"; // The domain name will be "base_domain" close template;
./config.sh -mode=silent -silent_script=${HOME}/create_domain.rsp -logfile=/tmp/creat_domain.log
2)通过wlst-tool创建
export MW_HOME="/bea" export WL_HOME="/bea/oracle_common" export CONFIG_JVM_ARGS='-Djava.security.egd=file:/dev/urandom' --执行该命令,避免创建域过慢 bash$ pwd /bea/wlserver/common/bin bash$ ./commEnv.sh bash$ ./wlst.sh Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in8.0 Initializing WebLogic Scripting Tool (WLST) ... Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands wls:/offline>readTemplate('/bea/wlserver/common/templates/wls/wls.jar') wls:/offline/base_domain>cd('Servers/AdminServer') wls:/offline/base_domain/Server/AdminServer>set('ListenAddress','') wls:/offline/base_domain/Server/AdminServer>set('ListenPort', 8080) 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('weblogic12') wls:/offline/base_domain/Security/base_domain/User/weblogic>setOption('OverwriteDomain', 'true') wls:/offline/base_domain/Security/base_domain/User/weblogic>writeDomain('/bea/user_projects/domains/hbintf_domain') closeTemplate() exit()
启动
$cd /bea/user_projects/domains/hbintf_domain $./startWeblogic.sh
3. 启动服务
3.1)启动服务-windows
找到WebLogic Server安装路径下的starWebLogic.cmd,双击启动,开启服务
cd C:AppsMiddlewarewls12user_projectsdomainsexample_domain
双击"starWebLogic.cmd"文件启动
--提示输入控制台账号和密码(生产模式)
4. 登录控制台窗口
在地址栏输入:http://win2012:7002/console,回车;进入WebLogic Server管理控制台登录界面,输入用户名、密码
登录成功后,进入WebLogic Server管理控制台主界面
5.配置
生产模式每次启动都需要输入管理员账号密码--解决措施
5.1)boot.properties方式
在域目录下securityboot.properties建立boot.properties文件。例:
username=weblogic
password=weblogic
此处只需要指定用户名与密码(对应你建立域时的用户名与密码)。而你也不用担心用户名密码的泄漏,在第一次启动Weblogic后,系统会自动对相关内容进行加密。
5.2)参数方式
在startWebLogic.cmd/sh中修改JAVA_OPTIONS参数:例:
windows下的startWebLogic.cmd:
JAVA_OPTIONS=%JAVA_OPTIONS% -Dweblogic.management.username=weblogic -Dweblogic.management.password=weblogic
linux/unix下的startWebLogic.sh
JAVA_OPTIONS="$JAVA_OPTIONS -Dweblogic.management.username=weblogic -Dweblogic.management.password=weblogic"
5.3)Windows环境下,将其注册为服务方式
cmd --> set MW_HOME=C:AppsMiddlewarewls12 set DOMAIN_NAME=example_domain set SERVER_NAME=AdminServer set USERDOMAIN_HOME=C:AppsMiddlewarewls12user_projectsdomainsexample_domain
installSvc.cmd
installSvc.cmd 执行过程
C:AppsMiddlewarewls12wlserverserverin>installSvc.cmd C:AppsMiddlewarewls12wlserverserverin>set CLASSPATH=C:JavaJDK18~1.0_1lib ools.jar;C:AppsMIDDLE~1wls12wlserverserverlibweblogic.jar;C:AppsMIDDLE~1wls12oracle_commonmodules et.sf.antcontrib_1.1.0.0_1-0b3libant-contrib.jar;C:AppsMIDDLE~1wls12wlservermodulesfeaturesoracle.wls.common.nodemanager.jar;C:AppsMIDDLE~1wls12wlserverserverin;C:JavaJDK18~1.0_1libdt.jar;C:JavaJDK18~1.0_1lib ools.jar *************************************************** * To start WebLogic Server, use the password * * assigned to the system user. The system * * username and password must also be used to * * access the WebLogic Server console from a web * * browser. * *************************************************** C:AppsMiddlewarewls12wlserverserverin>rem *** Set Command Line for service to execute within created JVM C:AppsMiddlewarewls12wlserverserverin>set CMDLINE="-server -Xms32m -Xmx200m -Xverify:none -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -classpath "C:JavaJDK18~1.0_1lib ools.jar;C:AppsMIDDLE~1wls12wlserverserverlibweblogic.jar;C:AppsMIDDLE~1wls12oracle_commonmodules et.sf.antcontrib_1.1.0.0_1-0b3libant-contrib.jar;C:AppsMIDDLE~1wls12wlservermodulesfeaturesoracle.wls.common.nodemanager.jar;C:AppsMIDDLE~1wls12wlserverserverin;C:JavaJDK18~1.0_1libdt.jar;C:JavaJDK18~1.0_1lib ools.jar" -Dweblogic.Name=AdminServer -Dweblogic.management.username= -Dweblogic.ProductionModeEnabled= -Djava.security.policy="C:AppsMIDDLE~1wls12wlserverserverlibweblogic.policy" weblogic.Server" C:AppsMiddlewarewls12wlserverserverin>rem *** Set up extrapath for win32and win64 platform separately C:AppsMiddlewarewls12wlserverserverin>set WLSVC_EXE_TO_USE=wlsvcx64 C:AppsMiddlewarewls12wlserverserverin>if "false" == "true" (set EXTRAPATH=C:AppsMIDDLE~1wls12wlserverserver ativewin32;C:AppsMIDDLE~1wls12wlserverserverin;C:JavaJDK18~1.0_1jrein;C:JavaJDK18~1.0_1in;C:AppsMIDDLE~1wls12wlserverserver ativewin32oci920_8 set WLSVC_EXE_TO_USE=wlsvc) C:AppsMiddlewarewls12wlserverserverin>if "false" == "true" ( set EXTRAPATH=C:AppsMIDDLE~1wls12wlserverserver ativewin64;C:AppsMIDDLE~1wls12wlserverserverin;C:JavaJDK18~1.0_1jrein;C:JavaJDK18~1.0_1in;C:AppsMIDDLE~1wls12wlserverserver ativewin64oci920_8 set WLSVC_EXE_TO_USE=wlsvc64 ) C:AppsMiddlewarewls12wlserverserverin>if "true" == "true" ( set EXTRAPATH=C:AppsMIDDLE~1wls12wlserverserver ativewinx64;C:AppsMIDDLE~1wls12wlserverserverin;C:JavaJDK18~1.0_1jrein;C:JavaJDK18~1.0_1in;C:AppsMIDDLE~1wls12wlserverserver ativewinx64oci920_8 set WLSVC_EXE_TO_USE=wlsvcx64 ) C:AppsMiddlewarewls12wlserverserverin>rem *** Install the service C:AppsMiddlewarewls12wlserverserverin>"C:AppsMIDDLE~1wls12wlserverserverinwlsvcx64" -install -svcname:"wlsvc example_domain_AdminServer" -svcdescription:""WebLogicServer"" -javahome:"C:JavaJDK18~1.0_1" -execdir:"C:AppsMiddlewarewls12user_projectsdomainsexample_domain" -maxconnectretries:"" -host:"" -port:"" -extrapath:"C:AppsMIDDLE~1wls12wlserverserver ativewinx64;C:AppsMIDDLE~1wls12wlserverserverin;C:JavaJDK18~1.0_1jrein;C:JavaJDK18~1.0_1in;C:AppsMIDDLE~1wls12wlserverserver ativewinx64oci920_8" -password:"" -cmdline:"-server -Xms32m -Xmx200m -Xverify:none -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -classpath "C:JavaJDK18~1.0_1lib ools.jar;C:AppsMIDDLE~1wls12wlserverserverlibweblogic.jar;C:AppsMIDDLE~1wls12oracle_commonmodules et.sf.antcontrib_1.1.0.0_1-0b3libant-contrib.jar;C:AppsMIDDLE~1wls12wlservermodulesfeaturesoracle.wls.common.nodemanager.jar;C:AppsMIDDLE~1wls12wlserverserverin;C:JavaJDK18~1.0_1libdt.jar;C:JavaJDK18~1.0_1lib ools.jar" -Dweblogic.Name=AdminServer -Dweblogic.management.username= -Dweblogic.ProductionModeEnabled= -Djava.security.policy="C:AppsMIDDLE~1wls12wlserverserverlibweblogic.policy" weblogic.Server"wlsvc example_domain_AdminServer installed. C:AppsMiddlewarewls12wlserverserverin>ENDLOCAL --# 启动服务 C:AppsMiddlewarewls12wlserverserverin> net start "wlsvc example_domain_AdminServer"
6. 通过控制台创建server
6.1)创建server
-- 先锁定并编辑
6.2)启动server0
cd C:AppsMiddlewarewls12user_projectsdomainsexample_domainin
startManagedWebLogic.cmd Server-0 http://192.168.10.143:7002
7.升级 OPatch
7.1)解压升级工具opatch
mv ${MW_HOME}/OPatch ${MW_HOME}/OPatch_$(date +%Y%m%d)
unzip -d ${MW_HOME} p6880880_132000_Generic.zip
cd /ups/software
unzip p22331568_122100_Generic.zip
7.2)配置环境变量
export PATH=/ups/software/OPatch:$PATH export PATH=$MW_HOME/OPatch:$PATH
export ORACLE_HOME=$MW_HOME
7.3 opatch命令
cd /ups/software/22331568 opatch apply -silent
7.4 检查版本
. $WLS_HOME/server/bin/setWLSEnv.sh java weblogic.version
8.启动与关闭脚本
The following scripts are useful. They assume the following.
A "boot.properies" file has been created for the AdminServer and the WLS_FORMS and WLS_REPORTS managed servers.
The node manager credentials have been set and saved, as described previously.
The database holding the repository is already started.
To start up the whole WebLogic and FRS stack, issue the following commands.
# Adjust paths and domain name to suit your installation. export ORACLE_BASE=/u01/app/oracle export MW_HOME=$ORACLE_BASE/product/12.2.1 export WLS_HOME=$MW_HOME/wlserver export WL_HOME=$WLS_HOME export DOMAIN_HOME=$ORACLE_BASE/config/domains/frsdomain export OHS_INST=$DOMAIN_HOME/config/fmwconfig/components/OHS/instances/ohs1 # Start NodeManager nohup $DOMAIN_HOME/bin/startNodeManager.sh > /dev/null 2>&1 & # Start WebLogic Domain nohup $DOMAIN_HOME/bin/startWebLogic.sh > /dev/null 2>&1 & sleep 60 # Start the managed Servers nohup $DOMAIN_HOME/bin/startManagedWebLogic.sh WLS_FORMS > /dev/null 2>&1 & nohup $DOMAIN_HOME/bin/startManagedWebLogic.sh WLS_REPORTS > /dev/null 2>&1 & # Start the web tier. $DOMAIN_HOME/bin/startComponent.sh ohs1 To stop the whole WebLogic and FRS stack, issue the following commands. # Adjust paths and domain name to suit your installation. export ORACLE_BASE=/u01/app/oracle export MW_HOME=$ORACLE_BASE/product/12.2.1 export WLS_HOME=$MW_HOME/wlserver export WL_HOME=$WLS_HOME export DOMAIN_HOME=$ORACLE_BASE/config/domains/frsdomain export OHS_INST=$DOMAIN_HOME/config/fmwconfig/components/OHS/instances/ohs1 # Stop the web tier. $DOMAIN_HOME/bin/stopComponent.sh ohs1 # Stop the managed Servers $DOMAIN_HOME/bin/stopManagedWebLogic.sh WLS_FORMS $DOMAIN_HOME/bin/stopManagedWebLogic.sh WLS_REPORTS # Stop WebLogic Domain $DOMAIN_HOME/bin/stopWebLogic.sh # Stop NodeManager $DOMAIN_HOME/bin/stopNodeManager.sh
注意事项:
1)jdk版本问题,导致执行安装无法进行--改用1.7版本jdk即可