海这边

在安静处听你微弱的声音
 
 

常用链接

  • 我的随笔
  • 我的文章
  • 我的评论
  • 我的参与
  • 最新评论

留言簿(4)

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔分类

  • Eclipse Rcp(2) (rss)
  • EJB (rss)
  • Java(7) (rss)
  • JSF(1) (rss)
  • Reg Expression(1) (rss)
  • web页面(3) (rss)
  • Work Flow(1) (rss)
  • 心情日记(4) (rss)
  • 操作系统(8) (rss)

随笔档案

  • 2011年3月 (1)
  • 2010年6月 (1)
  • 2010年3月 (1)
  • 2010年1月 (1)
  • 2009年9月 (2)
  • 2009年8月 (3)
  • 2009年5月 (2)
  • 2009年4月 (3)
  • 2009年2月 (6)
  • 2009年1月 (3)
  • 2008年12月 (2)
  • 2008年9月 (1)
  • 2008年5月 (1)
  • 2008年3月 (1)
  • 2008年1月 (1)
  • 2007年12月 (1)
  • 2007年11月 (4)
  • 2007年10月 (5)
  • 2007年9月 (1)
  • 2007年8月 (1)
  • 2007年7月 (2)
  • 2007年5月 (1)
  • 2007年4月 (1)
  • 2007年3月 (6)
  • 2007年2月 (2)
  • 2006年11月 (3)

文章档案

  • 2006年11月 (1)
  • 2006年10月 (7)
  • 2006年9月 (1)

最新随笔

  • 1. 通过Javascript代码触发事件
  • 2. linux下 mysql 备份代码
  • 3. 为Apache增加重定向功能rewrite
  • 4. Hibernate Annotation Mapping of ManyToMany
  • 5. html element
  • 6. 解决 Spring +Hibernate+DWR中出现“No converter found for 'org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer'”
  • 7. 解决 birt report 中 "Invalid javascript expression. dataSetRow["name"]"
  • 8. 用JSTL访问MAP类型
  • 9. Hibernate 延迟加载时, 用instanceof判断被延迟加载对象的类型
  • 10. 你用Spring的packagesToScan了吗?
  • 11. linux 远程自动备份MySQL数据
  • 12. Eclipse 中 将Java Project 转换为Dynamic Web Project
  • 13. 同窗的早逝
  • 14. 解决 Fiddler 在IE8中不识别 localhost 的问题
  • 15. 美好的清晨
  • 16. Java抓图软件
  • 17. JBPM 3.3+jboss 4.2.3+mysql 5 安装回忆录
  • 18. 程序界面草图设计工具Balsamiq Mockups 试用体验
  • 19. Eclipse RCP 切换到另一个视图的代码
  • 20. 感谢死亡
  • 21. 制作8G启动U盘-方法2 利用 UltroISO
  • 22. 制作8G启动U盘- 方法1 利用 DiskGenius
  • 23. 普普通通的大年初一2009
  • 24. 更新TableViewer选中行的内容
  • 25. remove empty elements from a xml string using RegExpress
  • 26. VirtualBox的网络配置与使用中的一些问题
  • 27. ubuntu8 jdk
  • 28. 又见春天
  • 29. 2008祝愿
  • 30. 解决 Qt (>= Qt 3.3 and < 4.0)
  • 31. 悲伤的一天
  • 32. Linux 学习点滴 之一 --------组与用户
  • 33. Junit越来越爽了
  • 34. 在WEB页面上创建一个彩色下拉列表框
  • 35. IceFaces 安装 auctionMonitor 示例
  • 36. Solaris 中升级jdk和简单步骤
  • 37. To Convert String to Date using JavaScript
  • 38. 使用For遍历Map
  • 39. Service Command in Linux
  • 40. 北京--看不见的城市

搜索

  •  

最新评论

  • 1. re: 你用Spring的packagesToScan了吗?
  • 评论内容较长,点击标题查看
  • --zhang0xin
  • 2. re: 你用Spring的packagesToScan了吗?
  • 把这个包com.pplus.model.*,加到context:component-scan 里去,就可以了
  • --roman
  • 3. re: Eclipse 中 将Java Project 转换为Dynamic Web Project
  • 评论内容较长,点击标题查看
  • --最代码
  • 4. re: 解决 Fiddler 在IE8中不识别 localhost 的问题[未登录]
  • 评论内容较长,点击标题查看
  • --啊啊
  • 5. re: 解决 birt report 中 "Invalid javascript expression. dataSetRow["name"]"
  • 我也遇到这个问题,可是项目中如你所说的冲突的jar包啊
  • --birt

