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 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 write an Test Java APP and it works right BUt this Web app
I'm sure this is a beginner error... So I have a Java EE 6
Has anyone got this configuration working? Latest Netbeans, latest Glassfish, I created an EJB
I'm developing a java EE web app using JSF with a shopping cart style
I am trying to change my web-app's JDBC code to JPA using Hibernate as
I have an EJB app. which basically has to execute a SQL query when
How do I use a deployed EJB app from a separate JSF application? I'm
I've been developing my first Java EE app, which has a number of JPA
I have an ear app with two EJB and one WEB (war) projects all
I'm trying to inject Spring beans into an EJB using @Interceptors(SpringBeanAutowiringInterceptor.class) but I cannot

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.