Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6766223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:48:16+00:00 2026-05-26T14:48:16+00:00

The error I get is ‘IllegalArgumentException occured’ Can not set java.util.ArrayList field mi.types.ListOfObjects.objects to

  • 0

The error I get is 'IllegalArgumentException occured' Can not set java.util.ArrayList field mi.types.ListOfObjects.objects to java.util.LinkedList

I’m doing the following…

 ListOfObjects objects = li.getUsersObjects();

which works perfectly fine normally, however when I do the exact same call with the exact same code inside of Play it doesn’t. I’m calling it in my Security Controller inside the authenticate() function. There’s a case where the users objects are gotten from an external server. That’s when this call is made. It works fine without Play and I’m pretty sure worked before I put it in the Security Controller. Why would putting it here cause such a problem?

EDIT

ListOfObjects is a custom object which contains some values.. It’s located inside li which is a library I’m importing. It looks something like this…

public class ListOfObjects {

  private ArrayList<Object> objects;

  public ArrayList<Object> getObjects(){
          return objects;
   }
}

getUserObjects simply returns the objects for that user. It grabs them from a server and then uses gson to parse them. However I’m getting the above error when I attempt to.

EDIT2

No matter what I do my type for getUserObjects seems to always be returning as a LinkedList even though it’s an ArrayList object. I’ve tried calling getObjects() directly and there’s no change.

EDIT 3

getUserObjects is defined as…

        Gson gson = new Gson();
    ListOfObjects objects = gson.fromJson(r.getBody(), ListOfObjects.class);

StackTrace…

where r.getBody() is the JSON response from the server

   Execution exception (In /app/controllers/Security.java around line 57)
 IllegalArgumentException occured : Can not set java.util.ArrayList field     lm.types.ListOfObjects.objects to java.util.LinkedList

play.exceptions.JavaExecutionException: Can not set java.util.ArrayList field lm.types.ListOfObjects.objects to java.util.LinkedList
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:227)
at Invocation.HTTP Request(Play!)
 Caused by: java.lang.IllegalArgumentException: Can not set java.util.ArrayList field lm.types.ListOfObjects.objects to java.util.LinkedList
at com.google.gson.FieldAttributes.set(FieldAttributes.java:188)
at com.google.gson.JsonObjectDeserializationVisitor.visitFieldUsingCustomHandler(JsonObjectDeserializationVisitor.java:118)
at com.google.gson.ObjectNavigator.navigateClassFields(ObjectNavigator.java:158)
at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:131)
at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:73)
at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:51)
at com.google.gson.Gson.fromJson(Gson.java:568)
at com.google.gson.Gson.fromJson(Gson.java:515)
at com.google.gson.Gson.fromJson(Gson.java:484)
at com.google.gson.Gson.fromJson(Gson.java:434)
at com.google.gson.Gson.fromJson(Gson.java:406)
at lm.lib.LMethods.getUsersObjects(LMethods.java:165)
at controllers.Security.createNewUser(Security.java:57)
at controllers.Security.authenticate(Security.java:36)
at play.utils.Java.invokeStaticOrParent(Java.java:159)
at controllers.Secure$Security.invoke(Secure.java:193)
at controllers.Secure$Security.access$0(Secure.java:184)
at controllers.Secure.authenticate(Secure.java:64)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:540)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:498)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:474)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:469)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:157)
... 1 more

Debugger failed to attach: recv failed during handshake: Connection reset by peer

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:48:16+00:00Added an answer on May 26, 2026 at 2:48 pm

    Exception message clearly says that Gson deserializes list as LinkedList, whereas field of your ListOfObjects is declared as ArrayList.

    The general rule to avoid this kind of problems is not to use implementation classes in field declarations. Use List instead:

    public class ListOfObjects {
        private List<Object> objects; 
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to read a file and the error i get is java.io.FileNotFoundException:
If I set pre-compile script into binary code to true I get error saying
The error I get is Xcode saying 3 things are un-declared (see below picture)
I have this query and I get error Operand should contain 1 column(s), whats
What is the best way to get error messages from a WF4 workflow back
I use the following jquery statements but i get error in this function onGetDataSuccess(result)
when i run my application it is the error i get... This application has
In our application we've run into an error numerous times where we get error
I am using following PHP code for trigger creation but always get error, please
When we try to create a view within a funcion we get ERROR: there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.