现在的位置: 首页 > 综合 > 正文

Resin 3.0 安装说明

2013年08月04日 ⁄ 综合 ⁄ 共 2547字 ⁄ 字号 评论关闭

安装:

       解压resin之后,以和apache结合的方式编译resin3

./configure --with-apache=/home/webadm

.make

.make install

编译完成之后.要修改apache的配置文件httpd.conf. 之前和2.0.x结合的apache的配置为CauchoConfigFile /home/resin/conf/resin.conf, 现在必须将这一行改成

ResinConfigServer localhost 6802  (6802resinsrun的端口 ), 这样才能实现apacheresin的结合.

主要配置说明

       resin3web-app配置和2.0有一定的区别.

首先,web-app-deploy的相关配置去掉(该目录主要为打包的war文件设置目录,当与下面的hostdocument-directory不同时,document-directory无效 ) , 然后修改

<host> <document-directory>/home/webpub</document-directory>, /home/webpub为程序主页存放的目录.

      

配置servlet-mapping,web-app里设置.如下

             <servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/>

      

配置数据库.范例如下

 

         <database>

           <jndi-name>jdbc/test</jndi-name>

           <driver type="org.gjt.mm.mysql.Driver">

             <url>jdbc:mysql://127.0.0.1:3306/test</url>

             <user>test</user>

             <password>test</password>

             <init-param useUnicode="true"/>

             <init-param characterEncoding="gb2312"/>

 

            </driver>

            <prepared-statement-cache-size>8</prepared-statement-cache-size>

            <max-connections>300</max-connections>

            <max-idle-time>30s</max-idle-time>

          </database>

       需要注意的是,resin3DBPool没有了getPool(String PoolName)的方法.所以以前的数据池连接方法不能使用了.比较折中的修改方法是, 重写一个DBPool,然后把java类里面的import com.caucho.sql.*;去掉避免冲突.

DBPool类范例:

 

 

package com.netease.mm;

 

import java.sql.*;

import javax.sql.*;

import javax.naming.*;

 

public class DBPool

{

        private Connection conn = null;

 

        public static DBPool getPool(String poolName)

        {

                try

                {

                Context env = (Context) new InitialContext().lookup("java:comp/env");

                        DataSource source = (DataSource) env.lookup("jdbc/"+poolName);

                        DBPool pool = new DBPool();

                        pool.conn = source.getConnection();

                        return pool;

                }

                catch(Exception e)

                {

                        return null;

                }

        }

 

        public Connection getConnection()

        {

                return conn;

        }

}

 

 

 

配置stderr,stdoutlog问题. Resin3默认并不会将程序出错的信息打印出来.需要自己设置.

<resin>结点之下添加如下配置:

<log name='' level='all' path='stderr:' timestamp="[%H:%M:%S.%s]"

     format=" ${log.level} ${log.loggerName} ${log.message}"/>

 

 

配置中无法解决的问题: resin2.0.x.可以设置error-page,resin启动错误或未启动时,访问主页将自动转向到所设置的error-page, resin3,虽然主页帮助里面提到这个设置

:<error-page exception-type='connection' location='/errpage.html'/>, 但经过测试.无论将此设置放在哪一层结点(resin,server,host,web-app)之下.都无法起到转向的作用. 这就引发一个严重的问题,resin3未启动而apache运行时.访问jsp页面,将直接显示出源码.该问题在resin3至今发布的版本都存在,目前找不到有效便捷的解决方法.

抱歉!评论已关闭.