网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > Java
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.回眸Java10周年:J2EE从起源到目.
.J2EE平台架构上开发CRM的技术过程.
.颠覆Java开发的定律:无需创建对.
.用Servlet开发企业级三层Web应用.
.构建器内部的多形性方法的行为.
.Java Swing中的键盘事件处理.
.关于java学习的一点感言.
.J2ME三种低级用户界面事件处理技.
.JDK1.5中新的语言特征分类介绍.
.J2EE中的业务逻辑和数据库访问决.
.实现对象序列化接口.
.Quartz与Hibernate数据库连接的结.
.从网上抓取指定URL源码的方案.
.spring关于底层资源的抽象.
.JAVA程序员必读:基础篇(4.b)-类和.
.使用Java程序的泛型应该注意的几.
.Java类装载体系中的隔离性.
.[引用] Eclipse 照亮Java众生.
.Weblogic 下 servlet实现应用级身.
.Java开源项目Hibernate包作用详解.

Resin with IIS

发表日期:2008-1-5



  [face=Arial]Resin provides a fast servlet runner for IIS 4.0 and PWS, allowing IIS to run servlets and jsp files.[/face]
Resin with IIS

To configure Resin with IIS, you must follow the following steps:

1.Configure IIS/PWS 
2.Configure resin.conf 
3.Start httpd 

Configuring IIS/PWS
ISAPI Filter
You should use resin-2.1.0/bin/setup.exe to setup your configuration. If you use setup.exe, you can just skip to the next section.

ISAPI Filter Priority
isapi_srun.dll installs itself as the default priority. Some users may need to set the priority to a higher level, e.g. to override IIS's DAV support. 

<caUCho.com>
<iis priority='high'/>

<http-server>
 ...
</http-server>

<caucho.com>



Configuring resin.conf
resin.conf should mirror the configuration of IIS. In other Words, you need to configure the document root and any Directory aliases.

For many users, you only need to change the app-dir attribute from 'doc' to something like 'd:\inetpub\wwwroot'. For more complicated configurations, you'll need to add path-mapping attributes.

resin.conf 


<caucho.com>
  <http-server
      app-dir='d:\inetpub\wwwroot'>
    <servlet-mapping url-pattern='/servlet/*'
              servlet-name='invoker'/>

    <servlet-mapping url-pattern='*.xtp'
                        servlet-name='com.caucho.jsp.XtpServlet'/>
    <servlet-mapping url-pattern='*.jsp'
                        servlet-name='com.caucho.jsp.JspServlet'/>
  </http-server>
</caucho.com>




Testing the servlet engine
From the Resin bin folder, you need to start httpd.exe to start the servlet runner.

Now browse http://localhost/test.jsp. You should get a 'file not found' message.

Create a test file 'd:\inetpub\wwwroot\test.jsp'


<%@ page language=javascript %>
2 + 2 = <%= 2 + 2 %>



Browse http://localhost/test.jsp again. You should now get

2 + 2 = 4

As a final test, change language to 'Java' and refresh the page. Nothing should change.


Command line arguments
The following configuration line arguments are recognized by httpd.exe. When installed as a service, these argument will be used when the service starts.

Argument Meaning  
-verbose Write more verbose information to the log file  
-resin_home <path> Sets the location of Resin  
-java_home <path> Specify the JDK location  
-msjava Use Microsoft's JVM  
-nojit Disable JIT compilation to help debugging  
-classpath <cp> Add to the classpath  
-J<arg> Set a Java command line argument, e.g. -J-nojit.  
-X<arg> Set a Java -X command line argument, e.g. -Xms128m.  
-D<foo=bar> Set a Java variable, e.g. -Dresin.home=here.  
-install Install as an NT service  
-install-as <name> Install as an NT service with the specific name.  
-remove Remove as an NT service  
-remove-as <name> Remove as an NT service with the specific name.  



Memory Configuration
Memory configuration is part of the JVM's arguments. For most JVMs, you can find the full list by starting "java -X".

Memory Configuration 


Argument Meaning  
-Xms<size> Initial Java heap size, e.g. -Xms32m  
-Xmx<size> Maximum Java heap size, e.g. -Xmx128m  




Deploying as an NT Service

