跳转到内容

WebObjects/Web 应用程序/部署/FreeBSD WO5.3

来自维基教科书,开放世界中的开放书籍

在 FreeBSD 6.1 版本 (i386) Rev 0.8 2007-05-22 上设置 WebObjects 5.3.1 或 5.3.2 Francois BIENTZ ([email protected])

基于 How-to 的文档:在 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.1 X86 服务器
  • 一台 Mac 和 OSX 10.4.7 XCode 2.4,安装了 WebObjects 开发版。
  • 或一台 Mac 和 OSX 10.4.7 服务器 WebObjects 5.3.1 部署版安装。


安装 Java 和 Apache

[编辑 | 编辑源代码]

您可以构建和安装原生 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.00.tbz。

安装 Apache :我使用了 apache+ssl-1.3.34.1.57 端口

从 OSX 安装 WebObjects 5.3.2 或从 OSX 服务器安装 WebObjects 5.3.1

[编辑 | 编辑源代码]

在 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		
/JavaFoundation.framework		
/JavaJDBCAdaptor.framework		
/JavaJNDIAdaptor.framework		
/JavaWebObjects.framework		
/JavaWebServicesClient.framework		
/JavaWebServicesGeneration.framework		
/JavaWebServicesSupport.framework		
/JavaWOExtensions.framework		
/JavaWOJSPServlet.framework		
/JavaXML.framework		

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

wojavaclient.jar

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/httpsd.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/httpsdctl configtest

如果显示“语法正确”,则表示您没有问题。否则,请尝试找到并纠正它报告的错误。

启动 Apache 和 WO 服务

[编辑 | 编辑源代码]

启动 Apache:/usr/local/sbin/httpdsctl 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 创建启动脚本

[编辑 | 编辑源代码]

从端口安装 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-3.0.17-ga-bin.jar 放置在 /usr/local/apple/Local/Library/WebObjects/Extensions 中。

华夏公益教科书