5 Replies Latest reply on Jan 10, 2005 11:46 AM by thunder

    JBoss 4.0.1 : config and properties files not found anymore

      We are planning to upgrade our current JBoss 3.2.3 servers to JBoss 4.0.1 but if we deploy JBoss 3.2.3 ear files, the applications cannot find their properties and config files any more that are just sitting on the root of the application.

      Example structure :

      -com
      ---abc
      ------def.class
      ...
      -a.properties
      -cache.ccf
      -config.xml
      
      


      What are we doing wrong and how can we resolve this? The ear file works like a charm in JBoss 3.2.3 version but not in the version 4.0.1

      Where do we put the config files if the root of the app is not reached any more ? Are there any best practices in JBoss?

      TIA

        • 1. Re: JBoss 4.0.1 : config and properties files not found anym
          frito

          The ear should not contain plain resources. Just put them into a jar.

          • 2. Re: JBoss 4.0.1 : config and properties files not found anym

            Hi Frito,

            First thanks for your time to reply.

            Perhaps my entry wasn't clear on it, but we construct our ear files like they are supposed (?) to be.

            myear.ear
            - myjar.jar (ejb)
            - mywar.war (webapp)
            - application.xml
            
            mywar.war
            - ourwebsources
            - WEB-INF
            ---- lib
            ---- classes
            -------- abc (package)
            ----------- def.class
            ----------- ghi.class
            -------- afile.properties
            -------- config.xml
            -------- cache.ccf
            


            The problem is that the ghi.class f.e. needs to read the file cache.ccf to setup the cache structure ... but it cannot find it anymore in JBoss 4 like it does automatically in JBoss 3.2.3

            Any ideas ? TIA

            • 3. Re: JBoss 4.0.1 : config and properties files not found anym
              anil.saldhana

              Try putting your properties/config file at the same level as the class files are (I mean try placing the xml/props file inside abc package).

              Also copy paste the code that reads the config files. Then we can understand as to what you are doing and what may be wrong.

              • 4. Re: JBoss 4.0.1 : config and properties files not found anym
                anil.saldhana

                When I say copy/paste the code, please don't paste the whole Java source code. Just the snippet where you deal with the config/properties files.

                • 5. Re: JBoss 4.0.1 : config and properties files not found anym

                  Copied cache.ccf to dir of caller SecundaryCache.class : no effect still nullpointer exception.

                  So, here goes :

                  Stacktrace :

                  17:25:23,359 ERROR [SecundaryCache] JCS Cache could not be initialized
                  java.lang.NullPointerException
                   at java.io.Reader.<init>(Reader.java:61)
                   at java.io.InputStreamReader.<init>(InputStreamReader.java:80)
                   at java.util.Properties.load(Properties.java:266)
                   at org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:149)
                   at org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:131)
                   at org.apache.jcs.engine.control.CompositeCacheManager.getInstance(CompositeCacheManager.java:76)
                   at org.apache.jcs.JCS.ensureCacheManager(JCS.java:135)
                   at org.apache.jcs.JCS.getInstance(JCS.java:101)
                   at com.cc.be.util.cache.ads.SecundaryCache.init(SecundaryCache.java:57)
                   at com.cc.be.util.cache.ads.SecundaryCache.<init>(SecundaryCache.java:167)
                   at com.cc.be.util.cache.ads.SecundaryCache.getInstance(SecundaryCache.java:172)
                   at com.cc.be.business.builder.UserAdBuilder.<init>(UserAdBuilder.java:88)
                   at com.cc.be.presentation.javabeans.UserAdBean.<init>(UserAdBean.java:54)
                   at org.apache.jsp.root.ned.cc_002dhomepage_002dned_jsp._jspService(cc_002dhomepage_002dned_jsp.java:99)
                   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
                   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
                   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
                   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
                   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                   at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
                   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                   at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:44)
                   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
                   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:169)
                   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
                   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
                   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
                   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
                   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
                   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
                   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
                   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
                   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
                   at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
                   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
                   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
                   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
                   at java.lang.Thread.run(Thread.java:534)
                  17:25:23,406 ERROR [SecundaryCache] JCS Cache could not be initialized for region: EyeCatchers
                  

                  cache.ccf
                  According to the the http://jakarta.apache.org/turbine/jcs/LocalCacheConfig.html the file should be placed at the root of the classpath, since it is discovered automatically, and in JBoss 3.2.3 we experience no problems finding it automatically.

                  # DEFAULT CACHE REGION
                  # sets the default aux value for any non configured caches
                  jcs.default=
                  jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
                  jcs.default.cacheattributes.MaxObjects=1000
                  jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
                  jcs.default.elementattributes.IsEternal=false
                  jcs.default.elementattributes.MaxLifeSeconds=3600
                  jcs.default.elementattributes.IdleTime=1800
                  jcs.default.elementattributes.IsSpool=true
                  jcs.default.elementattributes.IsRemote=true
                  jcs.default.elementattributes.IsLateral=true
                  #To use memory shrinking ...
                  jcs.default.cacheattributes.cacheattributes.UseMemoryShrinker=true
                  jcs.default.cacheattributes.cacheattributes.MaxMemoryIdleTimeSeconds=3600
                  jcs.default.cacheattributes.cacheattributes.ShrinkerIntervalSeconds=60
                  # SYSTEM CACHE
                  # should be defined for the storage of group attribute list
                  jcs.system.groupIdCache=DC
                  jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
                  jcs.system.groupIdCache.cacheattributes.MaxObjects=10000
                  jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
                  # CACHE REGIONS AVAILABLE
                  # Regions preconfigured for caching
                  jcs.region.EyeCatchers=DC
                  jcs.region.EyeCatchers.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
                  jcs.region.EyeCatchers.cacheattributes.MaxObjects=1000
                  jcs.region.EyeCatchers.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
                  jcs.region.EyeCatchers.elementattributes.IsEternal=false
                  #4Hr maxLife...
                  jcs.region.EyeCatchers.elementattributes.MaxLifeSeconds=14400
                  jcs.region.EyeCatchers.elementattributes.IdleTime=1800
                  jcs.region.EyeCatchers.elementattributes.IsSpool=true
                  jcs.region.EyeCatchers.elementattributes.IsRemote=true
                  jcs.region.EyeCatchers.elementattributes.IsLateral=true
                  # 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=user.dir
                  

                  SecundaryCache.java
                  8<---
                  
                  //## Singleton Pattern
                   private static SecundaryCache instance;
                  
                   private SecundaryCache() {
                   setRegion("EyeCatchers");
                   init();
                   }
                  
                   public static synchronized SecundaryCache getInstance() {
                   if (instance == null) {
                   instance = new SecundaryCache();
                   }
                   return instance;
                   }
                  
                  //== The Init Method
                   private void init() {
                   try {
                   cache = JCS.getInstance(getRegion()); //EyeCatchers
                   } catch (Exception e) {
                   logger.error("JCS Cache could not be initialized", e);
                   }
                   if (cache == null) {
                   logger.error("JCS Cache could not be initialized for region: " + getRegion());
                   }
                   }
                  
                  ---->8