[Miles' Blog]

Welcome 2 My Planet

Available categories: [/] [development. ~] [working on downwap.] [trouble shooting] [working on Yup Mailman] [general infomation.] [life style]

Tomcat 2 Weblogic Migration | Tomcat到Weblogic移植 [Permalink]

Sat Sep 24 10:41:04 CST 2005
Category [working on downwap.]

出于性能、扩展性等等一大堆理由,downwap工程由tomcat移植到了weblogic81sp2上。

当初就有考虑到会有这一天,所以开始设计的时候就尽量不依赖容器。如今终于尝到了标准化的甜头。 /images/emoticons/grin.gif

不过即使如此,问题也不少。罗列一下:

  • 以前用的jwml=>jsp servlet映射在weblogic中当然不认。因为tomcat有定义jsp这个servlet-name,而weblogic没有。结果没有想到本以为很简单的后缀映射在weblogic中确很不容易实现,找到的资料大多以6.x之前版本为主,那时候还没到config.xml的年代。惹不起躲得起,干脆改回jsp后缀了事。
  • 原来改了jsp远不是问题的结束。对*.jsp做filter映射是没有问题,可是在filter中通过ResponseWrapper锁定的contentType没了作用。没时间研究原因,直接开头加上DI,用@page设置了contentType。感觉宛如吃苍蝇,最后干脆去掉了所有jsp,统统由XSLT转换。还是那个优先级的理念:可维护性>性能。
  • 同理,Wrapper强制200也没起作用,处理同上。
  • weblogic81自带的JRockit1.4.1类库没带SHA256。换JRockit1.4.2解决。

移植完毕以后做了压力测试,性能的确好不少。不过要说原因,估计和Tomcat的JK、JRockit的调整、代码整理都有关系。倒不一定是AppServer在这个级别应用上的差距体现。

Posted by: miles
Comments [0] |

正确设置request传入内容的编码|set charset encoding properly [Permalink]

Thu Aug 18 11:50:21 CST 2005
Category [development. ~]

request.setCharEncoding("UTF-8")
这句话一定要放在访问request内容之前,否则将不起作用。
原因可能是如果取值之后仍然起作用,会造成设置前后取到的参数编码不一致的情况,而这种情况造成的问题严重性甚于编码出错本身。所以在ServletRequest接口这个方法的API说明中提到:

* Overrides the name of the character encoding used in the body of this
* request. This method must be called prior to reading request parameters
* or reading input using getReader().

Posted by: miles
Comments [0] |

blog google排名第一!恭喜自己一个! [Permalink]

Thu May 26 16:25:02 CST 2005
Category [general infomation.]

在google搜索包含miles的简体中文网页,结果如下:
http://www.google.com/search?hl=zh-CN&q=miles&btnG=Google+%E6%90%9C%E7%B4%A2&lr=lang_zh-CN

我的blog居然排名第一!哈哈,没天理啊~既没有引用量,也没有浏览量,都能混上No.1。。看来一个生僻的名字对于出名是很有必要地~~ /images/emoticons/grin.gif

为了留住这经典一刻,咔喳一张放这里

Posted by: miles
Comments [0] |

firefox wmlbrowser extension的select bug终于解决了 [Permalink]

Thu May 26 16:20:49 CST 2005
Category [trouble shooting]

bug#9321, "Data from select/option fields are not sent"终于在0.6.9版被shoot down了,大快人心啊!!

这个extension许久都没有动作了,0.6.8还是年初的版本。hoho~~ 难道和我不懈的骚扰有关系?前段时间和Project Owner[Matthew Wilson]通过信催这个问题,他当时的回答居然是:

Sorry about that, I'd forgotten about it to be honest. I'll try and sort
something out soon.

Matthew
当时真是晕啊~~这么好的DD难道只有我一个人用么???? /images/emoticons/plain.gif

Posted by: miles
Comments [0] |

cvs错误:cannot find .: No such file or directory [Permalink]

Tue May 10 09:47:22 CST 2005
Category [trouble shooting]

服务器重整以后,cvs update/commit时候会出现如下错误提示:
cvs server: cannot open directory . for empty check: Invalid argument
虽然不影响使用,但是却很让人不爽。

而chacl时候,则是:
cvs [server aborted]: cannot find .: No such file or directory
干脆就直接出错。研究了一下cvsnt里面的设置,感觉应该只和cvsroot及temp目录有关——毕竟只用到这两个目录而已。检查之后发现winnt/temp没有对cvsuser这个系统帐号的权限。设置之后问题解决。

虽然cvsuser只是一个停用了的cvs用户绑定帐号,但是权限管理方面仍然遵循着ntfs的规则。这么说来停用的意义应该仅仅是限制登录。

Posted by: miles
Comments [0] |

JTDS: A bug while preforming full-text search [Permalink]

Tue Apr 19 15:29:59 CST 2005
Category [trouble shooting]

When took JTDS as MSSQL jdbc driver and did a pre-query like this:
select * from tbltopic where contains(topic, ?)
we got a SQLException saying:
...ResultSet is TYPE_FORWARD_ONLY...
And this exception did not come up while using a regular sql statement:
select * from tbltopic where contains(topic, '+keyword+')

Is this a bug or something of JTDS? /images/emoticons/sad.gif

Posted by: miles
Comments [0] |

TOMCAT 5: 关于Connector的URIEncoding属性|About "URIEncoding" attribute in the "Connector" tag. [Permalink]

Tue Apr 19 14:09:48 CST 2005
Category [development. ~]

tomcat5中,因为众所周知的原因,为了保证get/post数据都采用相同的UTF8编码,我们在server.xml中进行了如下设置:

<Connector port="8080" maxThreads="150" minSpareThreads="25" 
maxSpareThreads="75" enableLookups="false" redirectPort="8443" 
acceptCount="100" debug="99" connectionTimeout="20000" 
disableUploadTimeout="true" URIEncoding="UTF-8"/>
这里指定了get时候的数据编码。但是,当使用IIS作为webserver转发servlet/jsp请求给Tomcat时候,这个设置却失效了。其实原因很简单:IIS是通过AJP协议,把请求转发到Tomcat监听的8009端口上的,所以这里针对8080的设置自然就无效了。正确的方法是进行下面的设置:
<Connector port="8009" enableLookups="false" redirectPort="8443" 
debug="0" protocol="AJP/1.3" URIEncoding="UTF-8"/>
虽然是小问题,却花了我几个小时才想到。 /images/emoticons/plain.gif

Posted by: miles
Comments [0] |

d-o-e PI以及奇怪的namespace问题 [Permalink]

Fri Mar 25 19:16:40 CST 2005
Category [trouble shooting]

在xslt中,经常有需要保留<>,不把它替换成&lt;&gt;的需求。比如今天就遇到了需要在xslt中利用xalan调用java static method,生成部分wml代码的情况。按规范上说,只需要用

<xsl:value-of disable-output-escaping="yes" select="string('<')"/>
这样的方式,就可以达到目的。这种方法在MSXML中完全没有问题。可是,到了java中情况就完全不同了。上述代码得到的是这样的一个半成品:
<?javax.xml.transform.disable-output-escaping?>
意思似乎是让你再找个什么玩意作二次转换。可是找了一圈也没有找到处理这个d-o-e PI的办法。鉴于时间有限,只能用笨办法了:就是字符串分析替换。邮件列表里面很多人都遇到了这个问题而且一筹莫展,真搞不懂这个设计是什么意思 /images/emoticons/plain.gif

做了半天苦力搞好了这个问题,新的,更BT的问题又来了。这样的一个xsl文件:
<xsl:stylesheet 
  version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:funcs="xalan://com.yupstudio.app.downwap.common.util.XSLTFuncs">

  <xsl:output 
    method="wml" 
    omit-xml-declaration="no" 
    indent="no" 
    doctype-public="-//WAPFORUM//DTD WML 1.3//EN"
    doctype-system="http://www.wapforum.org/DTD/wml13.dtd" />
......
实在搞不清楚为什么会有这样的输出:
<wml 
  xmlns:funcs="xalan://com.yupstudio.app.downwap.common.util.XSLTFuncs">
这个namespace说明的attr为什么会加入这里?要知道到生成这个结果的时候,xalan已经发挥完作用了啊!解决方式仍然是简单粗暴:用regexp直接搞掉tag的所有attr。

最后,一个字总结今天的心得——郁闷成P了!


补充一下,前两天这个namespace错误又有出现。观察现象发现当主xsl和include进来的xsl的xsl:stylesheet标签中的xmlns声明部分有不同时就会使得included xsl的顶级标记中出现xmlns的声明。

例如主xsl(main.xsl):
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:funcs="xalan://com.yupstudio.app.downwap.common.util.XSLTFuncs">
从xsl(footer.xsl):
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:funcs="xalan://com.yupstudio.app.downwap.common.util.XSLTFuncs"
xmlns:digest="xalan://com.yupstudio.app.downwap.common.util.DigestUtil">
那么在footer xsl负责解析的wml底部的那个P标记就会成为:
<xmlns:digest="xalan://com.yupstudio.app.downwap.common.util.DigestUtil">
修改主从的xmlns定义一致即可解决问题。 --08-01-18

Posted by: miles
Comments [0] |

Office版本差异导致的.net调用Excel的问题 [Permalink]

Tue Mar 01 11:33:32 CST 2005
Category [development. ~]

为了处理excel文件的数据导入,我使用了Excel.Application这个对象。在我的OfficeXp环境下,打开workbook的做法是这样的:

oWB=oXL.Workbooks.Open(XlsFile.FullName, missing, 
      missing, missing, missing, missing, 
      missing, missing, missing, missing, 
      missing, missing, missing, missing, 
      missing);
可是到了客户的Office2000环境下,竟然出了这个不知所云的错误:

****** [ERROR] ******
msg: 未将对象引用设置到对象的实例。
loc: at Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad) at PriceComparator_Console.Form1.parseFile()
********************


