linux上的weblogic8.15安装和jdbc以及web应用配置

linux下的weblogic8.15安装和jdbc以及web应用配置

 

 

系统环境:linux

weblogic8.15

jdk1.4.2

mysql jdbc驱动程序

 

 


1.安装weblogic

1.1 修改为可运行属性

chmod a+x platform815_linux32.bin

 
1.2 执行命令

./platform815_linux32.bin
 
<------------ BEA Installer - WebLogic Platform 8.1 SP5 ------------>
Welcome:
--------
This installer will guide you through the installation of WebLogic Platform 8.1 SP5. Type "Next" or enter to proceed to the next
prompt. If you want to change data entered previously, type "Previous". You may quit the installer at any time by typing "Exit".
Enter [Exit][Next]> Next
 
Select Option:
1 - Yes, I agree with the terms of the license
2 - No, I do not agree with the terms of the license
Enter option number to select OR [Down][Exit][Previous]> 1
 
Input new BEA Home OR [Exit][Previous][Next]> /usr/local/bea
 
<---------- BEA Installer - WebLogic Platform 8.1 SP5 ----------->
Choose BEA Home Directory:
--------------------------
*BEA home choice
->1|Yes, Use this BEA home directory [/usr/local/bea]
2|No, return to BEA home directory selection
Enter index number to select OR [Exit][Previous][Next]>1
 
<-------- BEA Installer - WebLogic Platform 8.1 SP5 ----------->
Choose Install Type:
--------------------
->1|Complete
|Install the complete BEA WebLogic Platform.
2|Custom Installation
|Choose software components to install and perform optional configuration.
Enter index number to select OR [Exit][Previous][Next]> 1
 
<--------- BEA Installer - WebLogic Platform 8.1 SP5 ---------->
Choose Product Directory:
-------------------------
"Product Installation Directory" = [/usr/local/bea/weblogic81]
Input new Product Installation Directory OR [Exit][Previous][Next]> Next
 
<--------- BEA Installer - WebLogic Platform 8.1 SP5 ----------->
Choose Product Directory:
-------------------------
->1|Yes, use this product directory [/usr/local/bea/weblogic81]
2|No, select another product directory
Enter index number to select OR [Exit][Previous][Next]> 1
 
Installation Complete
Congratulations! WebLogic Platform 8.1 SP5 has been successfully installed to /usr/local/bea/weblogic81.
Press any key to continue OR [Exit]>
 

至此安装完毕!

1.3 config.sh运行文件

 

/usr/local/bea/weblogic81/common/bin/config.sh
 
<------------ BEA WebLogic Configuration Wizard --------------->
Create or Extend a Configuration:
---------------------------------
Choose between creating and extending a configuration. Based on your selection, the Configuration Wizard guides you through the
steps to generate a new or extend an existing configuration.

->1|Create a new WebLogic configuration
| Start here to create a WebLogic configuration in your projects directory.

2|Extend an existing WebLogic configuration
| Start here to extend an existing WebLogic configuration. Use this option to add applications and services, including
|Database access (JDBC) and Messaging (JMS). This option also enables you to extend functionality by enabling WebLogic
|Workshop.
Enter index number to select OR [Exit][Next]> 1
 
<---------------- BEA WebLogic Configuration Wizard -------->
Select a Domain Template:
-------------------------
Please select a template from the list or select another directory of templates.
* [/usr/local/bea/weblogic81/common/templates/domains]

1|Basic WebLogic Integration Domain 8.1.5.0
| BEA Systems, Inc.
| Create a basic WebLogic Integration domain, without installing sample applications. Domains created from this template
|will support the WebLogic Server, WebLogic Workshop and WebLogic Integration runtime functionality, including support for J2EE |applications, Web applications, Web Services, custom controls and business processes. Use domains created from this template
|for development of WebLogic Integration applications.

2|Basic WebLogic Workshop Domain 8.1.5.0
| BEA Systems, Inc.
| Create a basic WebLogic Workshop domain, without installing sample applications. Domains created from this template will
|support the WebLogic Server and WebLogic Workshop runtime functionality, including support for J2EE applications, Web
|applications, Web Services and custom controls. Use domains created from this template for development of WebLogic Workshop
|applications.

->3|Basic WebLogic Server Domain 8.1.5.0
| BEA Systems, Inc.
| Create a basic WebLogic Server domain without installing sample applications.

4|Avitek Medical Records Sample Domain 8.1.5.0
| BEA Systems, Inc.
| Create the Avitek Medical Records domain in a directory outside of the installed kit. The Avitek Medical Records is a
|WebLogic Server sample application suite that concisely demonstrates all aspects of the J2EE platform.

5|Basic WebLogic Portal Domain 8.1.5.0
| BEA Systems, Inc.
| Create a basic WebLogic Portal domain, without installing sample applications. Domains created from this template will
|support the WebLogic Server, WebLogic Workshop and WebLogic Portal runtime functionality, including support for J2EE
|applications, Web applications, Web Services, custom controls and portals. Use domains created from this template for
|development of WebLogic Portal applications.
Enter index number to select OR [Down][Exit][Previous][Next]> 3
 
