resin服务器配置

Resin配置数据源(把相应的驱动拷贝到lib)

问题1Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

      不能在 main方法中测试数据源的连接

1.  sqlServer2000msbase.jar mssqlserver.jar msutil.jar 放入resin安装目录下的lib文件夹中然后配置resin.config

 <database>

   <jndi-name>jdbc/sqlserver</jndi-name>

   <driver type="com.microsoft.jdbc.sqlserver.SQLServerDriver">

       <url>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=waihu</url>

       <user>sa</user>

       <password>sa</password>

   </driver>

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

   <max-connections>20</max-connections>

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

</database>

其他数据源配置参考

 

    <!--  

       - Sample database pool configuration

       -

       - The JDBC name is java:comp/env/jdbc/test

       mysql:

         <database>

           <jndi-name>jdbc/mysql</jndi-name>

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

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

             <user></user>

             <password></password>

            </driver>

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

            <max-connections>20</max-connections>

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

          </database>

      oracle:

      <database>

       <jndi-name>jdbc/oracle</jndi-name>

        <driver type="oracle.jdbc.driver.OracleDriver">

         <url>jdbc:oracle:thin:@192.168.1.107:1521:test</url>

         <user>admin</user>

         <password>admin</password>

        </driver>

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

       <max-connections>200</max-connections>

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

       </database>

       sqlserver:

    

     <database>

       <jndi-name>jdbc/sqlserver</jndi-name>

       <driver type="com.microsoft.jdbc.sqlserver.SQLServerDriver">

         <url>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=waihu</url>

         <user>sa</user>

         <password>sa</password>

       </driver>

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

       <max-connections>20</max-connections>

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

    </database>

    jtds driver

       <database>

       <jndi-name>jdbc/sqlserver</jndi-name>

       <driver type="net.sourceforge.jtds.jdbc.Driver">

         <url>jdbc:jtds:sqlserver://localhost:1433/waihu</url>

         <user>sa</user>

         <password>sa</password>

       </driver>

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

       <max-connections>20</max-connections>

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

    </database>

   

     <database>

       <jndi-name>jdbc/sqlserver</jndi-name>

       <driver type="net.sourceforge.jtds.jdbc.Driver">

         <url>jdbc:jtds:sqlserver://localhost:1433;DatabaseName=waihu</url>

         <user>sa</user>

         <password>sa</password>

       </driver>

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

       <max-connections>20</max-connections>

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

    </database>

   

    --> 

     <database>

       <jndi-name>jdbc/sqlserver</jndi-name>

       <driver type="net.sourceforge.jtds.jdbc.Driver">

         <url>jdbc:jtds:sqlserver://localhost:1433;DatabaseName=waihu</url>

         <user>sa</user>

         <password>sa</password>

       </driver>

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

       <max-connections>20</max-connections>

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

    </database>

 

下载http://caucho.com/download/

配置rsin+myeclipse

1Rsin

  Resin也可以和许多其他的WEB服务器一起工作,比如Apache serverIIS等。Resin支持Servlets 2.3标准和JSP 1.2标准。熟悉ASPPHP的用户可以发现用Resin来进行JSP编程是件很容易的事情。 

Resin支持负载平衡(Load balancing),可以增加WEB站点的可靠性。方法是增加服务器的数量。比如一台SERVER的错误率是1%的话,那么支持负载平衡的两个Resin服务器就可以使错误率降到0.01% 
  Resin 2.1.4
 resin-2.1.4.zip),你可以从http://www.caucho.com/download/ 站点上查询Resin的最新版本并下载它。