Once you're comfortable with using Resin with IIS, you can install it as an NT service. As a service, Resin will automatically start when NT reboots. The service will automatically restart Resin if it uneXPectedly exits.

To install the service, use

dos> resin-2.1.0/bin/httpd -install

 


To remove the service, use

dos> resin-2.1.0/bin/httpd -remove

 


You will either need to reboot the machine or start the service from the Control Panel/Services panel to start the server. On a machine reboot, NT will automatically start the servlet runner.


Note: There is a bug in many JDKs which cause the JDK to exit when the administrator logs out. JDK 1.3 and later can avoid that bug if the JDK is started with -Xrs. 

dos> resin-2.1.0/bin/httpd -install -Xrs

 
Load Balancing

Configuring IIS/PWS
ISAPI Filter 
ISAPI Filter Priority 
Configuring resin.conf 
Testing the servlet engine 
Command line arguments
Memory Configuration 
Deploying as an NT Service 
Load Balancing 
Manual Configuration 
Troubleshooting 
 

Resin provides a fast servlet runner for IIS 4.0 and PWS, allowing IIS to run servlets and JSP files.


To configure Resin with IIS, you must follow the following steps:

Configure IIS/PWS 
Configure resin.conf 
Start httpd 
Configuring IIS/PWS 


ISAPI Filter
You should use resin-2.1.0/bin/setup.exe to setup your configuration. If you use setup.exe, you can just skip to the next section.

ISAPI Filter Priority
isapi_srun.dll installs itself as the default priority. Some users may need to set the priority to a higher level, e.g. to override IIS's DAV support. 

<caucho.com>
<iis priority='high'/>

<http-server>
 ...
</http-server>

<caucho.com>

 


Configuring resin.conf
resin.conf should mirror the configuration of IIS. In other words, you need to configure the document root and any directory aliases.

For many users, you only need to change the app-dir attribute from 'doc' to something like 'd:\inetpub\wwwroot'. For more complicated configurations, you'll need to add path-mapping attributes.

resin.conf  <caucho.com>
  <http-server
      app-dir='d:\inetpub\wwwroot'>
    <servlet-mapping url-pattern='/servlet/*'
              servlet-name='invoker'/>

    <servlet-mapping url-pattern='*.xtp'
                        servlet-name='com.caucho.jsp.XtpServlet'/>
    <servlet-mapping url-pattern='*.jsp'
                        servlet-name='com.caucho.jsp.JspServlet'/>
  </http-server>
</caucho.com>

 


Testing the servlet engine
From the Resin bin folder, you need to start httpd.exe to start the servlet runner.

Now browse http://localhost/test.jsp. You should get a 'file not found' message.

Create a test file 'd:\inetpub\wwwroot\test.jsp'

<%@ page language=javascript %>
2 + 2 = <%= 2 + 2 %>

 


Browse http://localhost/test.jsp again. You should now get

2 + 2 = 4

 


As a final test, change language to 'java' and refresh the page. Nothing should change.

Command line arguments 


The following configuration line arguments are recognized by httpd.exe. When installed as a service, these argument will be used when the service starts.

Argument Meaning  
-verbose Write more verbose information to the log file  
-resin_home <path> Sets the location of Resin  
-java_home <path> Specify the JDK location  
-msjava Use Microsoft's JVM  
-nojit Disable JIT compilation to help debugging  
-classpath <cp> Add to the classpath  
-J<arg> Set a Java command line argument, e.g. -J-nojit.  
-X<arg> Set a Java -X command line argument, e.g. -Xms128m.  
-D<foo=bar> Set a Java variable, e.g. -Dresin.home=here.  
-install Install as an NT service  
-install-as <name> Install as an NT service with the specific name.  
-remove Remove as an NT service  
-remove-as <name> Remove as an NT service with the specific name.  


Memory Configuration
Memory configuration is part of the JVM's arguments. For most JVMs, you can find the full list by starting "java -X".

Memory Configuration  Argument Meaning  
-Xms<size> Initial Java heap size, e.g. -Xms32m  
-Xmx<size> Maximum Java heap size, e.g. -Xmx128m  


Deploying as an NT Service 