<------------- BEA WebLogic Configuration Wizard -------->
Choose Configuration Option:
----------------------------
*Do you want to run the wizard in express mode?
->1|Yes
2|No
Enter index number to select OR [Exit][Previous][Next]> 1
 
<---------- BEA WebLogic Configuration Wizard ------------->
Configure Administrative Username and Password:
-----------------------------------------------
Create a user automatically assigned to the Administrative Role. This user is the default administrator used to start development
mode servers.
| Name | Value |
_|_________________________|_________________________________|
1| *User name: | weblogic |
2| *User password: | |
3| *Confirm user password: | |
4| Description: | The default administration user |
Select Option:
1 - Modify "User name"
2 - Modify "User password"
3 - Modify "Confirm user password"
4 - Modify "Description"
Enter option number to select OR [Exit][Previous][Next]> 3

<-------- BEA WebLogic Configuration Wizard ---------->
Configure Administrative Username and Password:
-----------------------------------------------
Create a user automatically assigned to the Administrative Role. This user is the default administrator used to start development
mode servers.

user=root
pass=12345678
 
<--------- BEA WebLogic Configuration Wizard -------------->
Domain Mode Configuration:
--------------------------
Enable Development or Production Mode for this domain.
->1|Development Mode
2|Production Mode
Enter index number to select OR [Exit][Previous][Next]> 1
 
<-------- BEA WebLogic Configuration Wizard ------------>
Java SDK Selection:
-------------------
->1|JRockit SDK 1.4.2_08-8150 @ /usr/local/bea/jrockit81sp5_142_08
2|Sun SDK 1.4.2_08 @ /usr/local/bea/jdk142_08
3|Other Java SDK
Enter index number to select OR [Exit][Previous][Next]> 3
 
<------------ BEA WebLogic Configuration Wizard ------------>
Java SDK Selection:
-------------------
"JVM Directory" = []
Input new JVM Directory OR [Exit][Previous][Next]> /usr/local/jdk1.4.2

<--------- BEA WebLogic Configuration Wizard ----------------->
Java SDK Selection:
-------------------
"JVM Directory" = [/usr/local/jdk1.4.2]
Input new JVM Directory OR [Exit][Previous][Next]> Next
 
<------------- BEA WebLogic Configuration Wizard --------------->
Select the target domain directory for this configuration:
----------------------
"Target Location" = [/usr/local/bea/user_projects/domains]
Input new Target Location OR [Exit][Previous][Next]> Next
 

 

<------------- BEA WebLogic Configuration Wizard ----------->
Edit Domain Information:
------------------------
| Name | Value |
_|________|__________|
1| *Name: | mydomain |
Enter value for "Name" OR [Exit][Previous][Next]> Next
 

 

<--------- BEA WebLogic Configuration Wizard ------------>
Creating Domain...
0% 25% 50% 75% 100%
[------------|------------|------------|------------]
[***************************************************]
**** Domain Created Successfully! ****
 


1.4 运行启动脚本 startWebLogic.sh

/usr/local/bea/user_projects/domains/mydomain/startWebLogic.sh
 

1.5 进入weblogic管理界面

http://xxx.xxx.xxx.xxx:7001/console/
 

这里的用户名和密码就是前面在执行config.sh时候设置的.



2.配置数据库连接池
2.1 配置数据库驱动
修改weblogic安装目录下的配置文件 /usr/local/bea/user_projects/domains/mydomain/startWebLogic.sh
修改具体如下:

CLASSPATH="${WEBLOGIC_CLASSPATH}${CLASSPATHSEP}${POINTBASE_CLASSPATH}${CLASSPATHSEP}${JAVA_HOME}/jre/lib/rt.jar${CLASSPATHSEP}${WL_HOME}/server/lib/mysql-connector-java-3.1.11-bin.jar${CLASSPATHSEP}${WL_HOME}/server/lib/webservices.jar"
export CLASSPATH
 

其中的 ${CLASSPATHSEP}${WL_HOME}/server/lib/mysql-connector-java-3.1.11-bin.jar 就是要配置的mysql驱动。
另外必须把 mysql-connector-java-3.1.11-bin.jar 驱动文件复制到 /bea/weblogic81/server/lib 目录下

如果使用的是其他数据库,也类似操作.

2.2 创建数据库连接池
菜单 Services->JDBC->Connection Pools
点击上面的[Connection Pools] ,就可以看到当前已经存在的连接池列表,
选择 [Configure a new JDBC Connection Pool... ]来创建新的连接池。
------------------------------------------------

Database Type : 选择[MySQL]
Database Driver:选择[MySQL's Driver (Type 4) Versions:using com.mysql.jdbc.Driver]

 

------------------------------------------------
然后点[Continue]
------------------------------------------------

Name:MyJDBC Connection Pool //连接池名字,可以随便写
Database Name:new_itemgarden //要连接的数据库的database名
Host Name:localhost //数据库服务器的ip或者主机名,一般数据库和weblogic是同一台服务器,这里就写localhost
Port:3306 //mysql的数据库连接端口号一般就是3306
Database User Name:xxx //访问数据库的用户名
Password:yyy //访问数据库的用户名对应的密码
Confirm Password::yyy //访问数据库的用户名对应的密码

 

------------------------------------------------
然后点[Continue]

可以点 [Test Driver Configuration] 按钮测试下配置的连接池是否正确.

如果显示 [Connection successful] ,则表示配置正确,然后点 [Create and deploy]按钮来创建并发布连接池。

2.3 创建连接池Data Source
菜单 Services->JDBC->Data Sources
点击上面的[Data Sources] ,就可以看到当前已经存在的[Data Sources]列表,
选择 [Configure a new JDBC Data Source ]来创建新的Data Source。
------------------------------------------------

Name:new_itemgarden data source //Data Source名字 ,可以随便写
JNDI Name:new_itemgarden //jndi名字,此参数在web应用中被使用用来初始化数据库连接池,因此要注意保持一致。
 

------------------------------------------------
然后点[Continue]
------------------------------------------------
Pool Name:MyJDBC Connection Pool        //选择前面步骤创建的连接池名
------------------------------------------------
然后点[Continue]直到创建完毕.

注意:web应用中用于创建连接池的jndi名就是上面中配置的JNDI名称.
 


3.发布web应用
3.1 创建配置文件 weblogic.xml
需要在web应用的WEB-INF目录下增加配置文件 [weblogic.xml],具体内容如下:

<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">

<weblogic-web-app>

  <session-descriptor>
    <session-param>
      <param-name>TimeoutSecs</param-name>
      <param-value>3600</param-value>
    </session-param>
  </session-descriptor>

  <jsp-descriptor>
    <jsp-param>
      <param-name>compileFlags</param-name>
      <param-value>-g</param-value>
    </jsp-param>
    <jsp-param>
      <param-name>pageCheckSeconds</param-name>
      <param-value>10</param-value>
    </jsp-param>
    <jsp-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </jsp-param>
    <jsp-param>
      <param-name>printNulls</param-name>
      <param-value>false</param-value>
    </jsp-param>
    <jsp-param>
      <param-name>keepgenerated</param-name>
      <param-value>true</param-value>
    </jsp-param>
    <jsp-param>
      <param-name>workingDir</param-name>
      <param-value>new_itemgarden_app</param-value>
    </jsp-param>
  </jsp-descriptor>

  <container-descriptor>
    <servlet-reload-check-secs>30</servlet-reload-check-secs>
    <session-monitoring-enabled>true</session-monitoring-enabled>
  </container-descriptor>

  <context-root>/new_itemgarden</context-root>
</weblogic-web-app>
 


其中:

    <jsp-param>
      <param-name>workingDir</param-name>
      <param-value>new_itemgarden_app</param-value>
    </jsp-param>

参数[workingDir]指定web应用中的jsp文件编译后产生的class存放目录位置。如上设置的new_itemgarden_app,那么目录
就在你的weblogic安装目录下的/bea/user_projects/domains/workshop/new_itemgarden_app


<context-root>/new_itemgarden</context-root>
参数指定发布的web应用的访问方式. http://xxx.xxx.xxx.xxx:xxx/new_itemgarden

3.2 发布web应用

菜单 Deployments->Web Application Modules
点击上面的[Web Application Modules],就可以看到已经发布的web应用列表.
点击[Deploy a new Web Application Module... ],
----------------------------------
Location:选择web应用的目录(该目录下必须要有WEB-INF目录且有web.xml配置文件).
----------------------------------
选中选择的web目录,然后[Target Module].
----------------------------------
Name:new_itemgarden             //为你的这个web应用取个名字,可以随便写的
----------------------------------
然后点[Deploy]就可以发布了。

3.3 修改端口7001为80

weblogic默认的web访问端口为7001,需要修改成80端口方便访问.
菜单 Servers
在[Servers]下点击你的server名字,然后在
----------------------------------
Listen Port:   7001         //这里改成80
The default TCP port (between 1 and 65534) that this server uses to listen for regular (non-SSL) incoming connections. 
----------------------------------
然后点[Apply]就可以了


3.4 linux环境下图形输出的支持配置.


在weblogic的启动脚本 /bea/user_projects/domains/workshop/startWebLogic.sh的中加入配置“-Djava.awt.headless=true”。如下

---------------------------------------------

# START WEBLOGIC

echo "starting weblogic with Java version:"

${JAVA_HOME}/bin/java ${JAVA_VM} -version

if [ "${WLS_REDIRECT_LOG}" = "" ] ; then
echo "Starting WLS with line:"
echo "${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} ${JAVA_OPTIONS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${PROXY_SETTINGS} ${SERVER_CLASS}"
${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} ${JAVA_OPTIONS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy -Djava.awt.headless=true ${PROXY_SETTINGS} ${SERVER_CLASS}
else
echo "Redirecting output from WLS window to ${WLS_REDIRECT_LOG}"
${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} ${JAVA_OPTIONS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy -Djava.awt.headless=true ${PROXY_SETTINGS} ${SERVER_CLASS} > "${WLS_REDIRECT_LOG}" 2>&1
fi
 

附件中有weblogic(版本8,9,10)的license和key.

---------------------------------------------