Resin服务器平台介绍简介:
Resin
提供了最快的jsp/servlets运行平台。在javajavascript的支持下,Resin可以为任务灵活选用合适的开发语言。Resin的一种先进的语言XSL(XML stylesheet language)可以使得形式和内容相分离。 如果您选用jsp平台作为internet商业站点的支持,那么速度、价格和稳定性都是要考虑到的,resin十分出色,表现更成熟,很具备商业软件的要求。而且,它是全免费的。从站点下载的就是完整版本。所以值得向您推荐! 相对于tomcat3.1,后者更象是一个正在研究的项目。目前resin可以支持sunj2ee,而tomcat不能直接支持,而j2ee是基于java服务器端大系统的基础。但tomcat结构非常合理,而且是apache组织的产品,因此有着很好的远景。

 

Resin1.1的特性包括:
支持jsp1.1和在服务器端编译的javascript.
mod_perl,mod_php更快,比Jakarta Tomcat3倍。您可以在Caucho的站点看到很全面的各种测试报告。

使用servlet2.2引擎。
自动的servlet/bean编译!
5 Servlet,XSL Filtering
支持IIS,Apache,Netscape和其它内置了HTTP/1.1Web服务器。
7 XSLT
XPath1.0引擎。


企业级的共享软件(基于一个开放源码的协议)安装与启动:安装特别简单,只需将resin-1.1.3.zip解压缩到某个目录即可。在运行之前需要有jdk的支持。启动方式是执行:resin-1.1.3/bin/httpd (NT)系统已经按照缺省设置启动,系统将监听8080端口。jsp文件可放在resin-1.1.3/doc目录下;servlet可以放在resin-1.1.3/doc/web-inf/classes下面。测试  http://localhost:8080/ 中可以看到resin的欢迎界面。 
下载您可以在此下载最新的Resin1.1.3。大概是2.5M。当然,您也可以去 http://www.caucho.com 官方站点了解详细内容并下载resin1.1.3或者1.1.2并且看一下resinLicense

刚开始下载一个是resin-3.2版本的竟然发现没有resin.config,后来又下载一个resin-3.1就有了,

MyEclipse中发布项目时,会将项目发布到resin安装目录的deploy目录下,但是访问时会出现HTTP404错误resin3.0中,deploy是默认的发布目录,在MyEclipse中直接发布到resindeploy目录中,起动服务器就会运行发布的项目,而在resin-3.1.x中发布到deploy目录下的项目不会运行,需要修改conf目录下的resin.conf文件

有两种修改方式:

1.<host id="" root-directory=".">标记中找到</web-app>在这个标记后面手动添加一行配置
   <web-app id="/
项目名称" root-directory="deploy/项目名称"/>

2.自动部署:在文件中找到<web-app-deploy path="webapps"/>,在后面添加一行
   <web-app-deploy path="deploy"/>
,这样在deploy目录下的项目就能正常运行了。 

 

==================以下是Resin服务器配置详解==================

<!-- - Resin 3.1 配置文件. -->
<resin xmlns="http://caucho.com/ns/resin"  
       xmlns:resin="http://caucho.com/ns/resin/core">

<!-- 加载resin/lib下的所有.jar文件-->
<class-loader>
   <tree-loader path="${resin.home}/lib"/>
   <tree-loader path="${resin.root}/lib"/>
</class-loader>

<!-- - 管理配置 -->
<management path="${resin.root}/admin">
</management>

<!-- -JDK日志接口的配置. -->
<log name="" path="stdout:" timestamp="[%H:%M:%S.%s] "/>

<!-- 日志信息的级别:'info' 生产环境 'fine' 开发环境 'finer' 调试环境 -->
<logger name="com.caucho" level="info"/>
<logger name="com.caucho.java" level="config"/>
<logger name="com.caucho.loader" level="config"/>

<!-- - 环境上下文的检测时间,对于生产站点, 这个要设置长一点,例如600秒,10分钟 -->
<dependency-check-interval>2s</dependency-check-interval>

<!-- - 发送邮件通知的SMTP服务器 -->
<system-property mail.smtp.host="127.0.0.1"/>
<system-property mail.smtp.port="25"/>

<!-- - 你可以把编译器改成 "javac", "eclipse" 或者 "internal". -->
<javac compiler="internal" args="-source 1.5"/>

