zwwcn

Just another WordPress.com site

Monthly Archives: August 2012

ConcurrentRequestTimeoutException

Quoted from https://community.jboss.org/message/684147#684147

We were ending a conversation programatically, by calling Conversation.endBeforeRedirect(). However, there was no redirect, so the conversation lock wasn’t released.

I changed it to be Conversation.end() and then Conversation.leave(), which causes the conversation to end, release the lock and start a new one. And so far no exceptions 🙂

——————-

found this from http://riyazmsm.blogspot.com/2009/08/concurrent-calls-to-conversational.html
it came from Seam documentation

Accessing a Seam conversational component from a Ajax request need to be queued serially because as per the seam documentation ,conversational component dont allow concurrency. If the server component takes a long time to respond and if another request goes in, it throws out the “org.jboss.seam.ConcurrentRequestTimeoutException: Concurrent call to conversation” error. After adding the eventsQueue property to the a4j:support tag it stopped throwing out the Error.

The documentation explanation about the eventsQueue.  “eventsQueue – provide a queue in which events are placed. All events are queued and requests are sent to the server serially. This is useful if the request can to the server can take some time to execute (e.g. heavy computation, retrieving information from a slow source) as the server isn’t flooded.
view plainprint?

<a:support event=”onchange”  eventsQueue=”default” action=”#{longRunningComo}” reRender=”Decoration”
bypassUpdates=”true” ajaxSingle=”true”/>

Advertisements

org.hibernate.validator.InvalidStateException: validation failed for

for this validation error, use below code to find the wrong property:

catch (InvalidStateException e) {
    for (InvalidValue invalidValue : e.getInvalidValues()) {
        log.info("Instance of bean class: " + invalidValue.getBeanClass().getSimpleName() +
                 " has an invalid property: " + invalidValue.getPropertyName() +
                 " with message: " + invalidValue.getMessage());
    }
}

setEntities and LIE

advisorFranchiseeComplianceCheckList.remove(selectedComplianceCheck);
em.remove(complianceCheck);
selectedComplianceCheck=null;
em.flush();
setEntities(advisorFranchiseeComplianceCheckList);
return “”;

 

the above code throws exception “failed to lazily initialize a collection, no session or session was closed”.
Solution: we should do setEntities before the flush call.

advisorFranchiseeComplianceCheckList.remove(selectedComplianceCheck);
em.remove(complianceCheck);
setEntities(advisorFranchiseeComplianceCheckList);
selectedComplianceCheck=null;
em.flush();
return “”;

 

 

Collections.singletonList

the useage of Collections.singletonList : it’s useful for passing a single value to an API that requires a collection of that value.