阅读排行榜

  • 1. 你用Spring的packagesToScan了吗?(13694)
  • 2. Eclipse 中 将Java Project 转换为Dynamic Web Project(7495)
  • 3. 程序界面草图设计工具Balsamiq Mockups 试用体验(5538)
  • 4. 解决 Fiddler 在IE8中不识别 localhost 的问题(4029)
  • 5. 解决 Spring +Hibernate+DWR中出现“No converter found for 'org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer'”(3847)

评论排行榜

  • 1. 程序界面草图设计工具Balsamiq Mockups 试用体验(14)
  • 2. Eclipse 中 将Java Project 转换为Dynamic Web Project(7)
  • 3. 你用Spring的packagesToScan了吗?(6)
  • 4. 解决 Spring +Hibernate+DWR中出现“No converter found for 'org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer'”(4)
  • 5. Junit越来越爽了(4)

Powered by: 博客园
模板提供:沪江博客
BlogJava | 首页 | 发新随笔 | 发新文章 | 联系 | 聚合 | 管理

how to make DWRUtil.addRows not output html source code?
If i want to put a inputbox into a row in the function of  DWRUtil.addRows, I use the code below:
    DWRUtil.addRows(id, ["<input type='text' />" ]);
 When we browse the result in a browser, we can see the source code of "<input type='text'/>" instead of the inputbox. how to resolve it ?

OK. We use "DWRUtil.setEscapeHtml(false);" before we invoke DWRUtil.addRows();

posted @ 2007-08-23 16:12 与你同飞 阅读(288) | 评论 (0) | 编辑 收藏
 
你们把我也和谐了吧
     摘要: 只因为跟过洪水的贴子,济南一位网友就被逮捕了,反应之迅速让我知道他们还是有战斗力的。

当人们被困在地下商城的时候不见这样的迅速,该打开水闸的时候不见这样的迅速,该公布真相的时候不见这样的迅速,该向公民道歉的时候不见这样的迅速。  阅读全文
posted @ 2007-07-26 09:25 与你同飞 阅读(282) | 评论 (0) | 编辑 收藏
 
Control Services in Solaris
     摘要: For example, I will control JBoss service.
1. svcadm restart application/Jboss
2. svcadm clear application/Jboss
3. svcadm enable application/Jboss
4. svcadm disable application/Jboss  阅读全文
posted @ 2007-07-09 16:32 与你同飞 阅读(202) | 评论 (0) | 编辑 收藏
 
Add "Windows Command" to the Right_Click Event of Windows
1.Regedit
2. Create a structure like this:
      HKEY_CLASS_ROOT
             |
             |----Folder
                     |
                     |-----shell
                               |
                               |------windows command (newly created)
                                              |
                                              |----command  (default, REG_SZ, cmd/K cd/d %L)
posted @ 2007-05-19 08:43 与你同飞 阅读(204) | 评论 (0) | 编辑 收藏
 
vnc server 设置 (转贴)

由于客户需要充分利用花了N多money购买的服务器,而服务器上运行的是Linux AS,客户又不太会使用文本模式,因此只好采用配置X-server的方式来给每一个用户一个图形终端了,这多亏了X-windows设计的先进性呀。
为了简单,我就使用了Linux自带的vnc-server。
代码::
#uname -a
Linux server1.linux 2.4.21-4.ELsmp #1 SMP
#rpm -q vnc-server
vnc-server-4.0-0.beta4.1.1

你可以使用特定的帐号来运行你的vncserver命令。这样可以做到同时有多个用户登录图形终端。同时一个图形终端编号只能有一个用户登录。
代码::
#useradd demo
#passwd -d demo
#su demo
$vncserver
passwd: //如果这个帐号是第一次运行vncserver,则会要求你输入连接的密码。
verify:
New 'server1.linux:4 (demo)' desktop is server1.linux:4
Starting applications specified in /home/demo/.vnc/xstartup
Log file is /home/demo/.vnc/server1.linux:4.log

上面这段话表示起动了一个图形终端,编号为4,要记住这个编号,等下登录时需要提供这个编号。
如果你要停止这个进程,使用
代码::
$vncserver -kill :4

就可以了,后面的数字表示图形终端编号。
ok,这样,x-server已经起动了。
我们来测试一下。
找另外一台机器,如果是Linux的系统,那就比较方便,直接使用下面的命令
代码::
#vncviewer xx.xx.xx.xx:4 ;连接方式是ip地址:编号,这里的编号是4.

