跳轉到內容

WebObjects/Web 應用程式/部署/FreeBSD 6.2 WO5.3.3

來自 Wikibooks,開放世界中的開放書籍

在 FreeBSD 6.2 版本(i386)上設定 WebObjects 5.3.3 Rev 0.8 2007-04-11 Francois BIENTZ (francois.bientz@voila.fr)

基於 如何操作:在 Linux 上設定 WebObjects(Stefan Apelt)的文件:http://www.tetlabors.de/wo/setup_webobjects_on_linux.html。其他平臺http://www.tetlabors.de/wo/

感謝 Stefan Apelt、Ari Maniatis 和 Piotr Intres(Gentoo 安裝)


你需要什麼

  • FreeBSD 6.2 X86 伺服器
  • 一臺 Mac 和 OSX 10.4.9 XCode 2.4.1,安裝了 WebObjects 5.3.3 開發版本。
  • 或者一臺 Mac 和 OSX 10.4.9 伺服器,安裝了 WebObjects 5.3.3 部署版本。


安裝 Java 和 Apache

[編輯 | 編輯原始碼]

你可以使用 ports 系統構建和安裝原生 Java(參見 http://www.freebsd.org/java) - 或者從 FreeBSD 基金會下載 diablo Java 1.5 包:http://www.freebsdfoundation.org/downloads/java.shtml 檔案:diablo-jdk-freebsd6.i386.1.5.0.07.01.tbz。

安裝 Apache:我使用的是 ports/www 中的 apache13

從 OSX 或 OSX 伺服器安裝 WebObjects 5.3.3

[編輯 | 編輯原始碼]

在 FreeBSD 上建立這些目錄

/usr/local/apple/Library
/usr/local/apple/Local/Library

要從 OSX 複製到 FreeBSD 的目錄/檔案

FreeBSD:在 /usr/local/apple/Library/Frameworks(OSX:/System/Library/Frameworks)

/JavaDirectToWeb.framework 		
/JavaDTWGeneration.framework 		
/JavaEOAccess.framework 		
/JavaEOApplication.framework 		
/JavaEOCocoa.framework 		
/JavaEOControl.framework  		
/JavaEODistribution.framework		
/JavaEOGeneration.framework 		
/JavaEOInterface.framework  		
/JavaEOInterfaceCocoa.framework 		
/JavaEOInterfaceSwing.framework 		
/JavaEOProject.framework		
/JavaEORuleSystem.framework
/JavaEOTool.framework		
/JavaFoundation.framework		
/JavaJDBCAdaptor.framework		
/JavaJNDIAdaptor.framework		
/JavaWebObjects.framework		
/JavaWebServicesClient.framework		
/JavaWebServicesGeneration.framework		
/JavaWebServicesSupport.framework		
/JavaWOExtensions.framework		
/JavaWOJSPServlet.framework		
/JavaXML.framework	
/JDBCEOAdaptor.framework	
/JNDIEOAdaptor.framework	


FreeBSD:在 /usr/local/apple/Library/PrivateFrameworks(OSX:/System/Library/PrivateFrameworks)

/EOPlaceholders.framework
/JavaMonitor.framework

FreeBSD:在 /usr/local/apple/Library/WebObjects(OSX:/System/Library/WebObjects)

/JavaApplications
/WODocumentRoot

FreeBSD:在 /usr/local/apple/Local/Library/WebObjects/Extensions(OSX:/Library/WebObjects/Extensions)

axis-ant.jar
axis.jar
commons-discovery.jar
commons-logging.jar
jaxrpc.jar
log4j-1.2.8.jar
saaj.jar
wsdl4j.jar

為 FreeBSD 安裝 Apache 介面卡

[編輯 | 編輯原始碼]

編輯 /etc/profile 並新增

NEXT_ROOT=/usr/local/apple
export NEXT_ROOT
OS= FREEBSD
export OS

登出並登入(使用使用者登入),然後 su

將 mod_WebObjects.so 複製到 /usr/local/libexec/apache 中。

為 WebObjects 配置 Apache

[編輯 | 編輯原始碼]

將 WebObjects 的配置檔案複製到 Apache conf 資料夾

cp webobjects.conf /usr/local/etc/apache/

webobjects.conf 檔案

# WebObjects : Enable the WebObjects module.


LoadModule WebObjects_module /usr/local/libexec/apache/mod_WebObjects.so
#AddModule mod_WebObjects.c

# Path to the Document Root of your Webserver, 
# it should contain a directory named WebObjects
WebObjectsDocumentRoot /usr/local/www/data

# You can change the 'cgi-bin' part of WebObjectsAlias to whatever you
# prefer (such as Apps), but the 'WebObjects' part is required.
WebObjectsAlias /cgi-bin/WebObjects

# Here are the 3 possible configuration modes.
# The apache module uses one of them to get information
# about your deployed applications.
# 1085 is the reserved port on which wotaskd processes listen to by default.

# Host List Configuration
# wotaskd is started automatically on supported platforms,
# so this is the default mode.
# The apache module gets its configuration from the wotaskds
# listed on the configuration line
# For multiple hosts:
# WebObjectsConfig http://<name-of-a-host>:<port-on-a-host>,http://<name-of-another-host>:<port-on-a-host> <interval>
# For localhost: 
WebObjectsConfig https://:1085 10

# Multicast Configuration
# The apache module gets its configuration from all wotaskds
# that respond to the multicast call on the subnet
# WebObjectsConfig webobjects://239.128.14.2:1085 10

# File Configuration
# The apache module gets its configuration from one file
# WebObjectsConfig file://<path-to-a-xml-config-file> 10


# To enable public access to the WOAdaptorInfo page, uncomment the following line
# WebObjectsAdminUsername public

# To enable the WOAdaptorInfo page with restricted access,
# uncomment the next two lines and set the user and password
# To access the WOAdaptorInfo page with restricted access, 
# use a URL like: http://webserver/cgi-bin/WebObjects/WOAdaptorInfo?user+password.
# WebObjectsAdminUsername user
# WebObjectsAdminPassword password

# To change the logging options, read the following comments:
# The option name is "WebObjectsLog" and the first value indicates the path of the log file.
# The second value indicates the log level. There are five, in decreasing informational order:
# 	"Debug",    "Info",    "Warn",    "Error",    "User"
#
# Note: To enable logging, touch '/tmp/logWebObjects' as the administrator user (usually root).
#
# The following line is the default:
# WebObjectsLog /tmp/WebObjects.log Debug


編輯 /usr/local/etc/apache/httpd.conf。搜尋行 "LoadModule rewrite_module ...",並在其 _之前_ 插入以下行

Include /usr/local/etc/apache/webobjects.conf <Location /cgi-bin/./> SetHandler WebObjects </Location>

搜尋行 "AddModule mod_rewrite.c",並在其 _之後_ 放置以下行

AddModule mod_WebObjects.c

搜尋行 "ServerName ...",並在其中放置你的 DNS 主機名。如果你沒有,也可以使用你的 IP 地址。httpd.conf 中關於這一點的解釋很好。

ServerName yourhost.yourdomain.com

儲存並退出。現在,要檢視是否一切正常,請嘗試

/usr/local/sbin/apachectl configtest

如果顯示 "Syntax OK",則一切正常。否則,請嘗試查詢並更正它報告的錯誤。

啟動 Apache 和 WO 服務

[編輯 | 編輯原始碼]

啟動 Apache:/usr/local/sbin/apachectl start

啟動 wotaskd:$NEXT_ROOT/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd &


啟動 JavaMonitor 並測試安裝

[編輯 | 編輯原始碼]

在新增應用程式之前,最後一步是啟動 JavaMonitor 並檢視是否有效:$NEXT_ROOT/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789

啟動 JavaMonitor 後,你會看到類似於以下內容的一行

你的應用程式 URL 為:http://yourhost.yourdomain.com:56789/cgi-bin/WebObjects/JavaMonitor.woa

在網頁瀏覽器中開啟此 URL。


為 wotaskd 和 javamonitor 建立啟動指令碼

[編輯 | 編輯原始碼]

從 ports 安裝 lsof

建立 /usr/local/etc/rc.d/110.wotaskd.sh

#!/bin/sh

NEXTROOT=/usr/local/apple

case "$1" in
        start)
                
           export PATH=/usr/local/bin:$PATH
           export NEXT_ROOT=${NEXTROOT}
           ${NEXTROOT}/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd &
           echo -n ' wotaskd'
                
           ;;
        stop)
           lsof -i tcp:1085 |grep LISTEN | sort -u | awk '{print"kill -9 " $2}' | sh
                ;;
        *)
           echo ""
           echo "Usage: `basename $0` { start | stop }"
           echo ""
           exit 64
                ;;
esac

然後

 chmod +x /usr/local/etc/rc.d/110.wotaskd.sh

建立 /usr/local/etc/rc.d/150.javamonitor.sh

#!/bin/sh

NEXTROOT=/usr/local/apple

case "$1" in
        start)
           export PATH=/usr/local/bin:$PATH
           export NEXT_ROOT=${NEXTROOT}
           ${NEXTROOT}/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 &
           echo -n 'JavaMonitor'
                        ;;
        stop)
           lsof -i tcp:56789 |grep LISTEN | sort -u |awk '{print"kill -9 "$2}' | sh
            ;;
        *)
           echo ""
           echo "Usage: `basename $0` { start | stop }"
           echo ""
           exit 64
            ;;
esac

然後

 chmod +x /usr/local/etc/rc.d/150.javamonitor.sh

JDBC jar 檔案位置。

[編輯 | 編輯原始碼]

對於 mySQL:將 mysql-connector-java-5.0.3-bin.jar 放入 /usr/local/apple/Local/Library/WebObjects/Extensions 中。

華夏公益教科書