天天看點

[開發]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>