跳转到内容

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 ([email protected])

基于 如何操作:在 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://127.0.0.1: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 中。

华夏公益教科书