免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
JBOSS3.x 學習筆記
userphoto

2005.10.09

關注
JBOSS3.x 學習筆記
作者:Thatway (outhatway@hotmail.com)
來自:http://www.hibernate.org.cn


目 錄

一. 運行環(huán)境 2
二. 準備工作 2
三. 安裝 2
四. 配置實例xPetStore 2
五. 結束語 8


一. 運行環(huán)境
操作系統(tǒng):Windows 2000
應用服務器:Jboss3.x
數(shù)據(jù)庫:MySQL4.x
虛擬機: SUN JDK1.4.x

二. 準備工作
1.請安裝JDK1.4.x版本,設置JAVA_HOME變量,并把“%JAVA_HOME%\bin”加入Path中。
2.請下載Jboss3.x。主站地址http://www.jboss.org/。
3.請下載并安裝MySQL4.x。主站地址http://www.mysql.org/。


三. 安裝
1. 把壓JBOSS下載文件解壓。本文假設解壓后路徑為C:\Work\jboss-3.2.2RC2。
2. 設置JBOSS_HOME變量。進行命令窗口,運行bin目錄下的run.bat命令。請注意后臺有沒有拋出異常。
3. 約半分鐘后啟動完畢,請訪問http://localhost:8080/jmx-console/。如果成功顯示頁面,說明安裝成功。
4. 進行命令窗口,運行bin目錄下的shutdown.bat -S命令可以停止JBOSS。


四. 配置實例xPetStore
1. 創(chuàng)建JBOSS“xpetstore”服務
在JBOSS_HOME/server/下新建目錄xpetstore,并把JBOSS_HOME/server/default下的內容拷貝到xpetstore下。

2. 配置JMS
Create JBOSS_HOME\server\xpetstore\deploy\jms\jbossmq-destinations-xpetstore-service.xml to create JMS queues queue/order and queue/mail.

This xml file should look like this:
java代碼: 


<?xml version="1.0" encoding="UTF-8"?>

<!-- $Id: jbossmq-destinations-xpetstore-service.xml,v 1.0 2003-8-11 15:47 et Exp $ -->

<server>
  <!-- Destination without a configured SecurityManager or without a
       a SecurityConf will default to role guest with read=true, write=true,
       create=false.
  -->

  <mbean code="org.jboss.mq.server.jmx.Queue"
        name="jboss.mq.destination:service=Queue,name=order">
    <attribute name="JNDIName">queue/order</attribute>
    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
  </mbean>
 
  <mbean code="org.jboss.mq.server.jmx.Queue"
        name="jboss.mq.destination:service=Queue,name=mail">
    <attribute name="JNDIName">queue/mail</attribute>
    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
  </mbean>

</server>



3. 配置JDBC
Copy the JDBC driver to JBOSS_HOME/server/xpetstore/lib。
Rename JBOSS_HOME/server/xpetstore/deploy/hsqldb-ds.xml to mysql-ds.xml.
Edit mysql-ds.xml to create the datasource java:/xpetstoreDS。

JBOSS_HOME/server/xpetstore/deploy/mysql-ds.xml should look like this:
java代碼: 


<?xml version="1.0" encoding="UTF-8"?>

<!-- $Id: mysql-ds.xml,v 1.0 2003-8-11 15:56 et Exp $ -->


<datasources>
  <local-tx-datasource>
 
    <depends>jboss:service=Hypersonic</depends>
 
    <jndi-name>xpetstoreDS</jndi-name>
    <connection-url>jdbc:mysql://localhost/xpetstore</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>thatway</user-name>
    <password>thatway</password>
    <min-pool-size>5</min-pool-size>
    <security-domain>HsqlDbRealm</security-domain>
  </local-tx-datasource>

  <!-- this mbean should be used only when using tcp connections -->
  <mbean code="org.jboss.jdbc.HypersonicDatabase"
        name="jboss:service=Hypersonic">
    <attribute name="Port">1701</attribute>
    <attribute name="Silent">true</attribute>
    <attribute name="Database">default</attribute>
    <attribute name="Trace">false</attribute>
    <attribute name="No_system_exit">true</attribute>
  </mbean>
 
</datasources>



4. 配置JavaMail
Create the MailSesion java/:Mail.

Make sure that JBOSS_HOME/server/xpetstore/deploy/mail-service.xml look like this:
java代碼: 


<server>
  <classpath codebase="lib"
             archives="mail.jar, activation.jar, mail-plugin.jar"/>

  <mbean code="org.jboss.mail.MailService"
         name="jboss:service=Mail">
    <attribute name="JNDIName">Mail</attribute>
    <attribute name="User">your-user-name</attribute>
    <attribute name="Password">your-password</attribute>
    <attribute name="Configuration">
       <configuration>
          <property name="mail.store.protocol" value="pop3"/>
          <property name="mail.transport.protocol" value="smtp"/>
          <property name="mail.user" value="your-username"/>
          <property name="mail.pop3.host" value="your-pop3-host"/>
          <property name="mail.smtp.host" value="your-smtp-host"/>
          <property name="mail.from" value="noreply@xpetstore.sourceforge.net"/>
          <property name="mail.debug" value="false"/>
       </configuration>
    </attribute>
  </mbean>
