Borland 的BES也许并没有太多人用,我也是公司买了后才知道的
SERVER的内核都是apache,tomcat之类的开源服务器,因此比较便宜(而且我们只购买了web edition),
不过它做了个看起来比较花哨的管理界面。
不过后来用了以后还感觉作为低成本的应用服务器也可可以一用。
但是这段时间却出现了一个蹊跷的事,我们的应用需要记录每个用户登录
的IP地址(自然而然用request.getRemoteAddr()),后发现BES记录的IP让
人不可预测,比如,你刚启动了partition.用112去访问,此时,后端记录下
是112,后从10访问,显示的IP一会儿是112,一会儿是10,完全没有规律,再从另
台机器登录,则IP好象是随机的三个曾访问过的IP,让我非常懊恼。
开始我是想呀,怎么说也是花钱买的商用服务器吧,不可能出现这么低级的问题,
所以一直在找我自身应用程序的原因,里为里面用了好多过滤器,上下文管理
之类的东东,担心是在某个地方代码出了问题,找的结果是没一点成效,后干脆
就开发一个小SERVLET部署上去测试,结果依据,这才让我坚信这是BES有问题。
真FT!
即然确定是它的问题,就看看网上应该有人遇到过,幸运的是,前两条就是关
于这个问题的(google: BES getRemoteAddr),其中一个还是Borland官方网
站呀,心想一定会有答案了,它网上的内容如下(http://support.borland.com/entry.jspa?externalID=3370&categoryID=120):
BES60 RP1 - httpservletrequest.getRemoteAddr() gives an old IP address
Applicable for:
BES60 RP1 - httpservletrequest.getRemoteAddr() gives an "old" ip address
Product Name: BES
Product Version: 6.0RP1
Product Component: Web Container
Platform/OS Version: Win32
JDK/Compiler Version: 1.3.1/1.4.1
Problem Description:
httpservletrequest.getRemoteAddr() gives an "old" ip address from someone who used connection earlier.
Resolution:
This is a known issue in the default connector with a BES 6.0RP1. However the workaround is:
Go to the server.xml as follows:
Borland Management Console --> Configuration --> Partition --> Web Container right click on web container, click properties,
click 'Service:HTTP', click 'Connector:CoyoteConnector:xxxx', click the XML tab on the right pane, comment the line
highlighted that is as follows by placing at the end of this element.
Then add the following line:
port="xxxx" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="100" debug="0"
connectionTimeout="20000" useURIValidationHack="false" disableUploadTimeout="true"/>
Note: change port number in new connector to match the port number that existed previously.
我看了半天,对比一下它说要替换的部分,根我现有配置一模一样,这倒底怎么回事呢?
后找了半天,才找到SUN的一个论坛里有人讨论这个问题,人家最终解决是更换了一个tomcat 的connector
可borland的网站上恰恰没有应该用什么connector的语句,只是给出一一堆根本用不着替换的配置(我愿意相
信是这输入人员的问题),但其职业精神也可想已知了,又FT!
将org.apache.coyote.tomcat4.CoyoteConnector换成org.apache.catalina.connector.http.HttpConnector
这是一个很简单的问题,也是一个显而易见的问题,因此,我觉得这种问题绝对不应出现在商用服务器上!!