<!-- Security providers.
- <security-provider>
- com.sun.net.ssl.internal.ssl.Provider
- </security-provider>
-->

<!-- 去掉注释,如果你使用resin提供的xml应用
-
- <system-property javax.xml.parsers.DocumentBuilderFactory
- ="com.caucho.xml.parsers.XmlDocumentBuilderFactory"/>
- <system-property javax.xml.parsers.SAXParserFactory
- ="com.caucho.xml.parsers.XmlSAXParserFactory"/>
-->

<cluster id="app-tier">
    <!--
设置集群上下文的根, 相对于server.root -->
    <root-directory>.</root-directory>
    <server-default>
        <!-- HTTP
服务的端口-->
        <http address="*" port="8080"/>
        <!--
           - SSL
端口配置:
           -
           - <http address="*" port="8443">
           - <openssl>
           - <certificate-file>keys/gryffindor.crt</certificate-file>
           - <certificate-key-file>keys/gryffindor.key</certificate-key-file>
           - <password>test123</password>
           - </openssl>
           - </http>
           -->

        <!-- - JVM参数设置 -->
        <jvm-arg>-Xmx256m</jvm-arg>
        <jvm-arg>-Xss1m</jvm-arg>
        <jvm-arg>-Xdebug</jvm-arg>
        <jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>
        <!-- Uncomment to enable admin heap dumps
去掉这个如果你想管理内存堆的倾倒
            - <jvm-arg>-agentlib:resin</jvm-arg>
          -->
        <watchdog-arg>-Dcom.sun.management.jmxremote</watchdog-arg>

        <!-- 强制resin强制重起时的最小空闲内存 -->
        <memory-free-min>1M</memory-free-min>
        <!--
最大线程数量. -->
        <thread-max>256</thread-max>
        <!--
套接字等待时间 -->
        <socket-timeout>65s</socket-timeout>
        <!--
配置 keepalive -->
        <keepalive-max>128</keepalive-max>
        <keepalive-timeout>15s</keepalive-timeout>
        <!-- -
如果使用的是UNIX,这里是启动的帐号和用户组.
          - <user-name>resin</user-name>
          - <group-name>resin</group-name>
          -->
    </server-default>

    <!-- 定义群集服务器 -->
    <server id="" address="127.0.0.1" port="6800"/>
    <!-- Configures the persistent store for single-server or clustered
配置独立服务器或者群集的持久化存储,专业版的功能 -->
    <resin:if test="${resin.isProfessional()}">
       <persistent-store type="cluster">
           <init path="session"/>
       </persistent-store>
    </resin:if>

    <!-- 为了安全, 你可以为SSL会话(SSL sessions)定义一个不同的cookie.
      - <ssl-session-cookie>SSL_JSESSIONID</ssl-session-cookie>
      -->

    <!-- 缓存启用 (专业版的功能) -->
    <resin:if test="${isResinProfessional}">
        <cache path="cache" memory-size="64M">
            <!-- Vary header rewriting for IE -->
            <rewrite-vary-as-private/>
        </cache>
    </resin:if>

    <!-- 启用周期性的服务器状态检查和死锁检查,所有的服务器可以添加 <url> 来检查。 -->
    <resin:if test="${isResinProfessional}">
        <ping>
            <!-- <url>http://localhost:8080/test-ping.jsp</url> -->
        </ping>
    </resin:if>

    <!-- 包含web应用的默认行为 -->
    <resin:import path="${resin.home}/conf/app-default.xml"/>
    <!--
每一个web应用的默认参数 -->
    <<SPAN class=hilite1>web-app-default</SPAN>>
    <!--
扩展库的公共jar文件,扩展是安全的即使没有类装载器知道的jars,装载的类将为每个应用分别装载,也就是这些类都是不同的-->

        <class-loader>
            <tree-loader path="${server.root}/ext-webapp"/>
        </class-loader>

        <!-- 设置缓存页、静态也的延时值 -->
        <cache-mapping url-pattern="/" expires="5s"/>
        <cache-mapping url-pattern="*.gif" expires="60s"/>
        <cache-mapping url-pattern="*.jpg" expires="60s"/>
        <cache-mapping url-pattern="*.png" expires="60s"/>
        <!--