每个实例都货真价实,怎么会有空指针错误呢?经过n小时调试(装VMware和win2kp/office2k用n-1小时 /images/emoticons/cry.gif ),多方查找资料才知道原来是因为两个版本的COM对象的Open方法参数列表不一样!新版另外提供了一个_Open的方法,参数列表和旧版Open一样,以保证兼容性。所以代码变成这样:
oWB=oXL.Workbooks._Open(XlsFile.FullName, missing, 
      missing, missing, missing, missing, 
      missing, missing, missing, missing, 
      missing, missing, missing);
就太平了。另外SaveAs时候office2003和officexp/2000也不一样。同理提供了_SaveAs。

用OleViewer查了COM接口,新的Open加入了
[in, optional] VARIANT Local, 
[in, optional] VARIANT CorruptLoad, 
这样两个参数。应该是新版office提供的功能。不过长此以往,不得______Open了么?反正现在Wookbooks接口的OpenText已经到了__OpenText。。COM不熟,不知道这是不是规范使然。


问题解决了,不过确是挺郁闷。为什么要NullRefException而不是InvalidOperationException呢?但愿是因为.net和COMinterop的关系,所以产生一个正确的异常起来不像想象的那么容易。否则就真的是RPWT了。

Posted by: miles
Comments [0] |

DataGrid.RowHeaderClick 事件 | event [Permalink]

Wed Jan 26 14:06:00 CST 2005
Category [development. ~]

如何得到点击datagrid行首的动作?datagrid类有RowHeaderClick事件,可实际上它的modifier是protected,也就是说不能直接访问。这里只能这样绕弯子:

private bool isHitOnHeader( DataGrid dg ) {
    Point pt = dg.PointToClient(Cursor.Position); 
    DataGrid.HitTestInfo hti = dg.HitTest(pt); 
    return hti.Type == DataGrid.HitTestType.RowHeader;
}
通过测试鼠标hit的位置确定点击性质的确奇怪了一点。MSDN中没有解释。

Posted by: miles
Comments [1] |

?
四月 2024
Sun? Mon? Tue? Wed? Thu? Fri? Sat?
 123456
78910111213
14151617181920
21222324252627
282930    
       
<  Mar???Today??? May  >
<< <   1 2 3 4 5   > >>

Available categories: [/] [development. ~] [working on downwap.] [trouble shooting] [working on Yup Mailman] [general infomation.] [life style]

Powered By blojsom?? RSS Feed? RSS2 Feed? RDF Feed

html hits:?50763