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 440583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:53:14+00:00 2026-05-12T20:53:14+00:00

I need to iterate a List<myClass> in a jsp. This is how I obtain

  • 0

I need to iterate a List<myClass> in a jsp. This is how I obtain the list:

(when I commented it, the page loaded just fine).

 <%
      List<myClass> pjList = null;
      StringBuffer ejbQuery = new StringBuffer();

      EntityManagerFactory emf = Persistence.createEntityManagerFactory("myPersistence");
      EntityManager em = emf.createEntityManager();

      ejbQuery.append("SELECT e ");
      ejbQuery.append("FROM myClass e ");
      pjList = em.createQuery(ejbQuery.toString()).getResultList();


for(myClass pj : pjList)
{
    %>
    <br />
    <%= pj.getSomeField()%>
    <br />
    <%
}
%>

This is the error I get when running it in google appengine. locally it runs fine.

Uncaught exception from servlet
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
 at org.datanucleus.store.appengine.DatastoreFieldManager.fetchStringField(DatastoreFieldManager.java:188)
 at org.datanucleus.state.AbstractStateManager.replacingStringField(AbstractStateManager.java:1180)
 at ar.edu.kennedy.proveedores.entities.ProEnteEy.jdoReplaceField(ProEnteEy.java)
 at ar.edu.kennedy.proveedores.entities.ProPersonaJuridicaEy.jdoReplaceField(ProPersonaJuridicaEy.java)
 at ar.edu.kennedy.proveedores.entities.ProEnteEy.jdoReplaceFields(ProEnteEy.java)
 at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2772)
 at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2791)
 at org.datanucleus.store.appengine.DatastorePersistenceHandler.fetchObject(DatastorePersistenceHandler.java:443)
 at org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:433)
 at org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:391)
 at org.datanucleus.store.appengine.query.DatastoreQuery.access$800(DatastoreQuery.java:97)
 at org.datanucleus.store.appengine.query.DatastoreQuery$5.apply(DatastoreQuery.java:515)
 at org.datanucleus.store.appengine.query.DatastoreQuery$5.apply(DatastoreQuery.java:507)
 at org.datanucleus.store.appengine.query.StreamingQueryResult.resolveNext(StreamingQueryResult.java:137)
 at org.datanucleus.store.appengine.query.StreamingQueryResult$1.computeNext(StreamingQueryResult.java:163)
 at org.datanucleus.store.appengine.query.AbstractIterator.tryToComputeNext(AbstractIterator.java:132)
 at org.datanucleus.store.appengine.query.AbstractIterator.hasNext(AbstractIterator.java:127)
 at org.datanucleus.store.appengine.query.StreamingQueryResult$AbstractListIterator.hasNext(StreamingQueryResult.java:229)
 at org.apache.jsp.busqueda_jsp._jspService(busqueda_jsp.java:138)

If I use a ListIterator and call hasNext() I get the same error. Help me understand what is happening, how to solve this?

  • 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-12T20:53:15+00:00Added an answer on May 12, 2026 at 8:53 pm

    It looks like the mapping you have from “myclass” is wrong.

    There is a field marked as “String” when in fact it is a “number”.

    What it seems to happen from the StackTrace is that your value is fetched from the database and then casted to a string.

    Since the value is not an string, you get that exception.

    Try identifying in your class which “numeric” values are mapped as String and have them fixed. Start one by one until it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Everyone use lot of List. I need to iterate over this list, so I
This is the for each to iterate a list of products and I need
Each key in dictionary has list of MANY integers. I need to iterate through
I have a filelist that contains a list of directories. I need to iterate
I am trying to iterate through a list, and I need to perform specific
Ok, What I need to do is iterate through a list of list and
Say you need to have a list/array of integers which you need iterate frequently,
I have a list of rows from a dataset that I need to iterate
I have a list of Latitudes and one of Longitudes and need to iterate
I need to iterate a list of assemblies and determine their version numbers. I've

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.