天天看点

[开发]Resin 4.0.15重启时常见问题

<a href="http://www.cnblogs.com/zhengyun_ustc" target="_blank"></a>

下面是偶然出现的resin错误日志,郑昀的结论是不必过于担心下面这个错误,但最好能修改配置:

[2011/02/24 22:11:20.593] {} hmtpservlet[webapp[production/webapp/admin.resin/root]] requires an active com.caucho.security.authenticator because hmtp messaging requires authenticated login for security.  in the resin.xml, add an &lt;sec:adminauthenticator&gt;

[2011/02/24 22:12:29.198] {main} unable to find native library 'resin_os' for com.caucho.bootjni.jniprocess. resin expects to find this library in:

(unix) /application/webserver/resin-4.0.15/libexec64/libresin_os.so

                                 on unix, run ./configure; make; make install.

                                 the jvm exception was: java.lang.unsatisfiedlinkerror: no resin_os in java.library.path

但由于resin版本升级到4.0之后,重启时,如果会根据自身resin.xml的如下配置:

&lt;server-default&gt; &lt;resin:if  test ="${resin.username == 'root'}" &gt; &lt;user-name&gt;www-data&lt;/user-name&gt; &lt;group-name&gt;www-data&lt;/group-name&gt; &lt;/resin:if&gt; &lt;/server-default&gt;

做判断,如果当前启动resin的用户是root,那么就会使用user-name节点中指定的www-data用户身份启动resin(也因此有些工程师自己测试时启动不了resin,就是因为www-data用户不存在)。

当然,郑昀说我们线上的resin.xml配置文件中已经把这段话注释了:

&lt;!-- - if starting resin as root on unix, specify the user name - and group name for the web server user. --&gt;

所以,如果不是root帐号登录操作resin重启,比如假设是用一个webmaster帐号(没有root privileges权限)操作,那么

resin启动时必须绑定80端口,而unix仅仅允许root帐号绑定1024以下的端口号(所以8080端口就不存在此问题),

此时它会采用root身份,一旦绑定所有端口,就立刻丢弃root特权(privileges),

那么resin接下来可能因为身份的问题无法加载libresin_os.so,

于是很有可能因此就报告了郑昀上面贴的错误:“unable to find native library 'resin_os' for com.caucho.bootjni.jniprocess.”。

1、 可以忽略此类错误。

2、 打开resin.xml里的开关,改用户名为resin,然后增加这么一个用户useradd resin:

      - if starting resin as root on unix, specify the user name

      - and group name for the web server user.

      --&gt;

&lt;resin:if test="${resin.username == 'root'}"&gt;

&lt;user-name&gt;resin&lt;/user-name&gt;

&lt;group-name&gt;resin&lt;/group-name&gt;

3、或者直接复制一个libresin_os.so文件到 /usr/lib64/ 下,大家都能加载这个so。

1、

unix allows only root to bind to ports below 1024. if you use resin as your webserver (recommended) and bind to port 80, you'll need to start resin as root. in resin 4.0, the resin process can drop privileges as soon as it's bound to all its ports. you can configure the user that resin uses in the &lt;server&gt; or &lt;server-default&gt; sections:

...

&lt;resin:if test="${resin.username == 'root'}"&gt;

2、

但在我们线上这个版本resin 4.0.15已经修复了这个bug:

<a href="http://bugs.caucho.com/view.php?id=4359">01-25-11 16:03 ferg fixed in version  =&gt; 4.0.15</a>