Weblogic 9.1.x 配置秘笈

 
环境:
BEA Weblogic 9.1 简体中文企业版
Windows Server 2003 Stand Edition 简体中文版
一、weblogic域的定义
一般通过配置向导就可以轻松创建,并配置好数据库的连接池等。假如,我现在通过向导配置了一个域:C:\bea\user_projects\domains\topicms_ora_wl9,同weblogic 8.1.x一样,我们同样会在这个文件夹里面有找到连个文件startWebLogic.cmd(weblogic应用启动文件),但是“兔子已经不再窝里窝了”,哈哈,这个配置文件是个大忽悠,不用理他!真正的环境配置文件在bin目录下的setDomainEnv.cmd里面配置。后面会重点讲解如何配置它的。
二、weblogic数据源
当通过向导配置了域之后,一般还需要配置数据源。还需要进入控制台
[url]http://localhost:7001/console[/url] 去配置数据源和别的一些配置项。配置过程和8.x差不多,在9下也有个config.xml文件,但是其含义已经不再是8那么理解了,通过手动改config.xml文件一般没有作用,一切的配置还是要通过控制台。这是weblogic9更傻瓜或者对我来说更傻X的地方!所以,配置好了后,就别乱改config.xml了,已经没有意义了。
 
三、配置setDomainEnv.cmd
weblogic9留下给用户可以手动修改的文件,最主要的就是setDomainEnv.cmd这个了,从这个文件名看看就就知道这个是干什么活的了,呵呵,set(设置)Domain(域)Env(环境),其实就是设置你应用的运行环境,这里包括对第三方包的配置。调试端口的配置等等。我给出我配置好的例子,并用高亮颜色区别开来,一看你就直到怎么搞了。
---------------------------
@ECHO OFF
@REM WARNING: This file is created by the Configuration Wizard.
@REM Any changes to this script may be lost when adding extensions to this configuration.
@REM *************************************************************************
@REM This script is used to setup the needed environment to be able to start Weblogic Server in this domain.
@REM
@REM This script initializes the following variables before calling commEnv to set other variables:
@REM
@REM WL_HOME         - The BEA home directory of your WebLogic installation.
@REM JAVA_VM         - The desired Java VM to use. You can set this environment variable before calling
@REM                   this script to switch between Sun or BEA or just have the default be set.
@REM JAVA_HOME       - Location of the version of Java used to start WebLogic
@REM                   Server. Depends directly on which JAVA_VM value is set by default or by the environment.
@REM USER_MEM_ARGS   - The variable to override the standard memory arguments
@REM                   passed to java.
@REM PRODUCTION_MODE - The variable that determines whether Weblogic Server is started in production mode.
@REM DOMAIN_PRODUCTION_MODE
@REM                 - The variable that determines whether the workshop related settings like the debugger,
@REM                   testconsole or iterativedev should be enabled. ONLY settable using the
@REM                   command-line parameter named production
@REM                   NOTE: Specifying the production command-line param will force
@REM                          the server to start in production mode.
@REM
@REM Other variables used in this script include:
@REM SERVER_NAME     - Name of the weblogic server.
@REM JAVA_OPTIONS    - Java command-line options for running the server. (These
@REM                   will be tagged on to the end of the JAVA_VM and
@REM                   MEM_ARGS)
@REM
@REM For additional information, refer to the WebLogic Server Administration
@REM Console Online Help([url]http://e-docs.bea.com/wls/docs91/ConsoleHelp/startstop.html[/url]).
@REM *************************************************************************
set WL_HOME=C:\bea\weblogic91
for %%i in ("%WL_HOME%") do set WL_HOME=%%~fsi
set BEA_JAVA_HOME=C:\bea\jrockit90_150_04
set SUN_JAVA_HOME=C:\jdk1.5.0_05
if "%JAVA_VENDOR%"=="BEA" (
 set JAVA_HOME=%BEA_JAVA_HOME%
) else (
 if "%JAVA_VENDOR%"=="Sun" (
  set JAVA_HOME=%SUN_JAVA_HOME%
 ) else (
  set JAVA_VENDOR=Sun
  set JAVA_HOME=C:\bea\jdk150_04
 )
)
@REM We need to reset the value of JAVA_HOME to get it shortened AND
@REM we can not shorten it above because immediate variable expansion will blank it
set JAVA_HOME=%JAVA_HOME%
for %%i in ("%JAVA_HOME%") do set JAVA_HOME=%%~fsi
set SAMPLES_HOME=%WL_HOME%\samples
set DOMAIN_HOME=C:\bea\user_projects\domains\topicms_ora_wl9
for %%i in ("%DOMAIN_HOME%") do set DOMAIN_HOME=%%~fsi
set LONG_DOMAIN_HOME=C:\bea\user_projects\domains\topicms_ora_wl9
if "%DEBUG_PORT%"=="" (
 set DEBUG_PORT=8453
)
if "%SERVER_NAME%"=="" (
 set SERVER_NAME=AdminServer
)
set POINTBASE_FLAG=false
set instrumentFlag=
set PRODUCTION_MODE=
set doExitFlag=false
set verboseLoggingFlag=false
for %%p in (%*) do call :SET_PARAM %%p
GOTO :CMD_LINE_DONE
 :SET_PARAM
 for %%q in (%1) do set noQuotesParam=%%~q
 if /i "%noQuotesParam%" == "nodebug" (
  set debugFlag=false
  GOTO :EOF
 )
 if /i "%noQuotesParam%" == "production" (
  set DOMAIN_PRODUCTION_MODE=true
  GOTO :EOF
 )
 if /i "%noQuotesParam%" == "notestconsole" (
  set testConsoleFlag=false
  GOTO :EOF
 )
 if /i "%noQuotesParam%" == "noiterativedev" (
  set iterativeDevFlag=false
  GOTO :EOF
 )
 if /i "%noQuotesParam%" == "noLogErrorsToConsole" (
  set logErrorsToConsoleFlag=false
  GOTO :EOF
 )
 if /i "%noQuotesParam%" == "nopointbase" (
  set POINTBASE_FLAG=false
  GOTO :EOF
 )
 if /i "%noQuotesParam%" == "doExit" (
  set doExitFlag=true
  GOTO :EOF
 )
 if /i "%noQuotesParam%" == "noExit" (
  set doExitFlag=false
  GOTO :EOF
 )
 if /i "%noQuotesParam%" == "verbose" (
  set verboseLoggingFlag=true
  GOTO :EOF
 )
 if /i "%noQuotesParam%" == "instrumentAll" (
  set instrumentFlag=all
  GOTO :EOF
 )
 if /i "%noQuotesParam%" == "instrumentApps" (
  set instrumentFlag=apps
  GOTO :EOF
 ) else (
  set PROXY_SETTINGS=%PROXY_SETTINGS% %1
 )
 GOTO :EOF
:CMD_LINE_DONE

if NOT "%instrumentFlag%"=="" (
 set instrumentFlag=-Dweblogic.diagnostics.instrumentation=%instrumentFlag%
)
set MEM_DEV_ARGS=
if "%DOMAIN_PRODUCTION_MODE%"=="true" (
 set PRODUCTION_MODE=%DOMAIN_PRODUCTION_MODE%
)
if "%PRODUCTION_MODE%"=="true" (
 set debugFlag=false
 set testConsoleFlag=false
 set iterativeDevFlag=false
)
@REM If you want to override the default Patch Classpath, Library Path and Path for this domain,
@REM Please uncomment the following lines and add a valid value for the environment variables
@REM set PATCH_CLASSPATH=[myPatchClasspath] (windows)
@REM set PATCH_LIBPATH=[myPatchLibpath] (windows)
@REM set PATCH_PATH=[myPatchPath] (windows)
@REM PATCH_CLASSPATH=[myPatchClasspath] (unix)
@REM PATCH_LIBPATH=[myPatchLibpath] (unix)
@REM PATCH_PATH=[myPatchPath] (unix)
call "%WL_HOME%\common\bin\commEnv.cmd"
set WLS_HOME=%WL_HOME%\server
set WLI_HOME=%WL_HOME%\integration
set MEM_ARGS=-Xms256m -Xmx512m
if "%JAVA_VENDOR%"=="Sun" (
 if "%PRODUCTION_MODE%"=="" (
  set MEM_DEV_ARGS=-XX:CompileThreshold=8000 -XX:PermSize=48m
 )
)
@REM Had to have a separate test here BECAUSE of immediate variable expansion on windows
if "%JAVA_VENDOR%"=="Sun" (
 set MEM_ARGS=%MEM_ARGS% %MEM_DEV_ARGS% -XX:MaxPermSize=128m
)
if "%JAVA_VENDOR%"=="HP" (
 set MEM_ARGS=%MEM_ARGS% -XX:MaxPermSize=128m
)
@REM IF USER_MEM_ARGS the environment variable is set, use it to override ALL MEM_ARGS values
if NOT "%USER_MEM_ARGS%"=="" (
 set MEM_ARGS=%USER_MEM_ARGS%
)
set JAVA_PROPERTIES=-Dplatform.home=%WL_HOME% -Dwls.home=%WLS_HOME% -Dwli.home=%WLI_HOME%
@REM  To use Java Authorization Contract for Containers (JACC) in this domain,
@REM  please uncomment the following section. If there are multiple machines in
@REM  your domain, be sure to edit the setDomainEnv in the associated domain on
@REM  each machine.
@REM
@REM -Djava.security.manager
@REM -Djava.security.policy=location of weblogic.policy
@REM -Djavax.security.jacc.policy.provider=weblogic.security.jacc.simpleprovider.SimpleJACCPolicy
@REM -Djavax.security.jacc.PolicyConfigurationFactory.provider=weblogic.security.jacc.simpleprovider.PolicyConfigurationFactoryImpl
@REM -Dweblogic.security.jacc.RoleMapperFactory.provider=weblogic.security.jacc.simpleprovider.RoleMapperFactoryImpl
set JAVA_PROPERTIES=%JAVA_PROPERTIES% %EXTRA_JAVA_PROPERTIES%
set ARDIR=%WL_HOME%\server\lib
pushd %LONG_DOMAIN_HOME%
@REM Clustering support (edit for your cluster!)
if "%ADMIN_URL%"=="" (
 @REM The then part of this block is telling us we are either starting an admin server OR we are non-clustered
 set CLUSTER_PROPERTIES=-Dweblogic.management.discover=true -Dweblogic.ProductionModeEnabled=%PRODUCTION_MODE%
) else (
 set CLUSTER_PROPERTIES=-Dweblogic.management.discover=false -Dweblogic.management.server=%ADMIN_URL%
)
if NOT "%LOG4J_CONFIG_FILE%"=="" (
 set JAVA_PROPERTIES=%JAVA_PROPERTIES% -Dlog4j.configuration=file:%LOG4J_CONFIG_FILE%
)
set JAVA_PROPERTIES=%JAVA_PROPERTIES% %CLUSTER_PROPERTIES%
@REM Clear the pre_classpath here in case an application template wants to set it before the larger pre_classpath is invoked below

set PRE_CLASSPATH=%PRE_CLASSPATH%;C:\bea\user_projects\domains\topicms_ora_wl9\lib\log
set PRE_CLASSPATH=%PRE_CLASSPATH%;C:\bea\user_projects\domains\topicms_ora_wl9\lib\log4j-1.2.8.jar
set -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
set JAVA_DEBUG=
if "%debugFlag%"=="true" (
 set JAVA_DEBUG=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=%DEBUG_PORT%,server=y,suspend=n -Djava.compiler=NONE
 set JAVA_OPTIONS=%JAVA_OPTIONS% %instrumentFlag% -ea -da:com.bea... -da:javelin... -da:weblogic... -ea:com.bea.wli... -ea:com.bea.broker... -ea:com.bea.sbconsole...
) else (
 set JAVA_OPTIONS=%JAVA_OPTIONS% %instrumentFlag% -da
)
if NOT exist %JAVA_HOME%\lib (
 echo The JRE was not found in directory %JAVA_HOME%. ^(JAVA_HOME^)
 echo Please edit your environment and set the JAVA_HOME
 echo variable to point to the root directory of your Java installation.
 popd
 pause
 GOTO :EOF
)
if "%POINTBASE_FLAG%"=="true" (
 set DATABASE_CLASSPATH=%POINTBASE_CLASSPATH%
) else (
 set DATABASE_CLASSPATH=%POINTBASE_CLIENT_CLASSPATH%
)
set POST_CLASSPATH=
set POST_CLASSPATH=%POST_CLASSPATH%;%DATABASE_CLASSPATH%;%ARDIR%\xqrl.jar
@REM PROFILING SUPPORT
set JAVA_PROFILE=
set SERVER_CLASS=weblogic.Server
set JAVA_PROPERTIES=%JAVA_PROPERTIES% %WLP_JAVA_PROPERTIES%
set JAVA_OPTIONS=%JAVA_OPTIONS% %JAVA_PROPERTIES% -Dwlw.iterativeDev=%iterativeDevFlag% -Dwlw.testConsole=%testConsoleFlag% -Dwlw.logErrorsToConsole=%logErrorsToConsoleFlag%
@REM -- Setup properties so that we can save stdout and stderr to files
if NOT "%WLS_STDOUT_LOG%"=="" (
 echo Logging WLS stdout to %WLS_STDOUT_LOG%
 set JAVA_OPTIONS=%JAVA_OPTIONS% -Dweblogic.Stdout=%WLS_STDOUT_LOG%
)
if NOT "%WLS_STDERR_LOG%"=="" (
 echo Logging WLS stderr to %WLS_STDERR_LOG%
 set JAVA_OPTIONS=%JAVA_OPTIONS% -Dweblogic.Stderr=%WLS_STDERR_LOG%
)
@REM ADD EXTENSIONS TO CLASSPATHS
if NOT "%EXT_PRE_CLASSPATH%"=="" (
 set PRE_CLASSPATH=%EXT_PRE_CLASSPATH%;%PRE_CLASSPATH%
)
if NOT "%EXT_POST_CLASSPATH%"=="" (
 set POST_CLASSPATH=%POST_CLASSPATH%;%EXT_POST_CLASSPATH%
)
if NOT "%WEBLOGIC_EXTENSION_DIRS%"=="" (
 set JAVA_OPTIONS=%JAVA_OPTIONS% -Dweblogic.ext.dirs=%WEBLOGIC_EXTENSION_DIRS%
)
set JAVA_OPTIONS=%JAVA_OPTIONS%
@REM SET THE CLASSPATH
set CLASSPATH=%PRE_CLASSPATH%;%WEBLOGIC_CLASSPATH%;%POST_CLASSPATH%;%WLP_POST_CLASSPATH%;%WL_HOME%\integration\lib\util.jar
set JAVA_VM=%JAVA_VM% %JAVA_DEBUG% %JAVA_PROFILE%
---------------------------
 
四、部署你的应用程序
将你的war、ear包复制到autodeploy目录下面。然后启动weblogic,看看是否部署成功。如果没有,你还需要进入控制台去查看各个应用等状态。并改变为活动状态即可。
五、启动weblogic
启动有三种方法,第一种是在开始菜单里面找你配置的域来启动;第二种是从你域目录下的startWebLogic.cmd文件来启动。第三种是从bin目录下的startWebLogic.cmd来启动。其实这三种启动的方式的实质都是一样的,直接或间接调用bin下面的startWebLogic.cmd这个文件!
注意:当你更换部署war、ear包时候,不要删除myserver文件夹,否则可能导致域毁坏。在8下却相反,你应该这么做,我人为这是bea又一个傻X的地方,产品没有一点过渡,用过8的人不一定能玩转9,应该向Tomcat、Java、Oracle、Mysql多学习,呵呵。。里面更多秘笈还等着你在实践中去发现。也欢迎你发现后告诉我;)

0

收藏

leizhimin

674篇文章,4293W+人气,97粉丝

Ctrl+Enter 发布

发布

取消

078772c84eb23213ea90f577d9316ce4.png
left-qr.jpg

扫一扫,领取大礼包

0

分享
qr-url?url=http%3A%2F%2Fblog.51cto.com%2Flavasoft%2F15871
leizhimin
noavatar_middle.gif
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值