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

  • Home
  • SEARCH
  • 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 6651351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:00:02+00:00 2026-05-26T01:00:02+00:00

On my EJB App (Java EE), I proceed a list (LinkedList) to insert into

  • 0

On my EJB App (Java EE), I proceed a list (LinkedList) to insert into db and I got error: ArrayIndexOutOfBoundsException: -32443

I code as

Iterator itertator = myList.iterator();
while (itertator.hasNext()) {         
    MyObject myObject = (MyObject) itertator.next();
    ...
}

I wonder as I already use iterator.next why it could has indexOutOfBound?

Full log:

Error message: java.lang.ArrayIndexOutOfBoundsException: -32443; nested exception is: com.my.exception.MyException
at com.ibm.ejs.container.RemoteExceptionMappingStrategy.mapEJBException(RemoteExceptionMappingStrategy.java:411)
at com.ibm.ejs.container.RemoteExceptionMappingStrategy.mapException(RemoteExceptionMappingStrategy.java:113)
at com.ibm.ejs.container.RemoteExceptionMappingStrategy.setUncheckedException(RemoteExceptionMappingStrategy.java:203)
at com.ibm.ejs.container.EJSDeployedSupport.setUncheckedException(EJSDeployedSupport.java:296)

My EJB App is accessed by a Java client in multi-threading, the list is implemented in EJB itself by taking the id from the client to find data insert into a linkedlist and then send the list to insert by iterating as above, by randomly it got error.

Anyone could help to find the clue? Or the issue because I am using LinkedList, the size of the object is not enough?

  • 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-26T01:00:02+00:00Added an answer on May 26, 2026 at 1:00 am

    I’d assume that the list isn’t thread safe. In case the list is accessed by a number of threads an an other thread accesses the last element at the moment, the iterator.hasNext() is true. But when another thread does a iterator.next(), then you try to access the next element that isn’t available. The fact, that is error happens randomly is another hint for that. Using a thread safe list would be a good idea in this case. Otherwise manually synchronizing the list is necessary:

    synchronized(list) {
        Iterator i = list.iterator(); // Must be in synchronized block
        while (i.hasNext())
            foo(i.next());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an app that is trying to use @EJB annotation to inject remote
I am currently working on some older java code that was developed without App
I am able to debug my EJB 3.0 app on my local JBoss (4.2.2
In EJB 3.0 you can write your domain objecs, then convert them into entitities
If a java client calls a remote EJB on a different server, how can
The Java EE specification states that an EJB injection like this: @EJB MyInterface myBean;
I write an Test Java APP and it works right BUt this Web app
In my Java/Seam/JbossAS app, I decided to externalize my Model classes (hibernate entities) and
Is there any situation still ( given that Java EE6 has java:global/, app/, module/
I'm trying to deploy my EAR app consisting of modules ejb and war on

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.