Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-08-2008, 02:24 PM
Member
 
Join Date: Jun 2008
Posts: 3
ragav is on a distinguished road
Exception in thread "main" java.util.NoSuchElementException
Hi i am using hashmap to store key & value pairs

Before iterating thru hashmap i am checking !map.isEmpty() in
while(!map.isEmpty() && iter.hasNext())
It shows below error..
Exception in thread "main" java.util.NoSuchElementException

how to resolve this.

Thanks
__________________
Ragav
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-08-2008, 02:42 PM
Fubarable's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 899
Fubarable is on a distinguished road
I wonder if you are calling one iter.next() more than once from within the while loop? What does the code within your loop look like?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-08-2008, 02:57 PM
Member
 
Join Date: Jun 2008
Posts: 3
ragav is on a distinguished road
Thanks for ur reply..
The below is my code snippets
while(iter.hasNext()){
while(rs.next()){
selecting values from map
insert into table with map values
}
}
__________________
Ragav
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-08-2008, 03:25 PM
Fubarable's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 899
Fubarable is on a distinguished road
given what you've posted, I have no idea. What is "rs" for instance? Why does it appear that you are not using your iterator even though you are first checking it in the first while condition?...
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 06-08-2008, 04:19 PM
Member
 
Join Date: Jun 2008
Posts: 3
ragav is on a distinguished road
Thanks for ur reply..

I am using iterator for selecting value from map..
Using rs.next() i am selecting value from one table
and then insert both values (from hashmap & table ) into another table..
__________________
Ragav
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Exception in thread "main" java.util.NoSuchElementException thevoice New To Java 5 05-14-2008 03:43 PM
ERROR: Exception in thread "main" java.lang.NoSuchMethodError: main barney New To Java 1 08-07-2007 09:10 AM
Exception in thread "main" java.net.ConnectException: Connection timed out osval Advanced Java 1 07-28-2007 12:59 AM
Error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException romina New To Java 1 07-26-2007 12:55 AM
ArrayList: Exception in thread "main" java.lang.NullPointerException susan New To Java 1 07-16-2007 08:32 AM


All times are GMT +3. The time now is 01:02 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org