IIS5.0J整合Boss

来源:互联网 发布:洪承畴纪念馆 知乎 编辑:程序博客网 时间:2024/05/12 19:21

由于最近的一个开发项目用到了JBoss和IIS,需要整合JBoss和IIS,在网上查到了很多TomCat 整合IIS的资料但就是没有Jboss的,但转念一想JBoss还是使用的内嵌TomCat,整合原理应该差不多。本人抱着不成功责成仁的心态,还好成功了,参考了很多兄弟姐妹的帖子,不敢独享。

建议大建先参看“参考文献”中的[1]、[2],再看下文。

环境:win2k server, IIS5.0? JBoss3.2.3(已内嵌TomCat4.1.29) jakarta-tomcat-connectors-jk2.0.4
基本的服务器环境略过(各位都是高手)。

首先,下载“Tomcat Web Server 连接器(Tomcat JK2 IIS 连接器)”地址: Apache Jakarta(http://jakarta.apache.org/site/binindex.cgi)解压缩下载得到的jakarta-tomcat-connectors-jk2.0.4-win32-IIS.zip得到isapi_redirector2.dll(关键的文件)copy这个DLL到你喜欢的任何地方,如:d:/Jboss3.2.3/bin 在IIS中建立虚拟目录,名字任意(猫猫狗狗都可以,如:TomCat ,Connector or jakarta),并将实际目录指向isapi_redirector2.dll所在位置(d:/Jboss3.2.3/bin),并且指定“执行”属性。

然后在IIS中增加 ISAPI过滤,加入isapi_redirector2.dll。

Copy jakarta-tomcat-connectors-jk2.0.4-win32-IIS.zip 中/conf下的workers2.properties.sample到你喜欢的任何地方,如上文的isapi_redirector2.dll所在目录(d:/Jboss3.2.3/bin)改名为workers2.properties。用文本编辑器打开它,增加、修改[uri:/**/*] 字段,让它指向需要的发布目录。
例如:我的发布目录是D:/Jboss3.2.3/server/default/deploy/pweb.war,下有个main.jsp.
[uri:/pweb/*]
info=JSP examples, map requests for all JSP pages to Tomcat.
context=/pweb

访问时直接用http://xxxxx/pweb/main.jsp

也可以直接参看这个文件内容:
[shm:]
info=Shared memory file. Required for multiprocess servers
file=C:/Tomcat 5.0/work/jk2.shm?????#可以是你喜欢的任何地方
size=1000000

[channel.socket:localhost:8009]
info=Ajp13 worker, connects to tomcat instance using AJP 1.3 protocol
tomcatId=localhost:8009

#以下的可以随意修改以符合需要
[uri:/jsp-examples/*]
info=JSP examples, map requests for all JSP pages to Tomcat.
context=/jsp-examples

[uri:/servlets-examples/*]
info=Servlet examples, map requests for all servlets to Tomcat.
context=/servlets-examples

[uri:/dir/*]
info=JSP examples, map requests for all JSP pages to Tomcat.
context=/dir

workers2.properties文件的格式不拘于一致统一,只要符合“http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk2/configweb.html”指明的规则就可以。
?

现在需要添加一些必要的注册信息到注册表,redirector被IIS调用时会读到。建立一个.reg文件

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE/SOFTWARE/Apache Software Foundation/Jakarta Isapi Redirector/2.0]
"workersFile"="d://Jboss3.2.3//bin//workers2.properties"?#修改指向workers2.properties的真实位置
"extensionUri"="/jakarta/isapi_redirector2.dll"???#“jakarta”是IIS建立的虚拟路径名,可以修改并与实际的一致(一定要与上文提到的建立的虚拟路径一致)
"logLevel"="debug"
"serverRoot"="d://Jboss3.2.3//"?????#好象可以任意,我指向的是D://jboss3.2.3

然后导入注册表,重起IIS,并启动Jboss,如果没出差错,现在已经可以直接用http://xxxxx/pweb/main.jsp 而不是http://xxxxx:8080/pweb/main.jsp 访问JSp服务了。


参考文献

[1]http://virtualict.net/support/kb/iis6-Tomcat5-JK2.html

[2]http://info.cc163.net/NewIIS5+TomcatHowTo/NewIIS5+Tomcat5HowTo.htm

[3]JK Documentation(iishowto) http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk2/configweb.html

?