会弹出一个对话框,要求你输入密码,如果密码正确,这是就会出现图形终端了。
如果是windows的机器,那就下载一个vnc的软件吧。我用的是winVNC。
连接方式是一样的。
不过大家也看到了,虽然图形界面是看到了,但是好丑呀!的确,因为默认的图形终端采用xterm+twm,桌面上什么都没有。如果能使用默认的GNOME或者KDE或者FVWM等X-manager该有多好?
没有问题,接下来的配置就是解决这个问题。
每当一个帐号运行一次vncserver后,就会在家目录下创建.vnc目录。
里面有一个可执行脚本xstartup。看看里面的内容就知道了,默认起动的是twm。
那么我们就修改这个文件吧,去掉里面的所有内容,写入下面一行
代码::
gnome-session

这样就指定起动gnome。
也可以写入
代码::
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

表示起动默认的图形管理器。
保存退出,然后重新起动vncserver。
代码::
$vncserver -kill :4
$vncserver

然后到客户端去连接X-server,看是不是变得漂亮些啦。
可能你又会问了,如果我有1000个用户呢,是不是每一个用户都需要去修改这个文件呀,那多麻烦呀。
那我们就找到根源吧,看到底xstartup是谁创建的。
找到/usr/bin/vncserver,他是一个perl脚本程序。
打开看看
转到43行,你就会看到
$defaultXStartup变量的定义了,看到了吧。
这下你知道怎么改了吧。
把他变成这个样子:
代码::
$defaultXStartup
 = ("#!/bin/shnn".
 "# Uncomment the following two lines for normal desktop:n".
 "unset SESSION_MANAGERn".
 "exec /etc/X11/xinit/xinitrcnn".
 "#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresourcesn".
 "#xsetroot -solid greyn".
 "#vncconfig -iconic &n".
 "#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &n".
 "#twm &n");

实际上就是去掉最前面的两行注释,注释掉下面的几行。保存退出。
你再创建一个帐号,运行vncserver看看。
是不是默认的图形终端就修改了呢?
我的任务完成了。
需要去面试了。
大家试试吧。
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=624227

posted @ 2007-04-02 10:19 与你同飞 阅读(1309) | 评论 (0) | 编辑 收藏
 
Hibernate Cache in AppFuse
In a module of my application, a complex query is very slow. It needs about 5 seconds because the application gets data from nearly 10 tables. Most of the 10 tables are not updated often. Therefor I decided to use cache for the 10 tables.
Software: Spring+hibernate
ehcache is the default cache for hibernate. So I choosen it.

Step1.  Modify ehcache.xml in /webroot/web-inf/classes. the content is below:
            
           <ehcache>
                <diskStore path="java.io.tmpdir" />
                <defaultCache maxElementsInMemory="10000" eternal="false"
                    overflowToDisk="true" timeToIdleSeconds="120" timeToLiveSeconds="120"
                    diskPersistent="false" diskExpiryThreadIntervalSeconds="120" />
            </ehcache>


Step2. Configure applicationContext-hibernate.xml in the spring framework.
             .....
            <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">       
                 .....
                     <prop key="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</prop>
                    <prop key="hibernate.cache.use_query_cache">true</prop>
                    <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>

                 ...
            </bean>

Step3. Configure the hibernate mapping file(ie. *.hbm.xml), add a new attribute:
            <cache usage="read-only"/>

Step 4. Change the dao. Before it retireves data, it will be asked to use cache, for example:
                   getHibernateTemplate().setCacheQueries(true);
               or
                   query.setCacheable(true)

Now, everything looks very good. It only need less than 1 second to get all the data. Much faster than before.

          
posted @ 2007-03-27 11:34 与你同飞 阅读(339) | 评论 (0) | 编辑 收藏
 
Why mysql is so slow?
1. There are many configuration files for mysql. There name looks like my-huge.cnf, my-medium.cnf.... Select the best one for our system and copy it as /etc/my.cnf. 

2. open /etc/my.cnf(gedit, or vi).  Goto the "mysqld" section, and add a new line:
     skip-name-resolve    #Do not resolve hostnames.

3. restart mysql.


posted @ 2007-03-23 10:59 与你同飞 阅读(190) | 评论 (0) | 编辑 收藏
 
JBoss 4.0.2集群指南 (zt)
I tested it, and it works very good.


JBoss 4.0.2集群指南

bromon原创 请尊重版权

    本文主要讲解JBoss cluster的基本知识以及简单的配置方法,其间涉及了一些jboss的补充知识。

一、材料准备:

1、    JBoss 4.0.2    