启用EL表达式 -->
        <allow-servlet-el/>

        <!-- 安全原因, 默认禁用了会话的URLs -->
        <session-config>
            <enable-url-rewriting>false</enable-url-rewriting>
        </session-config>

        <!-- 安全原因, cookies中设置HttpOnly标志
            - <cookie-http-only/>
          -->

        <!--一些JSP包有不正确的 .tld文件。可以把validate-taglib-schema设置成false,可能继续正常工作
            - Some JSP packages have incorrect .tld files. It's possible to set validate-taglib-schema to false to work around these
packages.
          -->

        <jsp>
            <validate-taglib-schema>true</validate-taglib-schema>
            <fast-jstl>true</fast-jstl>
            <fast-jsf>true</fast-jsf>
        </jsp>
     </<SPAN class=hilite1>web-app-default</SPAN>>

     <!-- 简单的数据池配置
        - The JDBC name is java:comp/env/jdbc/test
       <database>
          <jndi-name>jdbc/mysql</jndi-name>
          <driver type="org.gjt.mm.mysql.Driver">
              <url>jdbc:mysql://localhost:3306/test</url>
              <user></user>
              <password></password>
          </driver>
          <prepared-statement-cache-size>8</prepared-statement-cache-size>
          <max-connections>20</max-connections>
          <max-idle-time>30s</max-idle-time>
        </database>
        -->

     <!-- 定义所有虚拟主机的默认配置 -->
     <host-default>
         <!--
如果和别的web服务器整合,这个可以被去掉,因为web服务器也可以记录这些信息。 -->
         <access-log path="logs/access.log" format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"' rollover-period="1W"/>

         <!-- war 文件的布置目录 -->
         <web-app-deploy path="webapps"/>

         <!-- ear文件的布置目录 -->
         <ear-deploy path="deploy">
            <ear-default>
                <ejb-server>
                   <config-directory>WEB-INF</config-directory>
                   <data-source>jdbc/test</data-source>
                </ejb-server>
            </ear-default>
         </ear-deploy>

         <!-- rar文件的布置目录 -->
         <resource-deploy path="deploy"/>
     </host-default>


     <!--
虚拟主机的布置目录 -->
     <host-deploy path="hosts">
          <host-default>
               <resin:import path="host.xml" optional="true"/>
          </host-default>
     </host-deploy>

     <!-- 默认的虚拟主机配置 -->
     <host id="" root-directory=".">
          <!--
配置默认的应用 webapp's ROOT -->
          <web-app id="/" root-directory="webapps/ROOT"/>
          <web-app id="/resin-admin" root-directory="${resin.home}/php/admin">
               <!-- -
管理应用程序 /resin-admin
                 - password is the md5 hash of the password
md5码的密码。
                   - localhost is true to limit access to the localhost
localhost设置成true,这样只有localhost才能访问
                   -->
               <prologue>
                    <resin:set var="resin_admin_user" value=""/>
                    <resin:set var="resin_admin_password" value=""/>
                    <resin:set var="resin_admin_external" value="false"/>
               </prologue>
          </web-app>
     </host>

</cluster>


<!-- - Configuration for the web-tier/load-balancer -->
<resin:if test="${resin.isProfessional()}">
     <cluster id="web-tier">
          <server-default>
               <!-- The http port -->
               <http address="*" port="9080"/>
          </server-default>
          <server id="web-a" address="127.0.0.1" port="6700"/>
          <cache path="cache" memory-size="64M"/>
          <host id="">
               <web-app id="/">
                    <rewrite-dispatch>
                         <load-balance regexp="" cluster="app-tier"/>
                    </rewrite-dispatch>
               </web-app>
          </host>
     </cluster>
</resin:if>

</resin>

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值