You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Pedro Vaz <pd...@yahoo.com.br> on 2010/02/26 13:43:36 UTC

HELP - Nullpointer exception on JCS.getInstance(String).

Good Morning,

I need help to find the error in my application. It's the first time in 6 month. The application is going to production environment in 3 weeks. I really need to know what happens.

The code is:
-------------------------------------
        private JCS jcsCache;
 (...)
        log.debug("TRY: obter cache: " + regiao);
        jcsCache = JCS.getInstance(regiao);
-------------------------------------

the log is:

------------------------------------

26/02/2010 09:19:04,130 DEBUG [cache.Cache]: TRY: obter cache: srh_buscarEmpregadoPorRegistro
(...)
Caused by: java.lang.NullPointerException
	at org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.<init>(IndexedDiskCache.java:215)
	at org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheManager.getCache(IndexedDiskCacheManager.java:130)
	at org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory.createCache(IndexedDiskCacheFactory.java:62)
	at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseAuxiliary(CompositeCacheConfigurator.java:554)
	at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:346)
	at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:283)
	at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:448)
	at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:387)
	at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:374)
	at org.apache.jcs.JCS.getInstance(JCS.java:66)
	at com.copel.cet.rexx.cache.Cache.<init>(CachedMethod.java:135)
---------------------------------------

The cache.cfg is 
---------------------------------------
#    c049174 - 01/06/2010
###################################################################
# DEFAULT CACHE REGION
#    http://jakarta.apache.org/jcs/RegionProperties.html
###################################################################

# sets the default aux value for any non configured caches
jcs.default=DC


################## CONFIGURAÇÃO DA CACHE ##########################
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=500
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
#    UseMemoryShrinker            - joga objetos da memória para o disco de tempo em tempo.
#    MaxMemoryIdleTimeSeconds    - tempo (sec) de vida inativo do objeto para movê-lo para a o disco (360 = 6min)
#    ShrinkerIntervalSeconds        - intervalo de execução do MemoryShrinker (sec) (180 = 3min)
jcs.default.cacheattributes.UseMemoryShrinker=true
jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=360
jcs.default.cacheattributes.ShrinkerIntervalSeconds=180


################ CONFIGURAÇÃO DOS ELEMENTOS ########################
jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
#    isEternal         - Não expira
#    MaxLifeSeconds     - Tempo máximo de vida em segundos (10800 = 3h)
#    IdleTime        - Tempo máximo de vida sem acesso  (3600 = 1h).
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.MaxLifeSeconds=10800
jcs.default.elementattributes.IdleTime=3600
#    IsSpool     - Utiliza cache em disco
#    IsRemote    - Utiliza cache remota (necessita porta para acesso a rede)
#    IsLateral    - Utiliza cache Lateral (sinctronização entre várias VMs numa máquina)
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=false
jcs.default.elementattributes.IsLateral=false


##############################################################
################## AUXILIARY CACHES AVAILABLE ################
# Primary Disk Cache -- faster than the rest because of memory key storage
jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=${RESOURCES_DIR}/cet
#    MaxPurgatorySize    - Tamanho máximo da fila de espera para gravação no disco
#    MaxKeySize            - Número máximo de chaves indexadas
#    OptimizeAtRemoveCount    - Número de máximo remoções para forçar defragmentação do arquivo
#    OptimizeOnShutdown    - Força defragmentação do arquivo ao sair
#    ClearDiskOnStartup    - Limpa o disco ao iniciar a aplicação (deploy)
#    MaxRecycleBinSize    - Número máximo de posições vazias indexadas para armazenar objetos    
jcs.auxiliary.DC.attributes.MaxPurgatorySize=2000
jcs.auxiliary.DC.attributes.MaxKeySize=2000
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=10000
jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
jcs.auxiliary.DC.attributes.ClearDiskOnStartup=true
jcs.auxiliary.DC.attributes.MaxRecycleBinSize=3000

---------------------------------------

Thanks for Help

Pedro.



      ____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com