Results 1 to 5 of 5

Thread: Spring Webflow integration with Spring MongoDB issues

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Location
    Mexico City / Atlanta GA
    Posts
    30

    Default Spring Webflow integration with Spring MongoDB issues

    Hi, I wrote a custom ConversationManager having a Repository object using a MongoTemplate. I am getting a NullPointerException when storing the FlowExecution object, the reason is 'messagesMemento' contains LinkedHashMap entry containing a null key ({null=[]}). The exception is thrown when SpringMongo tries to call getClass() on that null key. It makes no sense to store a null key entry for one side and for another, I don't know if having such entry has some use.

    The only solution I found for now is to skip storing flash scope objects (since fortunately I don't use flash scope) by rewriting FlowExecutionImpl and commenting out the code inside "saveFlashMessages(RequestContext)" and guarding for null in getFlashScope() in method "createMessageContext(MessageSource)" which is highly discouraged.

    Here is a link to the post I wrote in the SpringMongo forum:
    http://forum.springsource.org/showth...MongoConverter

    I am using SpringWebflow 2.3.0.RELEASE and SpringMongo 1.0.0.RELEASE.

    Thanks,
    Marco
    Last edited by marcovmx; Feb 14th, 2012 at 05:23 PM.

  2. #2
    Join Date
    Aug 2011
    Location
    Mexico City / Atlanta GA
    Posts
    30

    Default

    I expected to have an answer to this thread from any of the spring web flow team members, since I considered this issue to be sensitive because it makes two of the spring modules incompatible and not possible to integrate. How could (spring) mongodb could actually store a null key entry coming from a spring web flow object?

  3. #3
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    the reason is 'messagesMemento' contains LinkedHashMap entry containing a null key ({null=[]})
    Could you provide a bit more detail on how this comes about?

  4. #4
    Join Date
    Aug 2011
    Location
    Mexico City / Atlanta GA
    Posts
    30

    Default

    Thanks for responding Rossen,

    Well, I have a Spring Webflow configuration with a custom conversation manager using a custom conversation reopository to store conversations with spring mongo db.

    Code:
    class CustomConversation implements Conversation {
    	...
    	public void unlock() {
    		lock.unlock();
    		lockCount--;
    		if (lockCount == 0) {
    			if (!ended) {
    				repository.saveConversation(this);
    			}
    			CustomConversationHolder.removeConversation(getId());
    		}
    	}
    	...
    Code:
    @Repository
    public class CustomConversationRepository implements ConversationRepository {
    	...
    
    	
    	public void saveConversation(Conversation conversation) {
    		logger.debug("Saving conversation: " + conversation);
    		mongoTemplate.save(conversation);
    	}
    	...
    I didn't do anything else in special, just storing the conversations (I did not manipulate Flow Execution objects). I get a NPE when I start the flow. Digging into the source code I realized of the symptom described above. The 'messagesMemento' object gets created all by the Spring Web Flow framework, and at some point it stores an entry in its map containing a null key, and that is not possible to be stored in mongodb.

    I hope that explains better.

    Thanks,
    Marco

  5. #5
    Join Date
    Jun 2012
    Posts
    1

    Default

    hey Marco,

    did you find a solution? Do you mind sharing your code. I'm very curious how you implemented the Mongo Conversation Abstraction.

    best
    tobias

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •