ZhipSoft.com
    冬去春来
        郑重声明:本Blog纯属个人学习、工作需要,记录相关资料。请不要发表任何有人身攻击的言论,谢谢!!www.ZhipSoft.com
posts - 94,comments - 149,trackbacks - 0
(我使用的jdk为:jdk1.5.0_01,环境变量JAVA_HOME=D:\jdk1.5.0_01,
path=D:\jdk1.5.0_01\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;)
1.下载:http://www.caucho.com/download/resin-3.0.10.zip
解压到D:\resin-3.0.10
2.运行setup.exe。指定resin Home:D:\resin-3.0.10
3.运行httpd.exe.
4.修改端口为80:打开D:\resin-3.0.10\conf\resin.conf,
找到"8080",修改为80,保存,重新启动resin。
<!-- The http port -->
<http server-id="" host="*" port="80"/>
5.发布webapp:
在resin.conf的结尾处: <host id="" root-directory=".">
<!--
- configures an explicit root web-app matching the
- webapp's ROOT
-->
<web-app id='/' document-directory="webapps/ROOT"/>
</host>
修改为:
<host id="" root-directory=".">
<!--
- configures an explicit root web-app matching the
- webapp's ROOT
-->
<web-app id='/' document-directory="webapps/ROOT"/>
<web-app id='/lizongbo' document-directory="E:/lizongbo/oscachedemo/test"/>
</host>
重新启动resin,访问 http://localhost/lizongbo/ 就可以看到效果。
注:建议最好设置一下环境变量RESIN-HOME,值=Resin安装目录
6.配置虚拟主机:
在文件结尾处</server>之前加上下面一段:

<host id="lizongbo.myresintest.com" root-directory=".">
<web-app id='/' document-directory="webapps/ROOT"/>
<web-app id='/lizongbo' document-directory="E:/jb/oscachedemo/test"/>
</host>
保存文件。
在c:\windows\system32\drivers\etc\host文件里加上下面一行:
lizongbo.myresintest.com 127.0.0.1

保存host文件。
重新启动resin,重新打开浏览器。输入http://lizongbo.myresintest.com/lizongbo/
就可以看到虚拟主机配置成功。

7.发布我的webapp的时候遇到了下面的错误信息。
org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/features/validation
查找资料http://www.google.com/search?hl=zh-CN&inlang=zh-CN&newwindow=1&q=resin+org.xml.sax.SAXNotRecognizedException&lr=,(参考:http://www.slamb.org/svn/repos/projects/axamol/sax-pipeline/README
需要新建一个 jaxp.properties, 内容如下:
javax.xml.parsers.SAXParserFactory: org.apache.xerces.jaxp.SAXParserFactoryImpl
保存文件到$JAVA_HOME/jre/lib/下面
接下来可能会出现下面的错误信息:
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAX
ParserFactoryImpl could not be instantiated: java.lang.NullPointerException
因此还需要把xercesImpl.jar复制到D:\jdk1.5.0_01\jre\lib\endorsed下面(没有这个目录就创建这个目录)
重新启动resin,我的webapp启动成功了。
访问 http://lizongbo.myresintest.com/mywebapp/,页面正常出现。
b.另外一种更简单的解决方法,不需要修改jdk的配置
((此方法没有测试过,请参考http://www-900.ibm.com/developerWorks/cn/webservices/ws-axisfaq/index.shtmlhttp://www.caucho.com/quercus/faq/question.xtp?question_id=295))
<host id="lizongbo.myresintest.com" root-directory=".">
<web-app id='/' document-directory="webapps/ROOT"/>
<web-app id='/lizongbo' document-directory="E:/jb/oscachedemo/test">
<system-property javax.xml.transform.TransformerFactory="org.apache.xalan.processor.TransformerFactoryImpl"/>
<system-property javax.xml.parsers.DocumentBuilderFactory="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
<system-property javax.xml.parsers.SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
<system-property org.xml.sax.driver="org.apache.xerces.parsers.SAXParser"/>
</web-app>
</host>

8.resin支持二级域名。
同6,主机名和doc路径,都使用正则表达式。
(例子:<host url-regexp='^([^/]*).test.com' app-dir='web/$1'/>)
regexp host <host regexp="([^.]+)\.foo\.com">
<host-name>${host.regexp[1]}.foo.com</host-name>

<root-directory>/opt/www/www.${host.regexp[1]}.com</root-directory>

...
</host>


再配合上泛域名解析,就非常方便了。
(在host文件里加上
127.0.0.1 aaa.foo.com
127.0.0.1 bbb.foo.com
然后访问这两个主机名,可以看见虚拟主机解析成功。
)
9.在Jbuilder2005中支持resin.
http://www.caucho.com/projects/index.xtp 下载 http://www.caucho.com/projects/jbuilder/resin-jbuilder-7.jar
保存到 JBuilderHome/lib/ext下。
(Jb2005不支持)

10.一个host配置参考:

<host id='www.lizongbo.com'>
<welcome-file-list>index.jsp, index.htm, index.html </welcome-file-list>
<error-log id='logs/lizongbo.com.log'/>
<doc-dir>E:/jb/lizongbo/webapp</doc-dir>
<web-app id='/'>
<classpath id='WEB-INF/classes'
source='WEB-INF/classes'
compile='false'/>
<servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/>
<servlet-mapping url-pattern='*.jsp' servlet-name='jsp'/>
<servlet-mapping url-pattern='*.html' servlet-name='jsp'/>


<session-config>
<session-max>4096</session-max>
<session-timeout>30</session-timeout>
<enable-cookies>true</enable-cookies>
<enable-url-rewriting>true</enable-url-rewriting>
</session-config>
</web-app>
</host>


11.与IIS整合。
安装好(WinXP+SP2下的)IIS,运行D:\resin-3.0.10\setup.exe


点Apply即可。
我的电脑-->右键-->管理-->Internet信息服务-->网站-->默认网站,
右键--〉属性-->ISAPI筛选器-->添加
筛选器名称:Resin_3.0.10
可执行文件:C:\Inetpub\scripts\isapi_srun.dll



确定,然后重新启动iis。再启动resin.此时就可以访问
http://localhost/index.jsp
如果没有启动resin。
将得到下面的错误信息:
Can't contact Servlet Runner at localhost:6802


        本Blog纯属个人学习、工作需要,记录相关资料。请不要发表任何有人身攻击的言论,谢谢! www.zhipsoft.cn
posted on 2007-04-04 14:32 ZhipSoft 阅读(861) 评论(0)  编辑  收藏 所属分类: Web Servers

只有注册用户登录后才能发表评论。


网站导航: