??xml version="1.0" encoding="utf-8" standalone="yes"?>激情综合色综合久久综合,亚洲成人影院少妇,亚洲国产精品wwwhttp://www.aygfsteel.com/rednight/0x2B|~0x2B,That's not a question,Just do it.zh-cnSun, 18 May 2025 14:00:57 GMTSun, 18 May 2025 14:00:57 GMT60消息中间件和JMShttp://www.aygfsteel.com/rednight/archive/2007/04/11/109941.htmlrednightrednightWed, 11 Apr 2007 08:41:00 GMThttp://www.aygfsteel.com/rednight/archive/2007/04/11/109941.htmlhttp://www.aygfsteel.com/rednight/comments/109941.htmlhttp://www.aygfsteel.com/rednight/archive/2007/04/11/109941.html#Feedback0http://www.aygfsteel.com/rednight/comments/commentRss/109941.htmlhttp://www.aygfsteel.com/rednight/services/trackbacks/109941.html当前QCORBA、DCOM、RMI{RPC中间件技术已q泛应用于各个领域。但是面对规模和复杂度都来高的分布式pȝQ这些技术也昄出其局限性:(x)Q?Q同步通信Q客户发用后Q必ȝ待服务对象完成处理ƈq回l果后才能l执行;Q?Q客户和服务对象的生命周期紧密耦合Q客戯E和服务对象q程都必L常运行;如果׃服务对象崩溃或者网l故障导致客L(fng)h不可达,客户?x)接收到异常Q(3Q点对点通信Q客L(fng)一ơ调用只发送给某个单独的目标对象?
   面向消息的中间gQMessage Oriented MiddlewareQMOMQ较好的解决了以上问题。发送者将消息发送给消息服务器,消息服务器将消息存放在若q队列中Q在合适的时候再消息{发给接收者。这U模式下Q发送和接收是异步的Q发送者无需{待Q二者的生命周期未必相同Q发送消息的时候接收者不一定运行,接收消息的时候发送者也不一定运行;一对多通信Q对于一个消息可以有多个接收者?
   已有的MOMpȝ包括IBM的MQSeries、Microsoft的MSMQ和BEA的MessageQ{。由于没有一个通用的标准,q些pȝ很难实现互操作和无缝q接。Java Message ServiceQJMSQ是SUN提出的旨在统一各种MOMpȝ接口的规范,它包含点对点QPoint to PointQPTPQ和发布/订阅QPublish/SubscribeQpub/subQ两U消息模型,提供可靠消息传输、事务和消息qo{机制?/font>

1.JMS
   JAVA 消息服务(JMS)定义了Java 中访问消息中间g的接口。JMS 只是接口Qƈ没有l予实现Q实现JMS 接口的消息中间gUCؓ(f)JMS ProviderQiLink实现了JMS接口Q用户可以通过使用JMS接口Q在iLink中进行JMS~程?iLink支持JMS1.0.2版本?

2.JMS接口描述
   JMS 支持两种消息cdPTP 和Pub/SubQ分别称作:(x)PTP Domain 和Pub/Sub DomainQ这两种接口都承统一的JMS父接口,JMS 主要接口如下所C:(x)

MS父接?/font>

PTP

Pub/Sub

ConnectionFactory

QueueConnectionFactory

TopicConnectionFactory

Connection

QueueConnection

TopicConnection

Destination

Queue

Topic

Session

QueueSession

TopicSession

MessageProducer

QueueSender

TopicPublisher

MessageConsumer

QueueReceiver,QueueBrowse r

TopicSubscriber

 

 

 

                  
   ConnectionFactory Q连接工厂,JMS 用它创徏q接
   Connection QJMS 客户端到JMS Provider 的连?br>   Destination Q消息的目的?br>   SessionQ?一个发送或接收消息的线E?br>   MessageProducerQ?由Session 对象创徏的用来发送消息的对象
   MessageConsumerQ?由Session 对象创徏的用来接收消息的对象

3.JMS消息模型
JMS 消息׃下几部分l成Q消息头Q属性,消息体?br>  
3.1 消息?Header) - 消息头包含消息的识别信息和\׃息,消息头包含一些标准的属性如QJMSDestination,JMSMessageID {?

 消息?/font>

 p讄

JMSDestination

send ?publish Ҏ(gu)

JMSDeliveryMode

send ?publish Ҏ(gu)

JMSExpiration

send ?publish Ҏ(gu)

JMSPriority

send ?publish Ҏ(gu)

JMSMessageID

send ?publish Ҏ(gu)

JMSTimestamp

send ?publish Ҏ(gu)

JMSCorrelationID

客户

JMSReplyTo

客户

JMSType

客户

JMSRedelivered

JMS Provider

 

 

        
 

 

 

      


3.2 属?Properties)
- 除了消息头中定义好的标准属性外QJMS 提供一U机制增加新属性到消息?中,q种新属性包含以下几U:(x)
   1. 应用需要用到的属?
   2. 消息头中原有的一些可选属?
   3. JMS Provider 需要用到的属性?br>   标准的JMS 消息头包含以下属性:(x)

JMSDestination

消息发送的目的?/font>

JMSDeliveryMode

传递模式, 有两U模式:(x) PERSISTENT 和NON_PERSISTENTQPERSISTENT 表示该消息一定要被送到目的圎ͼ否则?x)导致应用错误。NON_PERSISTENT 表示偶然丢失该消息是被允许的Q这两种模式使开发者可以在消息传递的可靠性和吞吐量之间找到^衡点?/font>

JMSMessageID

唯一识别每个消息的标识,由JMS Provider 产生?/font>

JMSTimestamp

一个消息被提交lJMS Provider 到消息被发出的时间?/font>

JMSCorrelationID

用来q接到另外一个消息,典型的应用是在回复消息中q接到原消息?/font>

JMSReplyTo

提供本消息回复消息的目的地址

JMSRedelivered

如果一个客L(fng)收到一个设|了JMSRedelivered 属性的消息Q则表示可能该客L(fng)曄在早些时候收到过该消息,但ƈ没有{收(acknowledged)?/font>

JMSType

消息cd的识别符?/font>

JMSExpiration

消息q期旉Q等于QueueSender 的send Ҏ(gu)中的timeToLive 值或TopicPublisher 的publish Ҏ(gu)中的timeToLive 值加上发送时ȝGMT 旉倹{如果timeToLive值等于零Q则JMSExpiration 被设为零Q表C消息怸q期。如果发送后Q在消息q期旉之后消息q没有被发送到目的圎ͼ则该消息被清除?/font>

JMSPriority

消息优先U,?-9 十个U别Q?-4 是普通消息,5-9 是加急消息。JMS 不要求JMS Provider 严格按照q十个优先发送消息,但必M证加急消息要先于普通消息到达?/font>

 

 

 

 

 

 

 

 

 

 



3.3 消息?Body) - JMS API 定义?U消息体格式Q也叫消息类型,你可以用不同Ş式发送接?数据q可以兼容现有的消息格式Q下面描q这5U类型:(x)

消息cd

消息?/font>

TextMessage

java.lang.String对象Q如xml文g内容

MapMessage

?值对的集合,名是String对象Q值类型可以是JavaM基本cd

BytesMessage

字节?/font>

StreamMessage

Java中的输入输出?/font>

ObjectMessage

Java中的可序列化对象

Message

没有消息体,只有消息头和属?/font>













下例演示创徏q发送一个TextMessageC个队列:(x)
TextMessage message = queueSession.createTextMessage();
message.setText(msg_text); // msg_text is a String
queueSender.send(message);

下例演示接收消息q{换ؓ(f)合适的消息cdQ?
Message m = queueReceiver.receive();
if (m instanceof TextMessage) {
 TextMessage message = (TextMessage) m;
 System.out.println("Reading message: " + message.getText());
} else {
 // Handle error
}

4. 消息的同步异步接?br>   消息的同步接收是指客L(fng)dL收消息,JMS 客户端可以采用MessageConsumer 的receiveҎ(gu)L收下一个消息?br>   消息的异步接收是指当消息到达Ӟd通知客户端。JMS 客户端可以通过注册一个实 现MessageListener 接口的对象到MessageConsumerQ这P每当消息到达ӞJMS Provider ?x)调用MessageListener中的onMessage Ҏ(gu)?

5. PTP模型
PTP(Point-to-Point)模型是基于队列的Q发送方发消息到队列Q接收方从队列接收消息,队列的存在得消息的异步传输成ؓ(f)可能。和邮gpȝ中的邮箱一P队列可以包含各种消息QJMS Provider ?供工L(fng)理队列的创徏、删除。JMS PTP 模型定义了客L(fng)如何向队列发送消息,从队列接收消息,览队列中的消息?br>   下面描述JMS PTP 模型中的主要概念和对象:(x)

名称

描述

Queue

由JMS Provider 理Q队列由队列名识别,客户端可以通过JNDI 接口用队列名得到一个队列对象?/font>

TemporaryQueue

由QueueConnection 创徏Q而且只能由创建它的QueueConnection 使用?/font>

QueueConnectionFactory

客户端用QueueConnectionFactory 创徏QueueConnection 对象?/font>

QueueConnection

一个到JMS PTP provider 的连接,客户端可以用QueueConnection 创徏QueueSession 来发送和接收消息?/font>

QueueSession

提供一些方法创建QueueReceiver 、QueueSender、QueueBrowser 和TemporaryQueue。如果在QueueSession 关闭Ӟ有一些消息已l被收到Q但q没有被{收(acknowledged)Q那么,当接收者下ơ连接到相同的队列时Q这些消息还?x)被再次接收?/font>

QueueReceiver

客户端用QueueReceiver 接收队列中的消息Q如果用户在QueueReceiver 中设定了消息选择条gQ那么不W合条g的消息会(x)留在队列中,不会(x)被接收到?/font>

QueueSender

客户端用QueueSender 发送消息到队列?/font>

QueueBrowser

客户端可以QueueBrowser 览队列中的消息Q但不会(x)收走消息?/font>

QueueRequestor

JMS 提供QueueRequestor cȝ化消息的收发q程。QueueRequestor 的构造函数有两个参数QQueueSession 和queueQQueueRequestor 通过创徏一个(f)旉列来完成最l的收发消息h?/font>

可靠?Reliability)

队列可以长久C存消息直到接收者收到消息。接收者不需要因为担心消息会(x)丢失而时d队列保持Ȁzȝq接状态,充分体现了异步传输模式的优势?/font>



              
          
  
 

 

 

 

 

 

 

 

 


6. PUB/SUB模型
JMS Pub/Sub 模型定义了如何向一个内容节点发布和订阅消息Q这些节点被UC主题(topic)?br>   主题可以被认为是消息的传输中介,发布?publisher)发布消息C题,订阅?subscribe)从主题订阅消息。主题得消息订阅者和消息发布者保持互相独立,不需要接触即可保证消息的传送?br>   下面描述JMS Pub/Sub 模型中的主要概念和对象:(x)

名称

描述

订阅(subscription)

消息订阅分ؓ(f)非持久订?non-durable subscription)和持久订?durable subscrip-tion)Q非持久订阅只有当客L(fng)处于Ȁzȝ态,也就是和JMS Provider 保持q接状态才能收到发送到某个主题的消息,而当客户端处于离U状态,q个旉D发C题的消息会(x)丢失Q永q不?x)收到。持久订阅时Q客L(fng)向JMS 注册一个识别自pn份的IDQ当q个客户端处于离U时QJMS Provider ?x)?f)q个ID 保存所有发送到主题的消息,当客户再ơ连接到JMS ProviderӞ?x)根据自qID 得到所有当自己处于ȝ时发送到主题的消息?/font>

Topic

主题由JMS Provider 理Q主题由主题名识别,客户端可以通过JNDI 接口用主题名得到一个主题对象。JMS 没有l出主题的组l和层次l构的定义,由JMS Provider 自己定义?/font>

TemporaryTopic

临时主题由TopicConnection 创徏Q而且只能由创建它的TopicConnection 使用。(f)时主题不能提供持久订阅功能?/font>

TopicConnectionFactory

客户端用TopicConnectionFactory 创徏TopicConnection 对象?/font>

TopicConnection

TopicConnection 是一个到JMS Pub/Sub provider 的连接,客户端可以用TopicConnection创徏TopicSession 来发布和订阅消息?/font>

TopicSession

TopicSession 提供一些方法创建TopicPublisher、TopicSubscriber、TemporaryTopic 。它q提供unsubscribe Ҏ(gu)取消消息的持久订阅?/font>

TopicPublisher

客户端用TopicPublisher 发布消息C题?/font>

TopicSubscriber

客户端用TopicSubscriber 接收发布C题上的消息。可以在TopicSubscriber 中设|消息过滤功能,q样Q不W合要求的消息不?x)被接收?/font>

Durable TopicSubscriber

如果一个客L(fng)需要持久订阅消息,可以使用Durable TopicSubscriberQTopSession 提供一个方法createDurableSubscriber创徏Durable TopicSubscriber 对象?/font>

恢复和重新派?Recovery and Redelivery)

非持久订阅状态下Q不能恢复或重新zN一个未{收的消息。只有持久订阅才能恢复或重新zN一个未{收的消息?/font>

TopicRequestor

JMS 提供TopicRequestor cȝ化消息的收发q程。TopicRequestor 的构造函数有两个参数QTopicSession 和topic。TopicRequestor 通过创徏一个(f)时主题来完成最l的发布和接收消息请求?/font>

可靠?Reliability)

当所有的消息必须被接Ӟ则用持久订阅模式。当丢失消息能够被容忍,则用非持久订阅模式?/font>

 

 

 

 

 

 

 


 

 


 
 
 
 
 
 
 
 
 




7. 开发JMS的步?br>
   q义上说Q一个JMS 应用是几个JMS 客户端交换消息,开发JMS 客户端应用由以下几步构成Q?
用JNDI 得到ConnectionFactory 对象Q?
用JNDI 得到目标队列或主题对象,即Destination 对象Q?
用ConnectionFactory 创徏Connection 对象Q?
用Connection 对象创徏一个或多个JMS SessionQ?
用Session 和Destination 创徏MessageProducer 和MessageConsumerQ?
通知Connection 开始传递消息?/font>



rednight 2007-04-11 16:41 发表评论
]]>
l常到xml文g解析错误可以考虑是不是由于文本编辑器而导致的问题http://www.aygfsteel.com/rednight/archive/2007/01/16/94099.htmlrednightrednightTue, 16 Jan 2007 01:09:00 GMThttp://www.aygfsteel.com/rednight/archive/2007/01/16/94099.htmlhttp://www.aygfsteel.com/rednight/comments/94099.htmlhttp://www.aygfsteel.com/rednight/archive/2007/01/16/94099.html#Feedback0http://www.aygfsteel.com/rednight/comments/commentRss/94099.htmlhttp://www.aygfsteel.com/rednight/services/trackbacks/94099.html问题描述:
    <[ServletContext(id=18489944,name=EBLGWeb,context-path=/)]: Deployment descriptor "/WEB-INF/bhr-tags-pagination.tld" is malformed. Check against the DTD: Content is not allowed in prolog. (line 1, column 1).>
    <[ServletContext(id=18489944,name=EBLGWeb,context-path=/)]: Error while parsing the Tag Library Descriptor at "/WEB-INF/bhr-tags-pagination.tld".
org.xml.sax.SAXException: [HTTP:101248][ServletContext(id=18489944,name=EBLGWeb,context-path=/)]: Deployment descriptor "/WEB-INF/bhr-tags-pagination.tld" is malformed. Check against the DTD: Content is not allowed in prolog. (line 1, column 1).
        at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:285)
        at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201)
        at weblogic.servlet.jsp.dd.JSPEntityResolver.load(JSPEntityResolver.java:81)
        at weblogic.servlet.jsp.dd.JSPEntityResolver.load(JSPEntityResolver.java:96)
        at weblogic.servlet.internal.WebAppHelper.registerTagLibListeners(WebAppHelper.java:293)
        at weblogic.servlet.internal.WebAppServletContext.activateFromDescriptors(WebAppServletContext.java:2530)
        at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:6163)
        at weblogic.servlet.internal.WebAppServletContext.setActive(WebAppServletContext.java:6141)
        at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:836)
        at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:3322)
        at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2201)
        at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2174)
        at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2122)
        at weblogic.management.deploy.slave.SlaveDeployer$Application.setActivation(SlaveDeployer.java:3099)
        at weblogic.management.deploy.slave.SlaveDeployer.setActivationStateForAllApplications(SlaveDeployer.java:1768)
        at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.java:351)
        at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resume(DeploymentManagerServerLifeCycleImpl.java:229)
        at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:136)
        at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:965)
        at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:360)
        at weblogic.Server.main(Server.java:32)
>
原因分析和解x?
是由于某些文本编辑器QUltraEditQ存文本的时候生的问题。可以用text pad, word pad~辑XML格式的文件?


rednight 2007-01-16 09:09 发表评论
]]>
有时WLS-Apache Proxy Plugin׃timeout的设|过短而认为处理它转发h的应用服务器L了而进行Failvoerhttp://www.aygfsteel.com/rednight/archive/2007/01/16/94098.htmlrednightrednightTue, 16 Jan 2007 01:09:00 GMThttp://www.aygfsteel.com/rednight/archive/2007/01/16/94098.htmlhttp://www.aygfsteel.com/rednight/comments/94098.htmlhttp://www.aygfsteel.com/rednight/archive/2007/01/16/94098.html#Feedback0http://www.aygfsteel.com/rednight/comments/commentRss/94098.htmlhttp://www.aygfsteel.com/rednight/services/trackbacks/94098.html问题描述:
通过HTTP提交EDIh,当EDI处理旉过?0分钟?׃(x)看到在另一个weblogic server也接收到了这个EDIh,重新处理q个报文.
如果报文处理旉更长,比如过?0分钟,׃(x)发现q个报文被处理了3遍或5?
原因分析和解x?
When the Apache HTTP Server Plug-In attempts to connect to WebLogic Server, the plug-in uses several configuration 
parameters to determine how long to wait for connections to the WebLogic Server host and, after a connection is
established, how long the plug-in waits for a response. If the plug-in cannot connect or does not receive a response, 
the plug-in attempts to connect and send the request to other WebLogic Server instances in the cluster. If the 
connection fails or there is no response from any WebLogic Server in the cluster, an error message is sent.


响应{待旉参数WLIOTimeoutSecs (http://e-docs.bea.com/wls/docs81/plugins/plugin_params.html#1149781.
按照BEA 推荐的,q个值应该设得大一? q个参数的缺省gؓ(f)300s. 见下面:(x)
<Location /EDIHandler>
         SetHandler weblogic-handler
         WebLogicCluster apc_app1wls1:7011,apc_app1wls2:7011
         KeepAliveEnabled ON
         WLIOTimeoutSecs 7200
</Location>


rednight 2007-01-16 09:09 发表评论
]]>
Failed to Send MQ Message Problemhttp://www.aygfsteel.com/rednight/archive/2007/01/16/94097.htmlrednightrednightTue, 16 Jan 2007 01:08:00 GMThttp://www.aygfsteel.com/rednight/archive/2007/01/16/94097.htmlhttp://www.aygfsteel.com/rednight/comments/94097.htmlhttp://www.aygfsteel.com/rednight/archive/2007/01/16/94097.html#Feedback0http://www.aygfsteel.com/rednight/comments/commentRss/94097.htmlhttp://www.aygfsteel.com/rednight/services/trackbacks/94097.html有时候用的mq jar文g的版本不对给出现一些末名奇妙的问题,本文则是能接收消息但不能发送消息的一个问?到q样的问题一定要记得double-check你用的mq jar文g的版?/p>

问题描述:
MQJMS200713 Oct 2006 16:47:15,484 ERROR MessagingUtilServlet [ExecuteThread: '14' for queue: 'weblogic.kernel.Default'][]: **********EXCEPTION TRACE START*************
13 Oct 2006 16:47:15,484 ERROR MessagingUtilServlet [ExecuteThread: '14' for queue: 'weblogic.kernel.Default'][]: produce error
com.bhr.infra.messaging.exception.PMException: JMSException
        at com.bhr.infra.messaging.PMHandler.send(PMHandler.java:419)
        at com.bhr.epc.infra.messaging.util.MessagingUtilServlet.produce(MessagingUtilServlet.java:312)
        at com.bhr.epc.infra.messaging.util.MessagingUtilServlet.service(MessagingUtilServlet.java:74)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6981)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
        at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Caused by: javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
        at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:553)
        at com.ibm.mq.jms.MQMessageProducer.sendInternal(MQMessageProducer.java:1589)
        at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1012)
        at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1046)
        at com.bhr.infra.messaging.PMQueueSender.send(PMQueueSender.java:57)
        at com.bhr.infra.messaging.PMHandler.send(PMHandler.java:410)
        ... 13 more
13 Oct 2006 16:47:15,486 ERROR MessagingUtilServlet [ExecuteThread: '14' for queue: 'weblogic.kernel.Default'][]: **********EXCEPTION TRACE END**************

原因分析和解x?
It may be caused by use of old version MQ jar. It can receive message, but cannot send message.


rednight 2007-01-16 09:08 发表评论
]]>
Cannot Forward a Response that is Already Committedhttp://www.aygfsteel.com/rednight/archive/2007/01/16/94096.htmlrednightrednightTue, 16 Jan 2007 01:07:00 GMThttp://www.aygfsteel.com/rednight/archive/2007/01/16/94096.htmlhttp://www.aygfsteel.com/rednight/comments/94096.htmlhttp://www.aygfsteel.com/rednight/archive/2007/01/16/94096.html#Feedback5http://www.aygfsteel.com/rednight/comments/commentRss/94096.htmlhttp://www.aygfsteel.com/rednight/services/trackbacks/94096.html如果你碰?Cannot Forward a Response that is Already Committed"q样的错误信?一定是应用对一ơhttph做了多次面跌{或对response对象做过close?又去写响?

q个问题的根本原因由于响应本ơ请求的Response对象的状态是已提交状态造成? 它不允许响应提交多次?

什么时候Response对象的状态变成已提交状态:(x)当你的应用已l实C面跌{逻辑?

通常原因Q?

1Q?如果你用了community的话Q?community的安全认证和授权如果没有通过Qcommunity内部?x)进行页面蟩转。但你的应用(对于workshop应用的话Q指的是action)又试图进行页面蟩转,׃(x)出现q样的问题?


    /**

     * @jpf:action

     * @jpf:forward name="page" path="page.jsp"

     */

    protected Forward actionMethod()

{

    //如果已经提交了响应,你仍然试囑ֆơ进行页面蟩转,卛_ơ提交响应,可能出现问题

    //通常可以加一个判?

 

       if (!getResponse().isCommitted()) {

            return new Forward("success");

        } else {

            return null;

        }

    }

 

    protected void beforeAction() {

       SecurityManager.checkAuthorization(getRequest(), getResponse(), config.getString(

                CDConstants.CREATE_TERM_ACTION_NAME, ""));

      //q个调用可能实现了页面蟩转,x交响?

}

 

注意JSP中实现页面蟩转后Q加return 语句防止l箋提交响应:

 

<%

       SecurityManager.checkAuthorization(getRequest(), getResponse(), config.getString(

                CDConstants.CREATE_TERM_ACTION_NAME, ""));

{

     //可能有实现页面蟩转逻辑

    ……………forward();

        return;//记得加retrun.

    }

%>

 

2. .如果没有使用community的话Q下面情景也?x)出现这个问?

 

    /**

     * @jpf:action

     * @jpf:forward name="page" path="page.jsp"

     */

    protected Forward actionMethod()

 

//直接操作Response对象写响?

     getResponse().getPrintWriter().println();

    …

/

   // 又执行的面跌{Q也可能出现问题

        return new Forward("index");

    }


