Java.util.ConcurrentModification Exception

Hi
I am trying to write a caching object for my web application. I have a CacheMAnger thread which is started when Tomcat starts. I put objects onto the cache and give them a TTL. My thread occasionaly goes through and checks all the cached objects to see if they are expired. I thought this was a syncronization problem but I can't find where.
It bombs when an object expires and gets removed form the cache. The error output is below as well as a copy of the CacheManager source.
Thanks
Michael
<pre>
2003-04-15 12:55:15,161 DEBUG cache.CacheManager$1 82 - CacheManager: CustomerList in Cache... expi
ry?
EXPIRY:Tue Apr 15 17:55:04 GMT 2003CURRENT:Tue Apr 15 17:55:15 GMT 2003
2003-04-15 12:55:15,161 INFO cache.CacheManager$1 90 - CacheManager Removed CustomerList
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:750)
at java.util.HashMap$KeyIterator.next(HashMap.java:786)
at net.talisen.tsr.cache.CacheManager$1.run(CacheManager.java:77)
at java.lang.Thread.run(Thread.java:536)
</pre>
=====================================================================
<pre>
package net.talisen.tsr.cache;
import java.util.HashMap;
import java.util.Set;
import java.util.Iterator;
import org.apache.log4j.Logger;
* Title: Caching
* Description:
* Copyright: Copyright (c) 2001
* @author Michael Holly based on code from Jonathan Lurie in July 2001 Article in JavaWorld
* @version 1.0
public class CacheManager
// This is the HashMap that contains all objects in the cache.
private static java.util.HashMap cacheHashMap = new java.util.HashMap();
// This object acts as a semaphore, which protects the HashMap
// RESERVED FOR FUTURE USE private static Object lock = new Object();
static
try
//Create background thread, which will be responsible for purging expired items.
Thread threadCleanerUpper = new Thread( new Runnable()
// The default time the thread should sleep between scans. The sleep
// method takes in a millisecond value so 5000 = 5 Seconds.
final static int milliSecondSleepTime = 20000;
public void run()
Logger log = Logger.getLogger(CacheManager.class);
try
// Sets up an infinite loop.
while (true)
log.debug( "CacheManager Scanning For Expired Objects...");
// Get the set of all keys that are in cache. These are the unique
// identifiers
Set keySet = null;
Iterator keys = null;
Object key = null;
Cacheable value = null;
synchronized ( cacheHashMap )
keySet = cacheHashMap.keySet();
// An iterator is used to move through the Keyset //
synchronized( keySet )
keys = keySet.iterator();
// Sets up a loop that will iterate through each key in the KeySet
while(keys.hasNext())
// Get the individual key. We need to hold on to this key
// in case it needs to be removed
synchronized ( keys )
key = keys.next();
// Get the cacheable object associated with the key inside the cache
value = (Cacheable)cacheHashMap.get(key);
log.debug( "CacheManager: " + value.getIdentifier() + " in Cache... expiry?");
// Is the cacheable object expired?
if (value.isExpired())
//Yes it's expired! Remove it from the cache
cacheHashMap.remove(key);
cacheHashMap.notifyAll();
log.info( "CacheManager Removed " + key.toString() );
***** A LRU (least-recently used) or
LFU (least-frequently used) *****
******* would best be inserted here *****
// Puts the thread to sleep. Don't need to check it continuously
Thread.sleep( this.milliSecondSleepTime);
catch (Exception e)
e.printStackTrace();
return;
} // End run method
}); // End class definition and close new thread definition
// Sets the thread's priority to the minimum value.
threadCleanerUpper.setPriority( Thread.MIN_PRIORITY );
// Starts the thread.
threadCleanerUpper.start();
catch(Exception e)
System.out.println( "CacheManager.Static Block: " + e);
} // End static block
// default constructor
public CacheManager()
* Used to add an object to the Cache
* @param object the object to be added to the cache
public static void putCache(Cacheable object)
Logger log = Logger.getLogger(CacheManager.class);
// Remember if the HashMap previously contains a mapping for the key, the old value
// will be replaced. This is valid functioning.
if ( object == null ) {
log.debug("object to be cached is null. Caching was not attempted");
return;
if ( object.getIdentifier() == null ) {
log.debug("object to be cached has a null key. Caching was not attempted");
return;
else
synchronized ( cacheHashMap ) {
cacheHashMap.put(object.getIdentifier(), object);
log.debug( object.getIdentifier() + " cached");
* Used to get an object from the cache
* @param object the object to be retrieved from the cache
* @return the cached object
public static Cacheable getCache(Object identifier)
Logger log = Logger.getLogger(CacheManager.class);
if (identifier == null ) {
log.debug( "Cache key was null" );
return null;
log.debug("Looking for " + identifier.toString() );
//synchronized (lock) // UNCOMMENT LINE XXX
//{                    // UNCOMMENT LINE XXX
Cacheable object = null;
synchronized ( cacheHashMap ) {
object = ( Cacheable )cacheHashMap.get(identifier);
// The code to create the object would be placed here.
//} // UNCOMMENT LINE XXX
if (object == null) {
log.debug( "object not found in cache");
return null;
if (object.isExpired())
log.debug( "object in cache was expired");
synchronized ( cacheHashMap ) {
cacheHashMap.remove(identifier);
return null;
else
log.debug( object.getIdentifier() + " found");
object.incrementCacheHits(); // track the performance
return object;
* Used to clear all objects from the cache
public static void emptyCache()
Logger log = Logger.getLogger(CacheManager.class);
synchronized ( cacheHashMap ) {
cacheHashMap.clear();
log.debug( "Cache cleared");
* Used to remove a particular object from the cache
* @param identifier the object to be removed from the cache
public static void removeEntry(Object identifier)
Logger log = Logger.getLogger(CacheManager.class);
if (identifier == null ) {
log.debug( "Cache key was null" );
return;
synchronized ( cacheHashMap ) {
cacheHashMap.remove(identifier);
log.debug( identifier + " removed");
* Used to get a count of cached objects
* @return number of objects in the cache
public static int getCount()
synchronized ( cacheHashMap ) {
return cacheHashMap.size();
* Used to get a set of the entries in the cache
* @param Set a set of the objects in the cache
public static Set getEntrySet()
synchronized ( cacheHashMap ) {
return cacheHashMap.entrySet();
* Used to get a html page on the status of the cache
public static String getStatus()
Set keySet = null;
Iterator keys = null;
synchronized (cacheHashMap) {
keySet = cacheHashMap.keySet();
keys = keySet.iterator();
String status = new String();
status += ( "<html><head>");
status += ( "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />");
status += ( "<meta http-equiv=\"Pragma\" content=\"no-cache\" />");
status += ( "<meta http-equiv=\"Expires\" content=\"0\" /> ");
status += ( "<meta http-equiv=\"refresh\" content=\"10\" /> ");
status += ( "</head><body>" );
status += ( "<p><h4>Cache Status " + (new java.util.Date()).toString() + "</h4>" );
status += ( "<br>Page automagically refreshed every 10 seconds<br>" );
status += ( getCount() + " object(s) cached" );
status += ( "<p>Cache contains: " );
while(keys.hasNext())
Object key = keys.next();
// Get the cacheable object associated with the key inside the cache
Cacheable object = null;
synchronized ( cacheHashMap ) {
object = (Cacheable)cacheHashMap.get(key);
status += ( "<br><b>ID:</b><i>" + object.getIdentifier() + "</i>" );
status += ( "<br>   <b>Class of:</b><i>" + object.toString() + "</i>");
status += ( "<br>   <b> Expires at:</b><i>" + object.getExpireDate() + "</i>");
status += ( "<br>   <b> Cache Hits:</b><i>" + object.getCacheHits().toString() + "</i>");
status += ( "<br>   <b> Object Size:</b><i>" + object.getByteCount(object).toString() + "</i>");
int bytesServed = object.getCacheHits().intValue() * object.getByteCount(object).intValue();
double eff = 0.0;
// handle divide by 0
if ( bytesServed > 0 ) {
eff = ( bytesServed - object.getByteCount(object).intValue() ) / bytesServed;
status += ( "<br>   <b> Cache Efficiency:</b><i>" + eff + "</i><br><br>");
status += ( "</body></html>" );
return status;
* Used to get a html page on the status of the cache
public static String flushCache()
Set keySet = null;
Iterator keys = null;
synchronized ( cacheHashMap ) {
keySet = cacheHashMap.keySet();
keys = keySet.iterator();
String status = new String();
status += ( "<html><head>");
status += ( "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />");
status += ( "<meta http-equiv=\"Pragma\" content=\"no-cache\" />");
status += ( "<meta http-equiv=\"Expires\" content=\"0\" /> ");
status += ( "</head><body>" );
status += ( "<p><h4>Cache status before cache reset " + (new java.util.Date()).toString() + "</h4>" );
status += ( "<p>Cache size: " + getCount() + " object(s) cached" );
status += ( "<p>Cache contains: " );
while(keys.hasNext())
Object key = keys.next();
// Get the cacheable object associated with the key inside the cache
Cacheable object = null;
synchronized ( cacheHashMap ) {
object = (Cacheable)cacheHashMap.get(key);
status += ( "<br><b>ID:</b><i>" + object.getIdentifier() + "</i> <b>Class of:</b><i>" + object.toString() );
status += ( "</i><b> Expires at:</b>" + object.getExpireDate() + "</i>");
CacheManager.emptyCache();
status += ( "<p><h4>Cache status after cache reset " + (new java.util.Date()).toString() + "</h4>" );
status += ( "<p>Cache size: " + CacheManager.getCount() + " object(s) cached" );
status += ( "<p>Cache contains: " );
Set newKeySet = null;
Iterator newKeys = null;
synchronized ( cacheHashMap ) {
newKeySet = cacheHashMap.keySet();
newKeys = newKeySet.iterator();
// this really never gets executed
while(newKeys.hasNext())
Object key = newKeys.next();
// Get the cacheable object associated with the key inside the cache
Cacheable object = null;
synchronized ( cacheHashMap ) {
object = (Cacheable)cacheHashMap.get(key);
status += ( "<br><b>ID:</b><i>" + object.getIdentifier() + "</i> <b>Class of:</b><i>" + object.toString() );
status += ( "</i><b> Expires at:</b>" + object.getExpireDate() + "</i>");
status += ( "</body></html>" );
return status;
</pre>

I think my problem is that I am iterating through all the values of the hashMap and when I find one and delete it then the iterator becomes invalid? Checkout the while loop in the thread.
I'm not sure that this scenario is consistant with the error I'm getting.
I had tried something similar to what you described... maybe I missed something. Let me try it again...
I have reposted my code below with the proper tags to render the code if you need to reference for any more suggestions.
Michael
package net.talisen.tsr.cache;
import java.util.HashMap;
import java.util.Set;
import java.util.Iterator;
import org.apache.log4j.Logger;
* Title:        Caching
* Description:
* Copyright:    Copyright (c) 2001
* @author Michael Holly based on code from Jonathan Lurie in July 2001 Article in JavaWorld
* @version 1.0
public class CacheManager
   // This is the HashMap that contains all objects in the cache.
   private static java.util.HashMap cacheHashMap = new java.util.HashMap();
   // This object acts as a semaphore, which protects the HashMap
   // RESERVED FOR FUTURE USE  private static Object lock = new Object();
   static
      try
         //Create background thread, which will be responsible for purging expired items.
         Thread threadCleanerUpper = new Thread( new Runnable()
            //  The default time the thread should sleep between scans.  The sleep
            //  method takes in a millisecond value so 5000 = 5 Seconds.
            final static int milliSecondSleepTime = 20000;
            public void run()
               Logger log = Logger.getLogger(CacheManager.class);
               try
                  // Sets up an infinite loop.
                  while (true)
                     log.debug( "CacheManager Scanning For Expired Objects...");
                     // Get the set of all keys that are in cache.  These are the unique
                     // identifiers
                     Set keySet      = null;
                     Iterator keys   = null;
                     Object key      = null;
                     Cacheable value = null;
                     synchronized ( cacheHashMap )
                        keySet = cacheHashMap.keySet();
                        // An iterator is used to move through the Keyset //
                        synchronized( keySet )
                           keys = keySet.iterator();
                        // Sets up a loop that will iterate through each key in the KeySet
                        while(keys.hasNext())
                           // Get the individual key. We need to hold on to this key
                           // in case it needs to be removed
                           synchronized ( keys )
                              key = keys.next();
                           // Get the cacheable object associated with the key inside the cache
                           value = (Cacheable)cacheHashMap.get(key);
                           log.debug( "CacheManager: " + value.getIdentifier() + " in Cache... expiry?");
                           // Is the cacheable object expired?
                           if (value.isExpired())
                              //Yes it's expired! Remove it from the cache
                              cacheHashMap.remove(key);
                              cacheHashMap.notifyAll();
                              log.info( "CacheManager Removed " + key.toString() );
                         ***** A LRU (least-recently used) or
                                              LFU (least-frequently used) *****
                         ******* would best be inserted here              *****
                     // Puts the thread to sleep. Don't need to check it continuously
                     Thread.sleep( this.milliSecondSleepTime);
               catch (Exception e)
                  e.printStackTrace();
               return;
            } // End run method
         }); // End class definition and close new thread definition
         // Sets the thread's priority to the minimum value.
         threadCleanerUpper.setPriority( Thread.MIN_PRIORITY );
         // Starts the thread.
         threadCleanerUpper.start();
      catch(Exception e)
         System.out.println( "CacheManager.Static Block: " + e);
   } // End static block
   // default constructor
   public CacheManager()
   * Used to add an object to the Cache
   * @param object the object to be added to the cache
   public static void putCache(Cacheable object)
      Logger log = Logger.getLogger(CacheManager.class);
      // Remember if the HashMap previously contains a mapping for the key, the old value
      // will be replaced.  This is valid functioning.
      if ( object == null ) {
         log.debug("object to be cached is null. Caching was not attempted");
         return;
      if ( object.getIdentifier() == null ) {
         log.debug("object to be cached has a null key. Caching was not attempted");
         return;
      else
         synchronized ( cacheHashMap ) {
            cacheHashMap.put(object.getIdentifier(), object);
            log.debug( object.getIdentifier() + " cached");
   * Used to get an object from the cache
   * @param object the object to be retrieved from the cache
   * @return the cached object
   public static Cacheable getCache(Object identifier)
      Logger log = Logger.getLogger(CacheManager.class);
      if (identifier == null ) {
         log.debug( "Cache key was null" );
         return null;
      log.debug("Looking for " + identifier.toString() );
      Cacheable object = null;
      synchronized ( cacheHashMap )  {
         object = ( Cacheable )cacheHashMap.get(identifier);
      if (object == null) {
         log.debug( "object not found in cache");
         return null;
      if (object.isExpired())
         log.debug( "object in cache was expired");
         synchronized ( cacheHashMap )  {
            cacheHashMap.remove(identifier);
         return null;
      else
         log.debug( object.getIdentifier() + " found");
         object.incrementCacheHits(); // track the performance
         return object;
   * Used to clear all objects from the cache
   public static void emptyCache()
      Logger log = Logger.getLogger(CacheManager.class);
      synchronized ( cacheHashMap )  {
         cacheHashMap.clear();
      log.debug( "Cache cleared");
   * Used to remove a particular object from the cache
   * @param identifier the object to be removed from the cache
   public static void removeEntry(Object identifier)
      Logger log = Logger.getLogger(CacheManager.class);
      if (identifier == null ) {
         log.debug( "Cache key was null" );
         return;
      synchronized ( cacheHashMap )  {
         cacheHashMap.remove(identifier);
      log.debug( identifier + " removed");
   * Used to get a count of cached objects
   * @return number of objects in the cache
   public static int getCount()
      synchronized ( cacheHashMap )  {
         return cacheHashMap.size();
   * Used to get a set of the entries in the cache
   * @param Set a set of the objects in the cache
   public static Set getEntrySet()
      synchronized ( cacheHashMap )  {
         return cacheHashMap.entrySet();
   * Used to get a html page on the status of the cache
   public static String getStatus()
      Set keySet = null;
      Iterator keys = null;
      synchronized (cacheHashMap) {
         keySet = cacheHashMap.keySet();
         keys = keySet.iterator();
      String status = new String();
      status += ( "<html><head>");
      status += ( "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />");
      status += ( "<meta http-equiv=\"Pragma\" content=\"no-cache\" />");
      status += ( "<meta http-equiv=\"Expires\" content=\"0\" /> ");
      status += ( "<meta http-equiv=\"refresh\" content=\"10\" /> ");
      status += ( "</head><body>" );
      status += ( "<p><h4>Cache Status " + (new java.util.Date()).toString() + "</h4>" );
      status += ( "<br>Page automagically refreshed every 10 seconds<br>" );
      status += ( getCount() + " object(s) cached" );
      status += ( "<p>Cache contains: " );
      while(keys.hasNext())
         Object key = keys.next();
         // Get the cacheable object associated with the key inside the cache
         Cacheable object = null;
         synchronized ( cacheHashMap )  {
            object = (Cacheable)cacheHashMap.get(key);
         status += ( "<br><b>ID:</b><i>" + object.getIdentifier() + "</i>"  );
         status += ( "<br>���<b>Class�of:</b><i>" + object.toString() + "</i>");
         status += ( "<br>���<b> Expires at:</b><i>" + object.getExpireDate() + "</i>");
         status += ( "<br>���<b> Cache Hits:</b><i>" + object.getCacheHits().toString() + "</i>");
         status += ( "<br>���<b> Object Size:</b><i>" + object.getByteCount(object).toString() + "</i>");
         int bytesServed = object.getCacheHits().intValue() * object.getByteCount(object).intValue();
         double eff = 0.0;
         // handle divide by 0
         if ( bytesServed > 0 ) {
            eff = ( bytesServed - object.getByteCount(object).intValue() ) / bytesServed;
         status += ( "<br>���<b> Cache Efficiency:</b><i>" + eff + "</i><br><br>");
      status += ( "</body></html>" );
      return status;
   * Used to get a html page on the status of the cache
   public static String flushCache()
      Set keySet = null;
      Iterator keys = null;
      synchronized ( cacheHashMap )  {
         keySet = cacheHashMap.keySet();
         keys   = keySet.iterator();
      String status = new String();
      status += ( "<html><head>");
      status += ( "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />");
      status += ( "<meta http-equiv=\"Pragma\" content=\"no-cache\" />");
      status += ( "<meta http-equiv=\"Expires\" content=\"0\" /> ");
      status += ( "</head><body>" );
      status += ( "<p><h4>Cache status before cache reset " + (new java.util.Date()).toString() + "</h4>" );
      status += ( "<p>Cache size: " + getCount() + " object(s) cached" );
      status += ( "<p>Cache contains: " );
      while(keys.hasNext())
         Object key = keys.next();
         // Get the cacheable object associated with the key inside the cache
         Cacheable object = null;
         synchronized ( cacheHashMap )  {
            object = (Cacheable)cacheHashMap.get(key);
         status += ( "<br><b>ID:</b><i>" + object.getIdentifier() + "</i>  <b>Class of:</b><i>" + object.toString() );
         status += ( "</i><b> Expires at:</b>" + object.getExpireDate() + "</i>");
      CacheManager.emptyCache();
      status += ( "<p><h4>Cache status after cache reset " + (new java.util.Date()).toString() + "</h4>" );
      status += ( "<p>Cache size: " + CacheManager.getCount() + " object(s) cached" );
      status += ( "<p>Cache contains: " );
      Set newKeySet = null;
      Iterator newKeys = null;
      synchronized ( cacheHashMap )  {
         newKeySet = cacheHashMap.keySet();
         newKeys   = newKeySet.iterator();
      // this really never gets executed
      while(newKeys.hasNext())
         Object key = newKeys.next();
         // Get the cacheable object associated with the key inside the cache
         Cacheable object = null;
         synchronized ( cacheHashMap )  {
            object = (Cacheable)cacheHashMap.get(key);
         status += ( "<br><b>ID:</b><i>" + object.getIdentifier() + "</i>  <b>Class of:</b><i>" + object.toString() );
         status += ( "</i><b> Expires at:</b>" + object.getExpireDate() + "</i>");
      status += ( "</body></html>" );
      return status;

Similar Messages

  • Java.util.Data Exception when Testing Function

    Hi All,
    using VC I'm tring to test fuction HRPWC_RFC_AS_OVERVIEW. The field ViewId is the only one mandatory. When I've executed function I've obtained java.util.Date exception.
    What does that mean? What should I set properly to test the function?
    Regards,
    Marek

    Hi Marek,
    I suppose you meant HRWPC_RFC_AS_OVERVIEW. This is an HR rfc that displays employee’s absence. I tested it in my VC and it works fine. I’ll need some more details on how you’ve created the model in order to help you. 
    Regards,
    Lisi

  • Java.util.Zip Exception

    Hi All
    I am trying to deploy an ear which contains a session
    bean .I have added some jars to the ear which are required  for the hibernate.
    At the time of the deploying i am getting the follwing
    error
    Please giude me to solve this problem
    Thanks and Regards
    Satyam
    10/09/02 05:35:58 -  EAR file uploaded to server for 2781ms.
    10/09/02 05:43:12 -  ERROR: Not deployed. Deploy Service returned ERROR:
                         java.rmi.RemoteException: Error while getting the internal libraries of application sap.com/SampleHibernateEar in operation deploy..
                         Reason: The system cannot find the file specified; nested exception is:
                              java.util.zip.ZipException: The system cannot find the file specified
                              at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:478)
                              at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1555)
                              at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:294)
                              at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:183)
                              at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:119)
                              at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
                              at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
                              at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
                              at java.security.AccessController.doPrivileged(Native Method)
                              at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
                              at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
                         Caused by: java.util.zip.ZipException: The system cannot find the file specified
                              at java.util.zip.ZipFile.open(Native Method)
                              at java.util.zip.ZipFile.<init>(ZipFile.java:112)
                              at java.util.jar.JarFile.<init>(JarFile.java:127)
                              at java.util.jar.JarFile.<init>(JarFile.java:65)
                              at com.sap.engine.services.deploy.ear.jar.EARReader.getAdditionalLibrariesEntries(EARReader.java:788)
                              at com.sap.engine.services.deploy.server.application.DeployUtilTransaction.commonBegin(DeployUtilTransaction.java:281)
                              at com.sap.engine.services.deploy.server.application.DeploymentTransaction.begin(DeploymentTransaction.java:296)
                              at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:290)
                              at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:323)
                              at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:3033)
                              at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:463)
                              ... 10 more
                         For detailed information see the log file of the Deploy Service.
    10/09/02 05:43:12 -  ***********************************************************
    Sep 2, 2010 5:43:12 AM   Info: End of log messages of the target system.
    Sep 2, 2010 5:43:12 AM   Info: ***** End of SAP J2EE Engine Deployment (J2EE Application) *****
    Sep 2, 2010 5:43:12 AM   Error: Aborted: development component 'SampleHibernateEar'/'sap.com'/'localhost'/'2006.09.01.17.09.15':
    Caught exception during application deployment from SAP J2EE Engine's deploy service:
    java.rmi.RemoteException: Error while getting the internal libraries of application sap.com/SampleHibernateEar in operation deploy..
    Reason: The system cannot find the file specified; nested exception is:
         java.util.zip.ZipException: The system cannot find the file specified
    (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Sep 2, 2010 5:43:12 AM   Info: J2EE Engine is in same state (online/offline) as it has been before this deployment process.
    Sep 2, 2010 5:43:12 AM   Error: -
    At least one of the Deployments failed -

    Hi Satya,
    Does your EAR contain EJB jar from EJB project? You can try to open EAR file with zip and check.
    Best regards, Maksim Rashchynski.

  • Java.util.zip Exception - please HELP!

    I have a java program which updates some zip-jar files (in fact OpenOffice files).
    It works fine on Window 2000 jdk 1.4.2,
    but on Netware with jdk 1.4.2 at receive the exception like this:
    java.util.zip.ZipException: invalid entry crc-32
    ( expected 0xffffffff543978 but got 0xec543978 )
    What can be the problem? Any idea is mutch appreciated.
    It makes me crazzy.

    any idea? Thanks.

  • Finding java.util.MissingResourceException exception

    I want to access the parameters which are set in the '.properties' file using "ResourceBundle" .
    I am accessing this in '.jsp' file but I am finding the exception as -
    'Exception while Downloadingdoc:java.util.MissingResourceException: Can't find bundle for base name Newsdb, locale en_US'
    so plz help me out.
    Thanks
    manvik

    Why not just use a Properties class.....
    Then do a properties.load()

  • Throw "java.util.Vector" exception?

    In my servlet, I got catch(Throwable t), t.getMessage() is java.util.Vector. Can anyone tell me where I should look into for this problem?

    probably a ClassCastException. Why don't you get the stack trace?

  • Java.util.zipException in linux

    Using Linux (Mandrake 8.2) when I enter:
    /usr/java/j2sdk1.4.0/bin/java -jar jedit40install.jar
    I get an error:
    Exception in thread "main" java.util.zip.Exception: No such file or directory
    at java.util.zip.zipFile.open (native method)
    at java.util.zip.zipFile.(ZipFile.java:112)
    at java.util.zip.zipFile.(ZipFile.java:117)
    at java.util.zip.zipFile.(ZipFile.java:55)
    Any ideas how to resolve this? I'd greatly appreciate any assistance
    fyi -this is crossposted at http://community.jedit.org but, as of yet, nobody has even read it.

    thanks. your suggestions made it work. For other users with a similar problem, here is what I did to make it work.
    to find my install working directory, in the console I entered:
    locate jeditinstall40.jar
    It listed the path as /usr/bin/java/j2sdk1.4.0/bin/jedit40install.jar
    I then entered:
    /usr/java/j2sdk1.4.0/bin/java -jar /usr/java/j2sdk1.4.0/bin/jedit40install.jar

  • Java.util.logging question

    'Lo all -
    I'm new to Java, so bear with me on this question - I'm sure it has a simple answer.
    I am using the following code to create a new Logger object:
    public class TAGLogging {
        private Logger oLog;
        private FileHandler oLogFile;
        private String sLoggingFolder = "AppLogs";
        private String sFormattedDateTime = String.format("%1$tY%1$tm%1$td_%1$tH%1$tM%1$tS",Calendar.getInstance());
        private String sCallingClass = new Throwable().fillInStackTrace().getStackTrace()[1].getClassName();
        private String sCallingMethod = new Throwable().fillInStackTrace().getStackTrace()[1].getMethodName();
        /** Constructors */
        public TAGLogging(String sLogFileName) throws IOException {
            this.initialSetup(sLogFileName);
        public TAGLogging() throws IOException {
            String sLogFileName = sLoggingFolder + File.separator + sFormattedDateTime + ".xml";
            this.initialSetup(sLogFileName);
        /** Methods */
        private void initialSetup(String logFileName) throws IOException {
            oLogFile = new FileHandler(logFileName);
            oLog = Logger.getLogger(sCallingClass);
            oLog.addHandler(oLogFile);      
            oLog.setLevel(Level.ALL);
        }Everything is being logged correctly to the /AppLogs/yyyymmdd_HHMMSS.xml file. The problem is that there is another file that is being created in my home directory, which incidentally, is not where the program is located. The name, java01.log, matches the default logging.properties file set up, but I have removed all that and changed the file to the following (minus all the comments):
    handlers= java.util.logging.FileHandler
    .level= INFO
    java.util.logging.FileHandler.level = ALL
    java.util.logging.FileHandler.limit = 50000
    java.util.logging.FileHandler.count = 1
    java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
    java.util.logging.ConsoleHandler.level = INFO
    java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
    The java01.log file contains the exact same contents as the file I am purposely logging to, the AppLogs/yyyymmd_HHMMSS.xml one.
    Does anyone have any clue what is causing this file to get created, and if so, how do I stop it?
    Message was edited by:
    malakh

    Man, I REALLY hate to do this, but it looks like I may be forced to work around it instead of fixing the issue. I'll have to add some code to manually remove the java01.log file when it's done writing to it.
    Navy - Turns out that Log4j is pretty much the same thing as java.util.logging, except on steroids. It is almost identical syntactically, just has more options and more flexibility than JUL.

  • File upload in KM throws a system exception: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key xtlt_Required

    Hi All,
    We are on Netweaver 7.01 SP14. (well I understand we are way behind patch levels, but a simple file upload should be working ?/)
    We are trying to upload (HTML &/ Image) a file in one of the KM's public folder.
    As and when we select folder and click on upload we get the below message:
    Below is the error trace details:
    Full Message Text
    com.sapportals.wdf.WdfException
    at com.sapportals.wcm.control.edit.ResourceUploadControl.render(ResourceUploadControl.java:688)
    at com.sapportals.wdf.layout.HorizontalLayout.renderControls(HorizontalLayout.java:42)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:155)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.WdfCompositeController.internalRender(WdfCompositeController.java:709)
    at com.sapportals.wdf.WdfCompositeController.buildComposition(WdfCompositeController.java:674)
    at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:33)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.portal.htmlb.PrtContext.render(PrtContext.java:408)
    at com.sapportals.htmlb.page.DynPage.doOutput(DynPage.java:238)
    at com.sapportals.wcm.portal.component.base.KMControllerDynPage.doOutput(KMControllerDynPage.java:134)
    at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:133)
    at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
    at com.sapportals.wcm.portal.component.base.ControllerComponent.doContent(ControllerComponent.java:88)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
    at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
    at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:249)
    at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:557)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1064)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
    at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    --- Nested WDF Exception -----------------------
    java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key xtlt_Required
    at java.util.ResourceBundle.getObject(ResourceBundle.java:327)
    at java.util.ResourceBundle.getObject(ResourceBundle.java:324)
    at java.util.ResourceBundle.getString(ResourceBundle.java:287)
    at com.sapportals.wcm.util.resource.ResourceBundles.getString(ResourceBundles.java:55)
    at com.sapportals.wcm.control.base.WcmBaseControl.getBaseBundleString(WcmBaseControl.java:150)
    at com.sapportals.wcm.control.base.WcmBaseControl.getBaseBundleString(WcmBaseControl.java:176)
    at com.sapportals.wcm.control.edit.ResourceUploadControl.renderUploadFileContent(ResourceUploadControl.java:773)
    at com.sapportals.wcm.control.edit.ResourceUploadControl.render(ResourceUploadControl.java:655)
    at com.sapportals.wdf.layout.HorizontalLayout.renderControls(HorizontalLayout.java:42)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:155)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.WdfCompositeController.internalRender(WdfCompositeController.java:709)
    at com.sapportals.wdf.WdfCompositeController.buildComposition(WdfCompositeController.java:674)
    at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:33)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.portal.htmlb.PrtContext.render(PrtContext.java:408)
    at com.sapportals.htmlb.page.DynPage.doOutput(DynPage.java:238)
    at com.sapportals.wcm.portal.component.base.KMControllerDynPage.doOutput(KMControllerDynPage.java:134)
    at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:133)
    at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
    at com.sapportals.wcm.portal.component.base.ControllerComponent.doContent(ControllerComponent.java:88)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
    at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
    at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:249)
    at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:557)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1064)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
    at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176) 

    Hi Vijay,
    Thanks for the quick reply.
    I have gone through the notes 1535201  & now on 1606563  after your advise.
    Both the notes says the fix is available on 7.01 after SP 07 and we are on SP 14 already.
    Also just in case I did checked with our basis and they confirmed we are a head and we have the above notes in our release already.
    Unfortunately the notes are not the solution to the investigation till date.
    Thanks,
    Sai

  • Java.utils.prefs.Preferences API throws exception on Mac, not Windows

    This is a Mac-specific problem. Is it a bug, or am I misusing the java.utils.prefs.Preferences API?
    The Preferences flush() API call always throws a BackingStoreException if a system tree preferences root has been read. The system tree has not been modified or written to, but the flush() call is nevertheless throwing an exception. This occurs when running as a normal user without the ability to write to /Library/Preferences.
    See sample code below. Note that I only want to read the system prefs tree. The user tree write flush fails. If the system tree node is not created, the user flush() succeeds.
    Steps to Reproduce
    Delete any existing Java prefs files:
    ~/Library/Preferences/com.apple.java.util.prefs.plist
    ~/Library/Preferences/com.mycompany.prefstest
    /Library/Preferences/com.apple.java.util.prefs.plist
    /Library/Preferences/com.mycompany.prefstest
    Run the following Java code:
    package com.mycompany.prefstest;
    import java.util.prefs.BackingStoreException;
    import java.util.prefs.Preferences;
    public class PrefsTest {
          * @param args
         public static void main(String[] args) {
              String strKey1 = "com/mycompany/prefstest/one/two/three/four/key1";
              Preferences systemRoot = Preferences.systemRoot();
              Preferences userRoot = Preferences.userRoot();
              // Get a value for user prefs.
              String value1 = userRoot.get(strKey1, "missing");
              // Fall back to system prefs if it is not defined.
              if (value1.equals("missing"))
                   value1 = systemRoot.get(strKey1, "missing");
              System.out.println("key1 --> " + value1);
              // If still not defined, set a user-specific value
              if (value1.equals("missing"))
                   userRoot.put(strKey1, "value1");
                   try {
                        userRoot.flush();
                        System.out.println("flushed prefs successfully");
                   catch (BackingStoreException e)
                        System.out.println("Exception: " + e.toString());
    Expected Results
    Should produce the output:
    key --> missing
    flushed prefs successfully
    Actual Results
    Console output is
    key --> missing
    Exception: java.util.prefs.BackingStoreException: Synchronization failed for node '/'
    Notes
    $ java -version
    java version "1.6.0_29"
    Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11D50b)
    Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
    also tested with:
    java version "1.7.0_04-ea"
    Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b16)
    Java HotSpot(TM) 64-Bit Server VM (build 23.0-b17, mixed mode)
    Mac OS X 10.7.3.
    The "Expected Results" are correctly obtained running the same code on MS-Windows.
    Running the jar as sudo works (with write access to /Library/Preferences), as expected.

    Just for fun, try a key without slashes in it (but for example dots if you must use such a long key).
    I say that because a quick Google search points out that Apple stores the preferences in a file hierarchy in the user home folder. I can already see how using keys which look like a file path are going to cause nuclear reactors to meltdown...

  • Exception in thread "main" java.util.NoSuchElementException

    Hello there,
    I need to store resultset values in arrays.
    Following is my code:
    (Note : The function uses the jdbc connection with mysql that is return from other function.)
    public static void getResultSetInArray(Connection con) throws Exception
    Map list = new HashMap();
    Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
    ResultSet rs = stmt.executeQuery("show columns from launchcomm.events");
    while(rs.next())
    list.put(rs.getString("Field"),rs.getString("Type"));
    rs.close();
    con.close();
    System.out.println("List = " + list + "\n");
    Iterator iter = null;
    iter = list.keySet().iterator();
    System.out.println("iter = " + iter);
    String field;
    String type;
    int i=1;
    System.out.println("list size = " + list.size());
    while(iter.hasNext() != false)
    System.out.println("iter.hasNext() = " + iter.hasNext() +"......" +(i++));
    System.out.println("iter.next() = " + iter.next());
    field = (String)iter.next();
    type = (String)list.get(iter.next());
    Following is my output with error:
    List = {folder_name=varchar(50), is_repeat=tinyint(1), footer=text, thankyou_email=text, box_header_bg_color=varchar(25), organization_id=int(11), attendee_delete_right=tinyint(1), show_ticket_remaining=tinyint(1), order_confirmation_email=text, save_for_later=tinyint(1), start_register=tinyint(4), id=int(11), logo=varchar(100), publish=tinyint(1), end_unregister=datetime, owner_id=int(11), confirmation_email=text, audience_id=int(11), event_color_code=varchar(30), showcalendar=tinyint(1), registration_enddate=datetime, directory_name=varchar(20), eventstatus_id=int(11), contact_id=int(11), password_protect=tinyint(1), include_header=tinyint(1), thankyou_page=text, header=text, is_hotel_capacity=tinyint(1), want_close=tinyint(1), travel_housing_request=tinyint(1), box_header_text_color=varchar(25), default_location_id=int(11), end_reg_modification=datetime, user_id=int(11), passkey_eventcode=varchar(255), page_size=int(11), passkey_password=varchar(255), event_capacity=int(11), box_text_color=varchar(25), updated_on=datetime, link_color=varchar(25), ends_on=datetime, hotel_capacity=int(11), template_id=int(11), allow_overlap_session=tinyint(1), starts_on=datetime, reg_another_button=varchar(50), passkey_partnerid=int(11), personalized_url=tinyint(1), hide_start_date=tinyint(1), hide_end_date=tinyint(1), include_footer=tinyint(1), text_color=varchar(25), allow_another_registrant=tinyint(1), passkey_eventid=int(11), resize=tinyint(1), default_closetemplate=tinyint(1), dateformat=text, personalize_agenda=tinyint(1), cssfile_id=int(11), passkey_information=tinyint(1), confirmation_page=text, activate_waitlist=tinyint(1), box_border_color=varchar(25), google_analytics_code=text, show_iframe_design=tinyint(1), confirmation_mail_format=tinyint(1), url=varchar(100), bg_color=varchar(25), package_id=int(11), name=varchar(200), password=varchar(50), capacity=int(11), modify_registration=tinyint(1), is_event_capacity=tinyint(1), include_css=tinyint(1), passkey_username=varchar(255), created_on=datetime, promote_url=varchar(100), page_views=int(11), box_bg_color=varchar(25), title_text_color=varchar(25), registration_open_text=text, require_login=tinyint(1), closetemplate_description=text, registration_startdate=datetime, domain=varchar(200), timezone_id=varchar(100), description=text, tag=varchar(255), allow_unregister=tinyint(1), order_confirmation_page=text, css=text, showmap=tinyint(1)}
    iter = java.util.HashMap$KeyIterator@18a47e0
    list size = 95
    iter.hasNext() = true......1
    iter.next() = folder_name
    iter.hasNext() = true......2
    iter.next() = footer
    iter.hasNext() = true......3
    iter.next() = box_header_bg_color
    iter.hasNext() = true......4
    iter.next() = attendee_delete_right
    iter.hasNext() = true......5
    iter.next() = order_confirmation_email
    iter.hasNext() = true......6
    iter.next() = start_register
    iter.hasNext() = true......7
    iter.next() = logo
    iter.hasNext() = true......8
    iter.next() = end_unregister
    iter.hasNext() = true......9
    iter.next() = confirmation_email
    iter.hasNext() = true......10
    iter.next() = event_color_code
    iter.hasNext() = true......11
    iter.next() = registration_enddate
    iter.hasNext() = true......12
    iter.next() = eventstatus_id
    iter.hasNext() = true......13
    iter.next() = password_protect
    iter.hasNext() = true......14
    iter.next() = thankyou_page
    iter.hasNext() = true......15
    iter.next() = is_hotel_capacity
    iter.hasNext() = true......16
    iter.next() = travel_housing_request
    iter.hasNext() = true......17
    iter.next() = default_location_id
    iter.hasNext() = true......18
    iter.next() = user_id
    iter.hasNext() = true......19
    iter.next() = page_size
    iter.hasNext() = true......20
    iter.next() = event_capacity
    iter.hasNext() = true......21
    iter.next() = updated_on
    iter.hasNext() = true......22
    iter.next() = ends_on
    iter.hasNext() = true......23
    iter.next() = template_id
    iter.hasNext() = true......24
    iter.next() = starts_on
    iter.hasNext() = true......25
    iter.next() = passkey_partnerid
    iter.hasNext() = true......26
    iter.next() = hide_start_date
    iter.hasNext() = true......27
    iter.next() = include_footer
    iter.hasNext() = true......28
    iter.next() = allow_another_registrant
    iter.hasNext() = true......29
    iter.next() = resize
    iter.hasNext() = true......30
    iter.next() = dateformat
    iter.hasNext() = true......31
    iter.next() = cssfile_id
    iter.hasNext() = true......32
    iter.next() = confirmation_page
    iter.hasNext() = true......33
    iter.next() = box_border_color
    iter.hasNext() = true......34
    iter.next() = show_iframe_design
    iter.hasNext() = true......35
    iter.next() = url
    iter.hasNext() = true......36
    iter.next() = package_id
    iter.hasNext() = true......37
    iter.next() = password
    iter.hasNext() = true......38
    iter.next() = modify_registration
    iter.hasNext() = true......39
    iter.next() = include_css
    iter.hasNext() = true......40
    iter.next() = created_on
    iter.hasNext() = true......41
    iter.next() = page_views
    iter.hasNext() = true......42
    iter.next() = title_text_color
    iter.hasNext() = true......43
    iter.next() = require_login
    iter.hasNext() = true......44
    iter.next() = registration_startdate
    iter.hasNext() = true......45
    iter.next() = timezone_id
    iter.hasNext() = true......46
    iter.next() = tag
    iter.hasNext() = true......47
    iter.next() = order_confirmation_page
    iter.hasNext() = true......48
    iter.next() = showmap
    Exception in thread "main" java.util.NoSuchElementException
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:844)
    at java.util.HashMap$KeyIterator.next(HashMap.java:877)
    at GetDataTypeFromDB.getResultSetInArray(GetDataTypeFromDB.java:57)
    at GetDataTypeFromDB.main(GetDataTypeFromDB.java:16)
    I am unable to fine the reason for the exception.
    Please help me to solve my problem.
    Regards,
    Thevoice
    Edited by: TheVoice on May 14, 2008 12:01 AM

    TheVoice wrote:
    while(iter.hasNext() != false)
    System.out.println("iter.hasNext() = " + iter.hasNext() +"......" +(i++));
    System.out.println("iter.next() = " + iter.next());
    field = (String)iter.next();
    type = (String)list.get(iter.next());
    }Your major problem is that iter.next() advances one place every time you call it, so in every iteration of that loop, you advance three steps. The first step is guaranteed to be okay, because you checked it with iter.hasNext(), but the other two are not. In addition, you are in effect "skipping" the printing of two out of every three items.
    To print out every item, you probably want to do something like this (call it only one and store it in a variable):
    while(iter.hasNext())
        String field = (String)iter.next();
        System.out.println("iter.hasNext() = " + iter.hasNext() +"......" +(i++));
        System.out.println("iter.next() = " + field);
        String type = (String)list.get(field);
    }For additional clarity, I would recommend using Generics, Map.entrySet(), and the for-each loop:
    public static void getResultSetInArray(Connection con) throws Exception
        Map<String,String> list = new HashMap<String,String>();
        Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
        ResultSet rs = stmt.executeQuery("show columns from launchcomm.events");
        while(rs.next())
            list.put(rs.getString("Field"),rs.getString("Type"));
        rs.close();
        con.close();
        for (Map.Entry<String,String> e : list.entrySet())
            String field = e.getKey();
            String type = e.getValue();
            // do stuff with them
    }Edited by: spoon_ on May 14, 2008 7:34 PM

  • Weird exception: Cannot instantiate non-persistent class: java.util.Map

    java.lang.UnsupportedOperationException: Cannot instantiate non-persistent class: java.util.Map
         at com.sleepycat.persist.impl.NonPersistentFormat.newInstance(NonPersistentFormat.java:45)
         at com.sleepycat.persist.impl.PersistEntityBinding.readEntity(PersistEntityBinding.java:89)
         at com.sleepycat.persist.impl.PersistEntityBinding.entryToObject(PersistEntityBinding.java:61)
         at com.sleepycat.persist.PrimaryIndex.put(PrimaryIndex.java:338)
         at com.sleepycat.persist.PrimaryIndex.put(PrimaryIndex.java:299)
         at com.xx.support.dbd.IdentityDataAccessor.insert(IdentityDataAccessor.java:33)
         at com.xx.support.dbd.BerkeleyDBAccountStorage.saveUser(BerkeleyDBAccountStorage.java:95)
         at com.xx.support.bdb.BerkeleyDBAccountStorageTests.initBerkeleyDBData(BerkeleyDBAccountStorageTests.java:38)
         at com.xx.support.bdb.BerkeleyDBAccountStorageTests.setUp(BerkeleyDBAccountStorageTests.java:28)
         at junit.framework.TestCase.runBare(TestCase.java:125)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
    What's the root cause of this exception?

    I wrote a small test using the classes you included
    in your message and I am able to retrieve the user by
    key, as in the code above. So I'm not sure what
    you're doing that is causing the problem. Please
    send a small test that reproduces the problem.Oops, I forgot to include the source for the test I wrote. Here it is.
    import java.io.File;
    import java.util.HashMap;
    import java.util.Map;
    import com.sleepycat.je.DatabaseException;
    import com.sleepycat.je.Environment;
    import com.sleepycat.je.EnvironmentConfig;
    import com.sleepycat.persist.EntityStore;
    import com.sleepycat.persist.PrimaryIndex;
    import com.sleepycat.persist.StoreConfig;
    import com.sleepycat.persist.model.Entity;
    import com.sleepycat.persist.model.Persistent;
    import com.sleepycat.persist.model.PrimaryKey;
    public class Test {
        @Persistent
        public static class SimplePrincipal {
            protected String name;
            public SimplePrincipal(String username) {
                this.name = name;
            public SimplePrincipal() {}
        @Entity
        public static class SimpleUser extends SimplePrincipal {
            @PrimaryKey
            private String key;
            private Map properties;
            public SimpleUser() {
                super();
                this.properties = new HashMap();
            public SimpleUser(String username) {
                super(username);
                this.properties = new HashMap();
            public void setKey(String key){
                this.key = key;
            public void addPropertity(String name, String value) {
                this.properties.put(name, value);
            @Override
            public String toString() {
                return "[SimpleUser key: " + key + " name: " + name + ']';
        private Environment env;
        private EntityStore store;
        private PrimaryIndex<String, SimpleUser> primaryIndex;
        private void open()
            throws DatabaseException {
            EnvironmentConfig envConfig = new EnvironmentConfig();
            envConfig.setAllowCreate(true);
            envConfig.setTransactional(true);
            env = new Environment(new File("./data"), envConfig);
            StoreConfig storeConfig = new StoreConfig();
            storeConfig.setAllowCreate(true);
            storeConfig.setTransactional(true);
            store = new EntityStore(env, "test", storeConfig);
            primaryIndex = store.getPrimaryIndex(String.class, SimpleUser.class);
        private void close()
            throws DatabaseException {
            store.close();
            env.close();
        private void execute()
            throws DatabaseException {
            SimpleUser user = new SimpleUser("test");
            user.setKey("testkey");
            primaryIndex.put(user);
            user = primaryIndex.get("testkey");
            System.out.println(user);
        public static void main(String[] args)
            throws DatabaseException {
            Test test = new Test();
            test.open();
            test.execute();
            test.close();
    }Mark

  • Java.util.zip.ZipException: Is a directory- weblogic exception comming

    I am getting following exception while deploying the web application in weblogic Enviornment, on Sun solaris 5.8, please help:
    <Jul 11, 2008 5:39:07 PM EDT> <Error> <J2EE> <BEA-160131> <Error deploying fotrd: with deployment error Could not load fotrd and nested error weblogic.management.DeploymentException: [HTTP:101062][ServletContext(id=175067,name=,context-path=/)] Error reading Web application "/export/enterprise-docs/fo2oli/citioliprodfix/po2trd/deploy/po2trd.ear/fotrd.war".
    java.util.zip.ZipException: Is a directory
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.><init>(ZipFile.java:111)
    at java.util.jar.JarFile.<init>(JarFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:65)
    at weblogic.servlet.internal.WebAppServletContext.getDescriptorLoader(WebAppServletContext.java:1443)
    at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:492)
    at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:621)
    at weblogic.j2ee.WebAppComponent.deploy(WebAppComponent.java:121)
    at weblogic.j2ee.Application.addComponent(Application.java:322)
    at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:162)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:337)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:202)
    at weblogic.management.mbeans.custom.WebServer.addWebDeployment(WebServer.java:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:755)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:734)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:516)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.RemoteMBeanServerImpl.private_invoke(RemoteMBeanServerImpl.java:990)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:948)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:948)
    at weblogic.management.internal.MBeanProxy.invokeForCachingStub(MBeanProxy.java:475)
    at weblogic.management.configuration.WebServerMBean_Stub.addWebDeployment(WebServerMBean_Stub.java:2596)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:289)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(DeploymentTarget.java:597)
    at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeployments(DeploymentTarget.java:575)
    at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(DeploymentTarget.java:241)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:755)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:734)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:516)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.RemoteMBeanServerImpl.private_invoke(RemoteMBeanServerImpl.java:990)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:948)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:948)
    at weblogic.management.internal.MBeanProxy.invokeForCachingStub(MBeanProxy.java:475)
    at weblogic.management.configuration.ServerMBean_Stub.updateDeployments(ServerMBean_Stub.java:7731)
    at weblogic.management.deploy.slave.SlaveDeployer.updateServerDeployments(SlaveDeployer.java:1321)
    at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.java:339)
    at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resume(DeploymentManagerServerLifeCycleImpl.java:229)
    at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:136)
    at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:965)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:360)
    at weblogic.Server.main(Server.java:32)

    Could it be that you are trying to install from an exploded version of your war files? It looks like WebLogic thinks it's a war file but it seems to be a directory... You might try to rename those directories to anything that's not .war and .ear.

  • Webb Exception - java.util.zip.ZipException: error in opening zip file

              I am tring to run my Servlet with myWAR.war. So I started first installing the CookieCounter example that came with weblogic, I did exactly as the document said but I getting the following exception:
              Thu Jan 04 11:26:45 MST 2001:<E> <HTTP> Error reading Web application '/weblogic/myserver/cookieWar.war'
              java.util.zip.ZipException: error in opening zip file
              at java.util.zip.ZipFile.open(Native Method)
              at java.util.zip.ZipFile.<init>(ZipFile.java:69)
              at weblogic.utils.jar.JarFile.<init>(JarFile.java:57)
              at weblogic.utils.jar.JarFile.<init>(JarFile.java:44)
              at weblogic.t3.srvr.HttpServer.loadWARContext(HttpServer.java:582)
              at weblogic.t3.srvr.HttpServer.initServletContexts(HttpServer.java, Compiled Code)
              at weblogic.t3.srvr.HttpServer.start(HttpServer.java:388)
              at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java, Compiled Code)
              at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:827)
              at java.lang.reflect.Method.invoke(Native Method)
              at weblogic.Server.startServerDynamically(Server.java:99)
              at weblogic.Server.main(Server.java:65)
              at weblogic.Server.main(Server.java:55)
              at weblogic.NTServiceHelper.run(NTServiceHelper.java:19)
              at java.lang.Thread.run(Thread.java:479)
              Has anybody encountered the problem before I created the jar using jar cvf cookieWar.war cookie- under the command line
              

    I have seen problems like this in the past. When you create your war file, try using "jar
              cv0f" so that the jar file won't be compressed...
              mark bouchard wrote:
              > I am having this same error... the strange thing is i have two different ear files...
              > one of them works, the other doesn't. there are NO differences between them according
              > to Araxis Merge... both will deploy, and both show servlets as being registered,
              > but i can only call the servlets from one...
              >
              > what is BEA's suggested way of creating an ear file? on NT and on UNIX please....
              >
              > use the java.util.zip methods? or use a utility like jar or winzip? Personally,
              > i've found this deployment to be HIGHLY flakey at best.... my same ear files
              > deploy perfectly with iPlanet's app server.
              >
              > Mark Spotswood <[email protected]> wrote:
              > >I think this is basically the same as a file not found error.
              > >The error message says it can't open the file. Its looking
              > >for the file under: /weblogic/myserver/cookieWar.war
              > >Make sure the file is in that directory/readable, etc.
              > >--
              > >mark
              > >
              > >Paul Garduno wrote:
              > >
              > >> Just to let you know, I am getting the same error message. I haven't
              > >worked on it but hope to at some point. I would like to know if the
              > >Weblogic people have seen this error.
              > >>
              > >> Paul Garduno
              > >>
              > >> bionic99 wrote:
              > >>
              > >> > I am tring to run my Servlet with myWAR.war. So I started first installing
              > >the CookieCounter example that came with weblogic, I did exactly as
              > >the document said but I getting the following exception:
              > >> > Thu Jan 04 11:26:45 MST 2001:<E> <HTTP> Error reading Web application
              > >'/weblogic/myserver/cookieWar.war'
              > >> > java.util.zip.ZipException: error in opening zip file
              > >> > at java.util.zip.ZipFile.open(Native Method)
              > >> > at java.util.zip.ZipFile.<init>(ZipFile.java:69)
              > >> > at weblogic.utils.jar.JarFile.<init>(JarFile.java:57)
              > >> > at weblogic.utils.jar.JarFile.<init>(JarFile.java:44)
              > >> > at weblogic.t3.srvr.HttpServer.loadWARContext(HttpServer.java:582)
              > >> > at weblogic.t3.srvr.HttpServer.initServletContexts(HttpServer.java,
              > >Compiled Code)
              > >> > at weblogic.t3.srvr.HttpServer.start(HttpServer.java:388)
              > >> > at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java, Compiled Code)
              > >> > at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:827)
              > >> > at java.lang.reflect.Method.invoke(Native Method)
              > >> > at weblogic.Server.startServerDynamically(Server.java:99)
              > >> > at weblogic.Server.main(Server.java:65)
              > >> > at weblogic.Server.main(Server.java:55)
              > >> > at weblogic.NTServiceHelper.run(NTServiceHelper.java:19)
              > >> > at java.lang.Thread.run(Thread.java:479)
              > >> >
              > >> > Has anybody encountered the problem before I created the jar using
              > >jar cvf cookieWar.war cookie- under the command line
              > >
              

  • Exception: Scanner - java.util.NoSuchElementException: No line found ???

    Hi there,
    I have the following code:
    import java.util.InputMismatchException;
    import java.util.Scanner;
    public class Input {
         public static String readString() {
              return _readString(null, null);
         public static String readString(String title) {
              return _readString(title, null);
         public static String readString(String title, String error) {
              return _readString(title, error);
         private static String _readString(String title, String error) {
              Scanner input = new Scanner(System.in);
              boolean loop = true;
              String str = null;
              while(loop) {
                   try {
                        if(title != null) {
                             System.out.print(title);
                        str = input.nextLine();
                        loop = false;
                   } catch(InputMismatchException e) {
                        if(error != null) {
                             System.out.println(error);
              input.close();
              return str;
    public class Program {
         public static void main(String[] args) {
              String a;
              a = Input.readString("VALUE: ");
              System.out.println(a);
              a = Input.readString("\nVALUE: ");
              System.out.println(a);
    }And the following output:
    VALOR: Hello World!
    Hello World!
    VALUE: Exception in thread "main" java.util.NoSuchElementException: No line found
         at java.util.Scanner.nextLine(Scanner.java:1516)
         at Input._readString(Input.java:29)
         at Input.readString(Input.java:11)
         at Program.main(Program.java:21)The first value is read without any problems but the second throws that exception. Why is this happening? I "fixed" it by removing the input.close(); line but this makes no sense to me. First because I think that I should close the Scanner after using it and second because every time I call the _readString() method, a new Scanner instance will be created, so it doesn't make sense... At least for me, but that's why I'm posting on this forum section, cause I'm new to Java.
    Can someone explain me why exactly does this happen and if possible, a better solution then to remove the input.close()? It just doesn't make any sense to me create a new Scanner instance every time I call the _readString() method and leave it there without closing it...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    First because I think that I should close the Scanner after using it and
    second because every time I call the _readString() method, a new Scanner instance will be createdUmm, NO.
    Let me see if I understand things in the Static world correctly.
    Notice that you have everything declared as "Static" in your Class. A static is only initialized at programs start and everything in your JVM can then us it (well that stuff that has a reference to it). Since it's static, when you close the Scanner, you are closing the only instance that will ever exist in your object.
    For things to work how you think they should, get rid of the Static declarations (excpet in main, where you have to keep them).

Maybe you are looking for