Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Servlet exception

0 views
Skip to first unread message

Mohap

unread,
Apr 17, 2001, 2:27:03 AM4/17/01
to
Can anyone tell me why I'm getting this error? Is there anything I need to
know, like is this a common problem? I don't know why it's happening. I
shouldn't have a concurrency problem-- it is only myself who's testing it.
Please help!!


java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:535)
at java.util.LinkedList$ListItr.next(LinkedList.java:476)
at ShoppingCart.remove(ShoppingCart.java:27)
at
_0002fcart_0002ejspcart_jsp_8._jspService(_0002fcart_0002ejspcart_jsp_8.java
:78)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)

Nils O. Selåsdal

unread,
Apr 17, 2001, 3:00:44 AM4/17/01
to

"Mohap" <NOSPAMa...@hotmail.com> wrote in message
news:9bgn7r$imp$1...@bob.news.rcn.net...

> Can anyone tell me why I'm getting this error? Is there anything I need to
> know, like is this a common problem? I don't know why it's happening. I
> shouldn't have a concurrency problem-- it is only myself who's testing it.
> Please help!!
>
>
You have a LinkedList, and several threads are trying to modifie it.
(illegal)


Jon Skeet

unread,
Apr 17, 2001, 3:15:09 AM4/17/01
to

Not necessarily:

import java.util.*;

public class Test
{
public static void main (String [] args)
{
LinkedList ll = new LinkedList();
for (int i=0; i < 10; i++)
ll.add (new Object());

ListIterator li = ll.listIterator();

li.next();

ll.remove (5);

li.next();
}
}

This causes the same exception, but with only one thread - and is, I
suspect, similar to the OP's problem.

--
Jon Skeet - sk...@pobox.com
http://www.pobox.com/~skeet
If replying to the group, please don't mail me at the same time

Jon Skeet

unread,
Apr 17, 2001, 3:11:18 AM4/17/01
to
Mohap <NOSPAMa...@hotmail.com> wrote:
> Can anyone tell me why I'm getting this error? Is there anything I need to
> know, like is this a common problem? I don't know why it's happening. I
> shouldn't have a concurrency problem-- it is only myself who's testing it.
> Please help!!

Well, what are you doing to the linked list? Given your stack trace, it
looks like you're removing an item from it and then calling next() on
its iterator - which the docs say will cause the exception to be thrown.

0 new messages