EJB design: ConcurrentModificationException

  1. ConcurrentModificationException (1 messages)

    Hello Sir,
             U have given the following explaination, I guess You are looking correct. I am attaching my code using in mapToURL() at bottom place. plz just look into that n give me ur valuable suggestion where I have to change n with what? plllleeezz...!

      Your (Another Possible Problem) Answer for my question

         It is also possible that the concurrent modification is coming from the same thread. If synchronizing on the hashmap doesn't help, post the code of com.rockwell.firstpoint.uwa.urlmapping.URLMappingManager.mapToURL

    Something may be wrong with that method that is causing it. The number one reason would be having code like this:

    for(Iterator iter=hashMap.keySet().iterator(); iter.hasNext();) {

    That code will cause a concurrent modification exception, because all iterators over the HashMap are invalid after an element is added or removed.

                     my mapToURL() code

     for (Iterator j = urlBean.getParamPairs(); j.hasNext(); ) {
            final Map.Entry entry = (Map.Entry);

            sb.append(entry.getKey() + EQUAL_SEPARATOR);

            final String value = ((String) entry.getValue()).toLowerCase().trim();


    in an Advanced Thanks to U for helping me.
  2. ConcurrentModificationException[ Go to top ]

    Dear Sir,

    When itterating over certain collections, you should not modify the collections by adding or removing from them. To add or remove, place the obects in a seperate collection and call the appropriate methods.


    Saqib Rasul
    - Web Services in 15 Minutes -