resin上跑第一个web实例

刚刚成功试过resin启动,默认的root是resin的doc和admin的一个index页面。
现在想移植一个tomcat的web实例到resin来。于是想找eclipse的resin插件,结果发现不支持resin3.1, 再找了找还真没找到了。
没办法, 看看怎样直接在eclipse中用命令行运行好了。这倒好, resin的主页上有提供这个方法的教学:
[url]http://wiki.caucho.com/IDE[/url]
[quote]Starting Resin from within the IDE
Resin is started and stopped by the IDE. Console messages appear in the console window of the IDE.
IDE configuration value description
Classpath all of the jars in resin.home/lib, see Global Library|
Java argument -Djava.system.class.loader=com.caucho.loader.SystemClassLoader
Main class com.caucho.server.resin.Resin
Program argument -conf conf/development.conf See development.conf
Program argument -server-root /path/to/webapp The location of the web-app
[edit] Additional configuration

Some systems require additional configuration, indicated by Resin error messages.
IDE configuration value description
Classpath java.home/lib/tools.jar Needed for compiling java files
Java argument -Dresin.home=/usr/local/resin Needed if Resin cannot discover the value programmatically [/quote]
整理一下,应该是这样的
resin运行需要指定三个参数:root、conf、resin.home,
而root和resin.home应当都是同一个位置,就是resin安装的根目录
而conf默认的是resin.home/conf/resin.conf, 这个会根据每个web应用不同,因此往往需要创建一个。
1) classpath中要把resin.home/lib下面的所有jar包添加进来
2)运行的主程序是com.caucho.server.resin.Resin
3)通过jvm参数指定resin.home, -Dresin.home=/usr/local/resin;
主程序参数指定root和conf:-conf conf/development.conf
-server-root /path/to/webapp
4)添加jvm参数:-Djava.system.class.loader=com.caucho.loader.SystemClassLoader
经过我的实验, root实际上可以不指定。

这个conf比较重要, 官方的wiki推荐我们使用[url]http://wiki.caucho.com/Development.conf[/url],我把内容贴出来,注意看里面的注释:

<resin xmlns="http://caucho.com/ns/resin"
xmlns:resin="http://caucho.com/ns/resin/core">

<resin:set var="http.port" default="8080"/>
<resin:set var="log.level" default="fine"/>

<log path="stdout:">
<logger name="" level="${Var['log.level']}"/>
</log>

<server>
<class-loader>
<tree-loader path="${resin.home}/lib"/>
</class-loader>

<http server-id="" host="*" port="${Var['http.port']}"/>

<dependency-check-interval>2s</dependency-check-interval>

<javac compiler="internal" args=""/>

<resin:import path="${resin.home}/conf/app-default.xml"/>

<resin:if test="${resin.isProfessional()}">
<cache path="WEB-INF/work/cache" memory-size="8M"/>
</resin:if>

<web-app-default>
<cache-mapping url-pattern="/" expires="5s"/>
<cache-mapping url-pattern="*.gif" expires="60s"/>
<cache-mapping url-pattern="*.jpg" expires="60s"/>

<allow-servlet-el/>
</web-app-default>

<host id="">
<web-app id="/"><!--这里可以加你的host, 可能是像下面这样-->
<!--<web-app id='/myprojectName' document-directory="d:\myprojectName\webapp"> -->
<session-config>
<file-store>WEB-INF/work/sessions</file-store>
</session-config>
</web-app>
</host>
</server>
</resin>

里面加了些注释的地方,说的是如何设定web应用的context和path
这里面还可以设置日志级别以及resin启动的端口
对于log的设定可以参考:
[url]http://www.caucho.com/resin-3.0/config/log.xtp#stdout-log[/url]
实际上resin的log就是基于JDK logging interface
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值