</server>




5. 啟動JBOSS
cd JBOSS_HOME/bin
run.bat -c xpetstore

6. 指定xPetStore的應用服務器
Download and unzip the xpetstore3.1.x file.
Edit the file XPETSTORE_HOME/conf/as/appserver.properties and set the property app.server=jboss. You may want to review XPETSTORE_HOME/conf/as/jboss.properties to make sure that all the properties are properly set.

7. 指定數(shù)據(jù)庫
Edit the file XPETSTORE_HOME/conf/db/database.properties and set the property db.name=mysql.
Edit the file XPETSTORE_HOME/conf/db/mysql.properties to configure the database.You must set the following properties:
db.driver
db.url
db.user
db.password
db.classpath
PS: Don‘t change the hibernate properties.

8. Build源代碼
cd XPETSTORE_HOME/xpetstore-servlet
run build.bat

This command will :
Generate Java code in XPETSTORE_HOME/xpetstore-servlet/build/java
Generate the deployment descriptors at XPETSTORE_HOME/xpetstore- servlet/build/META-INF and XPETSTORE_HOME/xpetstore- servlet/build/WEB-INF
Compile the source code and build .jar, .war and .ear files at XPETSTORE_HOME/dist

經測試,事實上這樣build是不足夠的,在發(fā)布運行的過程中會出錯。但考慮到官方文件是這樣說的,并且這些的確是正確的主要步驟。之所以不能運行,完全是“意外”問題。因此,我們暫且跳過,到運行時再把步驟補全。

9. 發(fā)布應用
build.bat deploy

10. 初始化數(shù)據(jù)庫
build.bat db

11. 運行應用
http://localhost:8080/xpetstore-servlet/


12. 意外錯誤排除
第一次build的過程會拋出xpetstore-servlet\build\META-INF not found的錯誤。此時,可以手工在相應目錄建立META-INF文件夾。再運行build。

再發(fā)布時會拋出錯誤:Exception processing TLD at resource path /META-INF/taglib.tld。此時,可以手工將XPETSTORE_HOME\lib\main\com.opensymphony.module.webwork\webword.jar\META-INF中的taglib.tld 拷貝到XPETSTORE_HOME\xpetstore-servlet\web\META-INF目錄下。(META-INF是手工建立的)。再編輯XPETSTORE_HOME\xpetstore-servlet\build.xml,在“WAR”欄加入以下語句把taglib.tld拷貝進war中。再運行build。
java代碼: 


                    <!-- Added by thatway 2003-8-5 13:40-->
                      <metainf dir="${web.dir}/META-INF">
                              <include name="**/*" />
                      </metainf>
                    <!-- END -->



發(fā)布時還會提出錯誤,主要原因是Hibernate getConnection時不能通過JBOSS的安全驗證。此時,要修改JBOSS_HOME/server/xpetstore/conf/login_config.xml和JBOSS_HOME/server/xpetstore/deploy/mydql_ds.xml。
先說login_config.xml。參照HsqlDbRealm段,添加如下代碼。
java代碼: 


    <application-policy name = "MysqlDbRealm">
       <authentication>
          <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule"
             flag = "required">
             <module-option name = "principal"></module-option>
             <module-option name = "userName"></module-option>
             <module-option name = "password"></module-option>
             <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=xpetstoreDS</module-option>
          </login-module>
       </authentication>
    </application-policy>



再到mysql_ds.xml。修改security-domain值。
<security-domain>MysqlDbRealm</security-domain>


注意1:修改login-config.xml需要重啟JBOSS才生效;修改mysql.xml則不必。
注意2:調試的過程中必然會多次重啟JBOSS,如果xpetstore還沒有發(fā)布成功的話,重啟前請刪除deploy目錄下的xpetstore發(fā)布文件。


五. 結束語
至此,我們的痛苦就結束了。請訪問 http://localhost:8080/xpetstore-servlet/ 看一看自己辛勞的成果。如果還運行失敗,請聯(lián)系我。

此番配置有兩個目的,一是熟悉JBOSS,二是便于學習xpetstore源代碼。第一個目標我們是達到了,但第二個目標現(xiàn)在才開始,所以讓我們一起共勉,繼續(xù)努力。
本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
JBossAS Tuning Sliming jboss 瘦身配置
Jboss 配置數(shù)據(jù)源和JMS主題與隊列 - myth
提高EJB性能的十大技巧
JBoss ESB-jBPM集成
jboss配置文件的簡單介紹 - JAVA流通橋 - BlogJava
jboss4.0安裝及duke‘s bank部署心得
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服