JBoss各个版本之间差异比较大,即使同为jboss 4.x的版本,内部组件的版本也不一致,所以请尽量使用同一版本的server。目前已经证明可以配置cluster的版本多为jboss 3.2.6和jboss 4.0.2。

2、    Apache 2.0.54

3、    Apache mod_jk-1-2-13-apache-2-0-54

二、安装:

1、    jboss4.0.2与apache 2.0.54的安装请自行搞定。假设jboss的安装目录为%jboss%,apache安装目录为%apache%。

2、    mod_jk的安装。

从apache.org获得文件mod_jk-1-2-13-apache-2-0-54.so,将该文件拷贝到%apache%\ modules。

三、jboss cluster入门

    Jboss 支持如下类型的cluster:EJB、web、JNDI、JMS,我们主要了解web cluster。
Web cluster实际上可以划分为两个话题:负载均衡 (load balance) 和状态同步。它们是互相独立的,单独配置。

负载均衡的概念比较简单,重要的是负载均衡的粒度。可以选择针对每个request的均衡,或者是针对每个用户的均衡。选择不同的粒度,需要不同的状态同步方式。

1、基于request的负载均衡

    该种方式下,负载均衡器 (load balancer)会根据各个node的状况,把每个http request进行分发。使用这样的均衡策略,就必须在多个node之间复制用户的session,实时保持整个cluster的用户状态同步,这种操作 被称为session复制(session replication)。Jboss的实现原理是使用拦截器(interceptor),根据用户的同步策略拦截request,做同步处理后再交给 server产生响应。

    该方法的优点是客户不会被绑定都具体的node,只要还有一个node存活,用户状态都不会丢失,cluster都能够继续工作。缺点是node之间通信频繁,响应速度有影响,多并发、高频操作的情况下性能下降比较厉害。

2、    基于用户的负载均衡

该 种方式下,当用户发出第一个request后,负载均衡器动态的把该用户分配到某个节点,并记录该节点的jvm路由,以后该用户的所有request都会 被绑定这个jvm路由,用户只会与该server发生交互,这种策略被称为粘性session(session sticky)。

该方法的优点是响应速度快,多个节点之间无须通信。缺点也很明显,某个node死掉以后,它负责的所有用户都会丢失session。

四、实战

1、负载均衡

    Jboss的负载均衡目前有两种方案,一是使用apache的mod_jk,二是使用jboss自带的负载均衡模块。下面分别讲解这两种配置。

mod_jk的配置

1、    请确认%apache%\modules下已经有mod_jk-1-2-13-apache-2-0-54.so文件。
2、    修改%apache%\conf\httpd.conf    在文件末尾添加:    Include conf/mod_jk2.conf
3、    在%apache%\conf下新建文件    mod_jk2.conf        文件内容如下:

