2

I am trying to remove an item of a List.

list.remove(key);

However, it throws an exception:

Caused by: java.lang.UnsupportedOperationException
    at java.util.AbstractList.remove(AbstractList.java:161)
    at java.util.AbstractList$Itr.remove(AbstractList.java:374)
    at java.util.AbstractCollection.remove(AbstractCollection.java:293)
    at bean.Bean.deleteRow(Bean.java:46)

How is this caused and how can I solve it?

5
  • 1
    Start by investigating the whole stacktrace... Commented Nov 2, 2016 at 16:55
  • Yes, "serverError: class javax.faces.el.EvaluationException" sounds like you're just looking at the client-side error message, but javax.faces.el.EvaluationException is a Java exception, so you should read the server logs. Commented Nov 2, 2016 at 16:58
  • I tried to change the bean and its scope from cdi Named to ManagedBean but I still have the error Commented Nov 2, 2016 at 17:25
  • 1
    This has nothing to do with JSF. You'd have had exactly the same problem when running the very same Java code using a plain Java application class with a main() method. Including the entire Java EE web interface in a question about an exception of java.lang.* package originating from your own code is unnecessary. I have trimmed down the irrelevant noise from the question to make it better focused. Commented Nov 2, 2016 at 17:47
  • How is the list created? You're probably running into an issue like the one described in this question. Commented Nov 2, 2016 at 18:07

1 Answer 1

5

The issue was during Arrays.asList() used to initialize the list, by using list.add(String) i fixed the problem

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.