rednight 2007-01-16 09:07 发表评论
]]>
Page Flow Error - No Relevant Pagehttp://www.aygfsteel.com/rednight/archive/2007/01/16/94094.htmlrednightrednightTue, 16 Jan 2007 01:06:00 GMThttp://www.aygfsteel.com/rednight/archive/2007/01/16/94094.htmlhttp://www.aygfsteel.com/rednight/comments/94094.htmlhttp://www.aygfsteel.com/rednight/archive/2007/01/16/94094.html#Feedback0http://www.aygfsteel.com/rednight/comments/commentRss/94094.htmlhttp://www.aygfsteel.com/rednight/services/trackbacks/94094.html一个页面流在第一ơ用时,内部属性currentpageq没有指定页?所以避免在beginҎ(gu)里用return-to: current page用法.同时在用的时候注意页面流的工作方?/p>

问题描述:
Error message like below in Web Page is displayed:

Page Flow:
 /com/xxxx/xxx/xxx.jpf
Action:
 update
 
Page Flow Error - No Relevant Page
You have tried to return to a recent page in the current page flow through return-to="currentPage", 
but there is no appropriate page. 


Exception's stack trace:

Exception: No previous page for return-to="currentPage" on action create in page flow
 /com/gems/mt/web/CreateReleaseCntr/CreateReleaseCntrController.jpf.
com.bea.wlw.netui.pageflow.NoPreviousPageException: No relevant page for return-to="currentPage" 
on action create in page flow /com/gems/mt/web/CreateReleaseCntr/CreateReleaseCntrController.jpf.
at com.bea.wlw.netui.pageflow.FlowController.doReturnToPage(FlowController.java:1328)
at com.bea.wlw.netui.pageflow.FlowController.forwardTo(FlowController.java:1023)
at com.bea.wlw.netui.pageflow.PageFlowController.forwardTo(PageFlowController.java:606)
at com.bea.wlw.netui.pageflow.FlowController.internalExecute(FlowController.java:765)

...


原因分析和解x?
When a new page flow is created and its current page is null (it mean you visit at the fist time),
 so such an exception like NoPreviousPageException occur if you use return-to="currentPage".

if a new page flow finish a successful forward, it will treat last page as current page

so that we can use current page to display error message conveniently.

Solution:

ensure page flow finish a successful forward and use current page again.

You can also use path="specificPage.jsp" instead of return-to="currentPage" 
if your original return-to is just one specific page.



rednight 2007-01-16 09:06 发表评论
]]>
Memory Leak for ListCellRendererhttp://www.aygfsteel.com/rednight/archive/2007/01/16/94089.htmlrednightrednightTue, 16 Jan 2007 01:04:00 GMThttp://www.aygfsteel.com/rednight/archive/2007/01/16/94089.htmlhttp://www.aygfsteel.com/rednight/comments/94089.htmlhttp://www.aygfsteel.com/rednight/archive/2007/01/16/94089.html#Feedback0http://www.aygfsteel.com/rednight/comments/commentRss/94089.htmlhttp://www.aygfsteel.com/rednight/services/trackbacks/94089.html We have known, the ListCellRenderer interface has only one method public Component getListCellRendererComponent(), and it returns a Component. When a JList needs to compute its dimension or paint its cell item, this method will be called. So it will be called frequently, and we have a best practice, try to reuse object, avoid time-consumed computation and unnecessary operation in this method.

 

Recently found, there is a memory leak bug for list cell renderer in both JDK 1.4.x and JDK 5 (don’t know whether has the same bug in earlier JDK). The component returned from getListCellRendererComponent() method could not be GC, and all its referenced objects also could not be GC. Unfortunately, this bug is only fixed in JDK 6.

 

So currently, if a JList use the ListCellRenderer, but only holds a little resource (eg: the JList only has little items, and the component is returned from ListCellRenderer is a simple JLable), you may not care about the memory leak.

 

But if a JList use the ListCellRenderer, and holds a large resource, you should remember to use the following way to avoid memory leak.

 

Work Around: Subclass JList and invoke removeAll after painting is done:

       public class xxxList extends JList {

            private CellRendererPane renderer;

            private CellRendererPane getRenderer() {

                if (renderer == null) {

                    for (int i=0; i<getComponents().length; i++) {

                                          Component c  = getComponents()[i];

                        if (c instanceof CellRendererPane) {

                            renderer = (CellRendererPane)c;

                            break;

                        }

                    }

                }

                return renderer;

            }

            protected void paintComponent(Graphics g) {

                super.paintComponent(g);

                CellRendererPane renderer = getRenderer();

                if (renderer != null) {

                    renderer.removeAll();

                }

            }

        }


Please refer to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5044798 for more details.

rednight 2007-01-16 09:04 发表评论
]]>
state patternhttp://www.aygfsteel.com/rednight/archive/2006/12/26/90105.htmlrednightrednightTue, 26 Dec 2006 06:46:00 GMThttp://www.aygfsteel.com/rednight/archive/2006/12/26/90105.htmlhttp://www.aygfsteel.com/rednight/comments/90105.htmlhttp://www.aygfsteel.com/rednight/archive/2006/12/26/90105.html#Feedback0http://www.aygfsteel.com/rednight/comments/commentRss/90105.htmlhttp://www.aygfsteel.com/rednight/services/trackbacks/90105.htmlThe logic to change state is only inside one method (initVesselView(?) inside GrVessel.java. 

if (viewType == VIEW_STOWAGE) {
            vslView_ = new VesselStowageView(leftPoint, bow2Left, leftCenter,
                                             rightCenter, shipWidth_);
        }
        else if (viewType == VIEW_SIDE) {
            vslView_ = new VesselSideView(leftPoint, bow2Left, leftCenter,
                                          rightCenter, shipWidth_);
        }
        else if (viewType == VIEW_PLAN) {
            vslView_ = new VesselPlanView(leftPoint, bow2Left, leftCenter,
                                          rightCenter, shipWidth_);
        }
        else {
            throw new IllegalArgumentException(
                "GrVessel::initVesselView-->Invalid view type!");
        }


We do not need to repeat this logic of changing view in many other method.
This is the benefit of State design pattern.
The 3 state classes here are VesselPlanView.java, VesselSideView.java and VesselStowageView.java

Please note that in the state classes, if a method is supported by stateA and not supported by stateB. 
Then, in stateB, the method body will throw an exception (IllegalArgumentException) to indicate that coder call the wrong method in the wrong state.

Example, in VesselPlanView.java, public boolean addStowage(...).  This method is only meaningful to stowageView.

public boolean addStowage(IlvManager manager, List transformList, IlvGraphic stowage, String stadBayN,
                              boolean isSelect) {
        throw new IllegalArgumentException(
                "GrVessel::addStowage-->be sure the vessel at stowage view!");
    }


Hence, in PlanView, the method body will throw exception.

Just to share with you a better way to code.



rednight 2006-12-26 14:46 发表评论
]]>
Swing 模型qohttp://www.aygfsteel.com/rednight/archive/2006/11/11/80589.htmlrednightrednightSat, 11 Nov 2006 08:16:00 GMThttp://www.aygfsteel.com/rednight/archive/2006/11/11/80589.html阅读全文

rednight 2006-11-11 16:16 发表评论
]]>
java.lang.InstantiationException: org.apache.tools.ant.Main http://www.aygfsteel.com/rednight/archive/2006/11/09/80222.htmlrednightrednightThu, 09 Nov 2006 10:23:00 GMThttp://www.aygfsteel.com/rednight/archive/2006/11/09/80222.htmlhttp://www.aygfsteel.com/rednight/comments/80222.htmlhttp://www.aygfsteel.com/rednight/archive/2006/11/09/80222.html#Feedback1http://www.aygfsteel.com/rednight/comments/commentRss/80222.htmlhttp://www.aygfsteel.com/rednight/services/trackbacks/80222.html原因之一是在机器中存?U不同版本的ANT,我碰到的情况是classpath 中即有weblogic.jar,又有1.6.5的ANT,
删除weblogic.jar后运行就正常?img src ="http://www.aygfsteel.com/rednight/aggbug/80222.html" width = "1" height = "1" />

rednight 2006-11-09 18:23 发表评论
]]>
վ֩ģ壺 | ̨| ƽ| | | ƽ| ӡ| | ̫| | | ƽԶ| ʼ| ױ| | ʡ| ƽ| ʯ| | ʳ| | | | | | | żҸ| | | | Ű| | | | | ߺ| Ȫ| | | | |