Once you're comfortable with using Resin with IIS, you can install it as an NT service. As a service, Resin will automatically start when NT reboots. The service will automatically restart Resin if it unexpectedly exits.

To install the service, use

dos> resin-2.1.0/bin/httpd -install

 


To remove the service, use

dos> resin-2.1.0/bin/httpd -remove

 


You will either need to reboot the machine or start the service from the Control Panel/Services panel to start the server. On a machine reboot, NT will automatically start the servlet runner.


Note: There is a bug in many JDKs which cause the JDK to exit when the administrator logs out. JDK 1.3 and later can avoid that bug if the JDK is started with -Xrs. 

dos> resin-2.1.0/bin/httpd -install -Xrs

 


Load Balancing Resin 1.2 


In Resin 1.2, you can distribute requests to multiple machines. All requests in a session will go to the same host. In addition, if one host goes down, the IIS filter will send the request to the next available machine.

In addition, you can specify backup machines. The backup only will serve requests if all primaries are down.

See the http config section for more details.

resin.conf 


<caucho.com>
<http-server>
  <srun id="a" host='host1' port='6802'/>
  <srun id="b" host='host2' port='6802'/>
  <srun-backup id="c" host='backup' port='6802'/>
  ...
</http-server>
</caucho.com>




Manual Configuration
Experts may want to configure Resin/IIS by hand instead of using the setup program. If you need to know the steps involved:

Make sure httpd.exe works 
If you have a virtual site, you must have the virtual directory /scripts point to d:\inetpub\scripts 
Copy isapi_srun.dll to the IIS scripts directory, d:\inetpub\scripts. You may need to run net stop w3svc. 
(optional) Create a resin.ini in d:\inetpub\scripts pointing to the resin.conf. 
Configure IIS to load isapi_srun.dll as an ISAPI filter. 
Restart IIS (control panel/services) or net stop w3svc followed by net start w3svc. 
Browse /servlet/Hello and /foo.jsp. You should see a "cannot connect" error. 
Start httpd.exe 
Browse /servlet/Hello and /foo.jsp. You should now see the servlet. 
Copying isapi_srun.dll to inetpub/scripts directory is relatively straightforward. If you're upgrading to a new version of Resin, you may need to stop IIS (control panel/services) to get permission to overwrite isapi_srun.dll.

The resin.ini is an optional file in inetpub/scripts to override the automatic registry $RESIN_HOME/conf/resin.conf configuration file. If you only have one Resin server, you should not create a resin.ini and let isapi_srun.dll use the registry value set by the setup.exe program.

resin.ini is only needed if you have multiple Resin configuration files for different IIS virtual hosts.

The resin.ini should contain the following line:

CauchoConfigFile d:/resin2.0/conf/resin.conf

 


Adding an ISAPI filter is accomplished in the IIS manager.

Troubleshooting

 


Check your configuration with the standalone bin/httpd. In other words, add a <http port='8080'/> block and browse http://localhost:8080. 
Check http://localhost/caucho-status. That will tell if the ISAPI filter/extension is properly installed. 
Each srun host should be green and the mappings should match your resin.conf. 
If caucho-status fails entirely, the problem is in the isapi_srun installation. Try http://localhost/scripts/isapi_srun.dll/caucho-status directly (bypassing the filter). If this fails, IIS can't find isapi_srun.dll. 
Check that isapi_srun.dll is in c:\inetpub\scripts. 
Make sure that your IIS host has a mapping from /scripts to c:\inetpub\scripts and that the /scripts has execute permissions. 
If you've created a new IIS web site, you need to create a virtual directory /scripts pointing to the d:\inetpub\scripts directory. 
If caucho-status shows the wrong mappings, there's something wrong with the resin.conf. 
If caucho-status shows a red servlet runner, then httpd.exe hasn't properly started. 
If you get a "cannot connect to servlet engine", caucho-status will show red, and httpd.exe hasn't started properly. 
If httpd.exe doesn't start properly, you should look at the logs in resin2.0/log. You should start httpd.exe -verbose to get more information. 
If you get Resin's file not found, the IIS configuration is good but the resin.conf probably points to the wrong directories. 
上一篇:Rational Rose介绍材料 人气:1817
下一篇:Resin for Windows简易安装与调试 人气:624
浏览全部Java的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