1、安裝部署和配置weblogic 12c html
1.如今下載的爲wls_dev版本,沒有安裝界面,須要執行命令行進行安裝 java
這個版本很小,只有179MB web
http://www.oracle.com/technetwork/middleware/fusion-middleware/downloads/index.html shell
注: 有安裝界面的weblogic,無特殊配置通常一直下一步就能夠完成安裝,完成安裝後建立域也很簡單,這裏不詳細說明,網上安裝手冊有不少 tomcat
2.解壓wls1211_dev.zip 能夠看到README.txt文件 安全
主要安裝步驟內容以下: session
步驟很簡單,可是執行到configure.cmd時系統找不到指定路徑, oracle
解決方法:檢查JAVA_HOME ,把Program Files改成短文件名:Progra~1 app
安裝成功後創建weblogic域,這裏我執行了GUI安裝,見下面的紅字。一直下一步,中間會有設置域的用戶名密碼 ,域建好以後,目錄裏有了user_projects,到這個目錄下(mydomain爲你設置的域名稱) user_projects\domains\mydomain 而後 startWebLogic.cmd dom
域就啓動了,http://localhost:7001/console能夠進入控制檯對程序進行部署
1. Extract the contents of the zip to a directory. This directory is referred
to as MW_HOME (eg: /home/myhome/mywls).
2. Setup JAVA_HOME, JAVA_VENDOR, MW_HOME variables in the current shell as required
for the target platform.
Linux
$ export JAVA_HOME=/home/myhome/myjavahome
$ export MW_HOME=/home/myhome/mywls
Mac
$ export JAVA_HOME=
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
$ export USER_MEM_ARGS="-Xmx1024m -XX:MaxPermSize=256m"
$ export MW_HOME=/home/myhome/mywls
Windows
> set JAVA_HOME=C:\home\myhome\myjavahome
> set MW_HOME=C:\home\myhome\mywls
> set JAVA_VENDOR=[Sun|Oracle]
On Windows you must set JAVA_VENDOR to the JVM being used:
If using HotSpot, use "Sun"
If using JRockit, use "Oracle"
3. Run the installation configuration script in the MW_HOME directory.
This step is required to be run only once. If you move the installation to
another location/machine, you need to rerun this step.
Linux/Mac
$ . ./configure.sh
Windows
> configure.cmd
On Windows, this step retains the WLS environment settings for the current shell.
So, the next step can be omitted.
4. Setup WLS environment in the current shell.
Linux
$ . $MW_HOME/wlserver/server/bin/setWLSEnv.sh
Mac
$ . $MW_HOME/wlserver/server/bin/setWLSEnv.sh
Windows
> %MW_HOME%\wlserver\server\bin\setWLSEnv.cmd
5. Create a new WLS domain and start WLS.
It is recommended that you create domains outside the MW_HOME.
Linux
$ mkdir /home/myhome/mydomain
$ cd /home/myhome/mydomain
$ $JAVA_HOME/bin/java $JAVA_OPTIONS -Xmx1024m -XX:MaxPermSize=128m weblogic.Server
Mac
$ mkdir /home/myhome/mydomain
$ cd /home/myhome/mydomain
$ $JAVA_HOME/bin/java $JAVA_OPTIONS -Xmx1024m -XX:MaxPermSize=256m weblogic.Server
Windows
> mkdir C:\home\myhome\mydomain
> cd C:\home\myhome\mydomain
> %JAVA_HOME%\bin\java.exe %JAVA_OPTIONS% -Xmx1024m -XX:MaxPermSize=128m weblogic.Server
Once the domain is created, you can shutdown WLS and restart it with the
scripts provided in the newly created domain.
Note: You can also create the domain by invoking the GUI configuration
wizard (Run MW_HOME/wlserver/common/bin/config.[sh|cmd]).
6. If you already have an existing domain that you want to run with this
installation, edit the DOMAIN_HOME/bin/setDomainEnv.sh script and change the
WL_HOME to point to the new installation - ${MW_HOME}/wlserver/
Note: If the existing domain has samples configured, the server will issue
failures during startup as samples are not included in the zip distribution.
7. Start a browser and open up url - 'http://localhost:7001/console' to
administer the server.
8. If you need samples, evaluation database (Derby) or console help files for
for non-english locales, you can download the supplemental zip and extract
it under MW_HOME. Follow instructions in README_SUPP.txt to properly setup
Samples.
2、安裝部署war包
進入weblogic 控制檯後在部署功能中對程序進行安裝,如無其餘配置,直接下一步
安裝成功後,訪問,報錯 ——!! 發現是hibernate錯誤,原來是jar包衝突
以下解決:將lib下的antlr-2.7.6.jar拷貝到wlserver\server\lib下,修改user_projects\domains\mydomain\bin下的startWeblogic.cmd ,找到
set CLASSPATH=%SAVE_CLASSPATH%
改成(上下各加入了一個命令):
set PRE_CLASSPATH=%WL_HOME%\server\lib\antlr-2.7.6.jar;
set CLASSPATH=%SAVE_CLASSPATH%
set CLASSPATH=%PRE_CLASSPATH%;%CLASSPATH%
再次啓動,訪問成功!
3、weblogic12 的安全領域配置
以前在tomcat-user.xml裏配置了安全域,爲webservice訪問提供了basic authentication認證
如今移植到weblogic下,須要配置用戶和組,而且須要在web-inf下面添加一個weblogic.xml文件
Web.xml下的配置爲:
<security-role>
<description>DictWebService operator user</description>
<role-name>operator</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>Operator Roles Security</web-resource-name>
<url-pattern>/services/dictservice</url-pattern>
<url-pattern>/services/uploadservice</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>operator</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
Weblogic.xml文件的配置爲:
<?xml version='1.0' encoding='UTF-8'?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<session-descriptor></session-descriptor>
<jsp-descriptor>
</jsp-descriptor>
<container-descriptor></container-descriptor>
<servlet-descriptor>
<servlet-name>action</servlet-name>
</servlet-descriptor>
<charset-params>
<input-charset>
<resource-path>/*</resource-path>
<java-charset-name>UTF-8</java-charset-name>
</input-charset>
</charset-params>
<context-root>/</context-root>
<security-role-assignment>
<role-name>operator</role-name>
<principal-name>GspWebService</principal-name>
</security-role-assignment>
</weblogic-web-app>
其中role-name 對應web.xml中的role-name
Principal-name對應weblogic裏設置的用戶組
這樣在weblogic控制檯的安全領域裏設置相應的用戶和組,而且講用戶和組關聯,就能夠實現basic authentication了