# Load mod_jk module. Specify the filename
# of the mod_jk lib you’ve downloaded and
# installed in the previous section
LoadModule jk_module modules/mod_jk-1-2-13-apache-2-0-54.so
# Where to find workers.properties
JkWorkersFile conf/workers2.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
JkMount /* loadbalancer

其中JkMount /* loadbalancer的意思是,把所有的请求都发给loadbalancer处理。可以通过修改url来控制发送某些request。
4、在%apache%\conf下新建文件    workers2.properties        其内容为:

worker.list=loadbalancer,server1,server2

# Define the first node...
worker.server1.port=8009
worker.server1.host=172.16.0.116
worker.server1.type=ajp13
worker.server1.lbfactor=1
worker.server1.local_worker=1
worker.server1.cachesize=10

# Define the first node...
worker.server2.port=8009
worker.server2.host=172.16.32.88
worker.server2.type=ajp13
worker.server2.lbfactor=1
worker.server2.local_worker=1
worker.server2.cachesize=10

# Now we define the load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=server1,server2
worker.loadbalancer.sticky_session=1

其 中对于node的命名规则是worker.节点名.xxxx。所以上述文件定义了两个节点:server1和server2。8009端口是jboss默 认的ajp端口,另外需要注意的是worker.server2.lbfactor参数,它是节点的负载加权,它的值越大,获得负载的机会就越大。可以根 据node的硬件性能进行调整。worker.loadbalancer.sticky_session参数是指定是否使用粘性session。

所有需要负载均衡的节点,都必须在worker.loadbalancer.balanced_workers参数中列举出来。

请记住所有node的名称和它对应着哪台机器,后面的配置中会使用。

尝试启动apache:%apache\bin\apache.exe,正常情况下没有任何提示。如果你使用的jk是2.0的,那么配置文件的写法完全不同,由于mod_jk2已经停止开发,所以apache并没有提供任何讲解,对于配置文件的编写也没有任何指导。

Jboss自带均衡器的配置

    将文件夹%jboss%\docs\examples\varia\loadbalancer\loadbalancer.sar拷贝到%jboss% \server\all\deploy下,并且修改loadbalancer.sar\loadbalancer.sar\META-INF\jboss -service.xml,在<host>标签中类出所有节点,在<sticky-session>标签中指定是否使用粘性 session。配置完成。

    该均衡器的缺点是负载能力相对不高,配置参数太少,比如无法指定不同节点的负载加权,所以后面都以mod_jk为例,不再讲解jboss自带的负载均衡器的内容。
 

    负载均衡的配置基本完成,启动jboss,其中过程中会列出DefaultPatition中所有的节点:
run.bat  -c all



任何节点的关闭与启动都会在cluster中广播,比如加如一个新节点后,其他节点会得到以下提示:
 


2、session sticky配置

    apache应该会以粘性session的方式分发请求。部署一个应用测试一下,你会发现粘性session没有起作用。因为我们还没有给jboss配 置jvm路由( jvmRoute),apache就无法知道究竟哪些session是属于哪个节点的。我们继续往下:

    修改server1机器上的jboss的配置文件:%jboss%\server\all\deploy\jbossweb-tomcat55.sar\ META-INF\ jboss-service.xml

    在110行有:<attribute name="UseJK">false</attribute>,将它改为true。值得注意的是在这行标签上面有一段注释,要求你在server.xml中必须有:
Engine name="jboss.web" jmvRoute="Node1" defaultHost="localhost"

    请注意这里有一个气死人不偿命的小bug,jboss的官方文档把 jvmRoute写成了jmvRoute,就是v和m两个字母的颠倒让我郁闷了三天,翻遍了jboss.com和theserverside.com。都是直接拷贝的错,吐血吐到脱水啊。

    下面需要修改server1上的%jboss%\server\all\deploy\jbossweb-tomcat55.sar\ server.xml,在32行左右有:

<Engine name="jboss.web" defaultHost="localhost">

给它增加一个jvmRoute属性:

<Engine jvmRoute="server1" name="jboss.web" defaultHost="localhost">

请注意,jvmRoute的值必须和mod_jk中的节点名字正确对应,否则无法正确路由。Cluster中的所有节点都应该做相应的配置。

Jboss的配置完成了,下面需要在你的web应用中修改配置文件,让它支持集群。

在WEB-INF\web.xml中加入属性:    <distributable/>

Ok,基于用户的cluster完成了,每个用户会绑定都某个节点上进行交互。这种绑定是如何完成的呢?原来apache把客户分发到节点后,该节点会在用户的session id后面加上此节点的路由名称,变成这个样子:

Efdfxxd98daja87daj76da2dka**,server1

    有了这个标志,就能分辨该session属于哪个节点。

3、session replication配置

    下面要做的是基于request的cluster,也就让各个节点之间互相复制session状态。有两种复制模式,同步与异步。使用同步的方式, jboss会把session复制的操作和对request的响应放到一个应用事务(application transaction),session复制完成后才去处理request。异步复制则发送session复制的消息后马上处理request, session复制则会稍有延迟。但是在多框架的web页面中,这样的集群方式会有问题。由于frame在同一时间发出多个request,会造成一些混 乱,这也是采用基于用户的集群方式的原因之一。

    JBoss 4.0.2中采用了Jboss cache来实现session复制,实际上就是一个分布式缓存,由于session id中包含了jvm route,所以能够分辨session属于哪个节点。Session的更新类似于hibernate中的乐观锁,有了更新之后就让session的版本 号增加,其他节点通过对比版本号来决定是否同步session状态。

    配置session replication首先需要编辑
%jboss% server\all\deploy\jbossweb-tomcat55.sar\META-INF\ jboss-service.xml,88行左右有:
<attribute name="SnapshotMode">instant</attribute>
这 就是刚才提到的复制模式,instant为立即复制,如果设为interval 那么系统会在延迟一段时间再进行复制,时间长度在<attribute name="SnapshotInterval">2000</attribute>中指定,单位是毫秒。

单独配置这一个地方还不够,在%jboss% server\all\deploy\ tc5-cluster-service.xml中有:

<attribute name="CacheMode">REPL_ASYNC</attribute>

这里才真正决定复制是同步的还是异步的,可以指定为REPL_ASYNC(异步)或者REPL_SYNC(同步)。

在 这个文件下面一点,还有一个config标签,里面指定了各个节点在进行session复制的时候如何通信,有udp和tcp两种可选,如果使用udp方 式,那么应该将udp的lookback属性指定为true,因为windows上有一个叫做media sense的东西会影响udp multicast。注意如果你不了解multi address的ip规则,请不要随便修改mcast_addr的值。如果采用tcp方式的话,应该指定bind_addr的值为本机ip,并且在 TCPPING标签的initial_hosts属性中列出所有节点,格式是”机器名[端口号]”,比如在我们的例子中,就应该这样配置tcp(以其中一 个节点为例):

<config>
<TCP bind_addr="172.16.0.116" start_port="7810" loopback="true"/>
<TCPPING initial_hosts="172.16.0.116[7810],172.16.32.88[7810]" port_range="3" timeout="3500"
num_initial_members="3" up_thread="true" down_thread="true"/>
<MERGE2 min_interval="5000" max_interval="10000"/>
<FD shun="true" timeout="2500" max_tries="5" up_thread="true" down_thread="true" />
<VERIFY_SUSPECT timeout="1500" down_thread="false" up_thread="false" />
    <pbcast.NAKACK down_thread="true" up_thread="true" gc_lag="100"
         retransmit_timeout="3000"/>
    <pbcast.STABLE desired_avg_gossip="20000" down_thread="false" up_thread="false" />
    <pbcast.GMS join_timeout="5000" join_retry_timeout="2000" shun="false"
print_local_addr="true" down_thread="true" up_thread="true"/>
<pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
</config>

    JBoss的clustering版主建议尽量使用udp。不过在Sobey内部,建议使用tcp方式,经测试可能有不明物体在影响udp通信,导致Timeout异常。

    在%jboss%\ server\all\deploy\ cluster-service.xml中也有关于udp和tcp的配置信息,在4.0以前版本的jboss中,会以这个文件为主配置,4.0以后都以 tc5-cluster-service.xml为主配置。

    Jboss的配置完成了,最后需要在web应用中增加配置信息,控制session复制的粒度。在WEB-INF\    jboss-web.xml中增加以下内容:

<replication-config>
    <replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger>
    <replication-granularity>SESSION</replication-granularity>
  </replication-config>

其中replication-trigger是指定哪些操作引发session的版本更新,它的取值有:

SET_AND_GET        
SET_AND_NON_PRIMITIVE_GET
SET

replication-granularity是复制粒度,可以取session或attribute。如果取为attribute有可能导致复制失败,这是目前版本的jboss cache的一个bug,等待修正。

部署项目,测试,如果配置没有问题,可以在%jboss%\0server\all\log\server.log中发现类似于这样的信息:

DEBUG [org.jboss.web.tomcat.tc5.session.JBossCacheManager] check to see if needs to store and replicate session with id Im9-qpuaXppMS+xXwE3M+Q**.server1

DEBUG [org.jboss.web.tomcat.tc5.session.ClusteredSession] processSessionRepl(): session is dirty. Will increment version from: 20 and replicate.

    Session replication配置的成功率比较低,情况也很复杂,请仔细操作。

五、分布式热部署(distributable hot deploy)

    在一个节点很多的cluster中,如果部署应用的时候必须把程序文件拷贝到每个机器上的话,那实在太愚蠢了,幸好通过all启动的jboss自动支持 分布式热部署。把支持cluster的应用(通常需要打包成war文件),放到%jboss%\server\all\farm下,那么处于同一 cluster中的其他节点会自动下载并且部署,jboss把这个称为Farm deploy。如下图:



End 2005-7-11 Released by bromon

作者Blog: http://blog.csdn.net/bromon/
posted @ 2007-03-21 13:40 与你同飞 阅读(335) | 评论 (1) | 编辑 收藏
 
Setup dual monitors in Fedora 6

Hardware: ATI Radeon x1300, ViewSonic LCD monitors(In fact, It can be any LCD);

Software: Fedora 6

The most important is to update ATI Driver for Fedora. Fedora 6 supports ATI Radeon x1300 by default. But it does not support two monitors(or the two monitors look like a mirror of each other).

  1. Install ATI driver for fedora(logon as root)

rpm -Uhv http://rpm.livna.org/livna-release-6.rpm
yum install kmod-fglrx xorg-x11-drv-fglrx
yum update kmod-fglrx xorg-x11-drv-fglrx

fglrx? Yes. It is for ATI Radeon.

  1. Make a copy of /etc/X11/xorg.conf, such as cp /etc/X11/xorg.conf.save, in case of any exception.

  2. Open a terminal:

# export PATH=/opt/ati/bin:$PATH

/opt/ati/bin/aticonfig --initial --input=/etc/X11/xorg.conf

aticonfig --initial=dual-head --screen-layout=right

aticonfig --dtop=horizontal --overlay-on=1

aticonfig --resolution=0,2048x768,1024x768

  1. edit /etc/X11/xorg.conf. In my case its content is below.


# Xorg configuration created by system-config-display


Section "ServerLayout"

Identifier "single head configuration"

Screen 0 "aticonfig-Screen[0]" 0 0

InputDevice "Keyboard0" "CoreKeyboard"

EndSection


Section "Files"

EndSection


Section "Module"

EndSection


Section "InputDevice"

Identifier "Keyboard0"

Driver "kbd"

Option "XkbModel" "pc105"

Option "XkbLayout" "us"

EndSection


Section "Monitor"

Identifier "aticonfig-Monitor[0]"

Option "VendorName" "ATI Proprietary Driver"

Option "ModelName" "Generic Autodetecting Monitor"

Option "DPMS" "true"

EndSection


Section "Monitor"

Identifier "aticonfig-Monitor[1]"

Option "VendorName" "ATI Proprietary Driver"

Option "ModelName" "Generic Autodetecting Monitor"

Option "DPMS" "true"

EndSection


Section "Device"

Identifier "aticonfig-Device[0]"

Driver "fglrx"

Option "DesktopSetup" "horizontal"

Option "OverlayOnCRTC2" "1"

EndSection


Section "Device"

Identifier "aticonfig-Device[1]"

Driver "fglrx"

EndSection


Section "Screen"

Identifier "aticonfig-Screen[0]"

Device "aticonfig-Device[0]"

Monitor "aticonfig-Monitor[0]"

DefaultDepth 24

SubSection "Display"

Viewport 0 0

Depth 24

Modes "2560x1024" "1280x1024"

EndSubSection

EndSection


Section "Screen"

Identifier "aticonfig-Screen[1]"

Device "aticonfig-Device[1]"

Monitor "aticonfig-Monitor[1]"

DefaultDepth 24

Option "Xinerama" "on"

Option "Clone" "off"

SubSection "Display"

Viewport 0 0

Depth 24

Modes "1280x1024"

EndSubSection

EndSection


  1. In a termainl, input “init 3” to close the X window and turn to the Text Mode.

  2. IN the Text Mode, logon as root. Input “init 5” to restart X window. As we can see, It works!

  3. If any exception occurs and Fedora can not start, please restore /etc/X11/xorg.conf with the backup copy.

posted @ 2007-03-20 10:51 与你同飞 阅读(588) | 评论 (0) | 编辑 收藏
 
Fix Oracle

The folder of Oracle locates at /usr/local/oracle/product/10.1.0/db_1

  1. Check if the environment ORACLE_HOME exists.

ORACLE_HOME=/usr/local/oracle/product/10.1.0/db_1

ORACLE_SID=TEST

  1. Open /usr/local/oracle/product/10.1.0/db_1/bin/dbstart

ORACLE_HOME_LISTNER=/usr/local/oracle/product/10.1.0/db_1

  1. CD  /usr/local/oracle/product/10.1.0/db_1/bin
  2. Start Oracle Listener

./lsnrctl start

The configuration file of the Listener locates at /usr/local/oracle/product/10.1.0/db_1/network/admin/listener.ora

  1. Start Oracle

./dbstart

  1. Make sure the content of /etc/oratab looks like the below:

            orcl:/usr/local/oracle/product/10.1.0/db_1:Y

posted @ 2007-03-15 13:28 与你同飞 阅读(197) | 评论 (0) | 编辑 收藏
 
dojo 动态增加widget(from http://www.agiletao.com/read.php?tid=555)
dojo 动态增加widget

CODE:
var dropdownDatePicker = dojo.widget.createWidget("DropdownDatePicker", {
           inputId: "redPicker",
                                width: "160px",
                                displayFormat="dd/MM/yyyy"
           
       });

var dateDiv = document.creatElement("div");
dateDiv.appendChild(dropdownDatePicker .domNode);
[Copy to clipboard]


这样就可以了。

其他拼装HTML的方式都是不可行的。要不widget都不能出来,要不event不能执行。
posted @ 2007-03-05 08:38 与你同飞 阅读(297) | 评论 (0) | 编辑 收藏
 
use SQL directly in Hibernate
please do as the below.

String hql="SELECT p.driverid, p.framestart, p.frameend, p.timestart, p.timeend" +
                    " FROM  TcnrDriverPreference p, TcnrDriver d WHERE (p.driverid=d.driverid) and (d.yardid=:yardid) and " +
                    "(p.timestart<=:timestart) and (p.timeend>=:timeend) ";
        Query query=getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery(hql);
        query.setInteger("yardid", yardid);
        query.setTime("timestart", tcnrShift.getTimestart());
        query.setTime("timeend", tcnrShift.getTimeend());
        List<TcnrDriverPreference> list=query.list();
        List<TcnrDriverPreference> tcnrDriverPreferenceList=new ArrayList<TcnrDriverPreference>();
        for(Iterator iterator=list.iterator();iterator.hasNext();) {
            Object[] row=(Object[])iterator.next();
            TcnrDriverPreference tcnrDriverPreference=new TcnrDriverPreference();
            tcnrDriverPreference.setDriverid((Integer)row[0]);
            tcnrDriverPreference.setFramestart((Integer)row[1]);
            tcnrDriverPreference.setFrameend((Integer)row[2]);
            tcnrDriverPreference.setTimestart((Time)row[3]);
            tcnrDriverPreference.setTimeend((Time)row[4]);
           
            tcnrDriverPreferenceList.add(tcnrDriverPreference);
        }

posted @ 2007-02-27 13:36 与你同飞 阅读(230) | 评论 (0) | 编辑 收藏
 
How to config JBoss to use log4j and jdk1.5

To resolve the first problem
1. open "{jboss_home}\server\default\deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml".
2.  <attribute name="Java2ClassLoadingCompliance">true</attribute>
      <attribute name="UseJBossWebLoader">
true</attribute>

To resolve the second problem
1. open "{jboss_home}\server\default\deploy\jbossweb-tomcat55.sar\conf\web.xml".
2. locate at "<servlet>" entry, try to find "<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>"
3. Add  2 init-params as following:
            <init-param>
               <param-name>compilerSourceVM</param-name>
               <param-value>
1.5</param-value>
            </init-param>

            <init-param>
               <param-name>compilerTargetVM</param-name>
               <param-value>1.5</param-value>
            </init-param>   

4. If we want to use Log4j.properties in our own application, modify "{jboss_home}\server\default\conf\jboss_service.xml":
    <mbean code="org.jboss.logging.Log4jService" name="jboss.system:type=Log4jService,service=Logging">
         <attribute name=
"ConfigurationURL">resource:log4j.xml</attribute>
         <attribute name=
"CatchSystemOut">false</attribute>
         <attribute name=
"Log4jQuietMode">true</attribute>
    </mbean>
posted @ 2007-02-23 17:25 与你同飞 阅读(591) | 评论 (1) | 编辑 收藏
 
Remote Debugging In Eclipse

   Most of the Java application servers, such as JBoss, Websphere, weblog, follow a rule of JPDA (Java Platform Debugger Architecture). The JPDA make it possible to have a remote debugger from the app server. The only two things we have to do are below:

     1. Enable remote debugging function of our application server; 
     2. Config parameters of remote debugging in Eclipse. 

  Here is an example of  JBoss following the above steps:

    1.  Enable remote debugging function of our application server; 
         Open ${JBoss_Home}\bin\run.bat(or run.sh for linux). Fortunately, we can find a line "rem JPDA options. Uncomment and modify as appropriate to enable remote debugging." .  So what we should do is to Uncomment the next line instead of doing anything else. After finishing it, we start the server and we can see the server is waiting for the remoting connection, prompting: Listening for transport dt_soctet at address:8787.

  2.Config parameters of remote debugging in Eclipse.

    Config Debug . Add a Remote Java Application, which is our application. Behold, the connection port must be same as it is in run.bat. The default value should be 8787. At last click "Debug" button.

 Now, we can debug the server.

PS. In order to make the debugger work properly,  The class files published must have the same version with our java source files.

posted @ 2006-11-03 16:22 与你同飞 阅读(335) | 评论 (0) | 编辑 收藏
 
Testing in Spring Project (1)-DAO Test
     摘要: This article shows how to have a dao test in the spring framework. Although it is easy, I hope it is a bit of useful for any spring beginner. Enjoy it.  阅读全文
posted @ 2006-11-03 09:57 与你同飞 阅读(1094) | 评论 (0) | 编辑 收藏
 
Reg Expression for a IP Address
((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)
posted @ 2006-11-02 13:20 与你同飞 阅读(204) | 评论 (0) | 编辑 收藏
 
仅列出标题
共2页: 上一页 1 2