jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Smuts <asm...@yahoo.com>
Subject Re: NullPointerExceptions with JCS.getInstance
Date Tue, 16 Aug 2005 03:41:46 GMT
If you put a jar in the common directory, then it will
use a classloader that can't see the web app.  

JCS is using the classloader that loaded the jcs
classes.  If the jcs jar is in the common dir, then it
can't find the file in you web app directory.

I'd recommend not using the common/lib directory for
much of anything.  It ties your apps too tightly
together, and well you might as well be in JBoss
classloader hell. . . .  

In any case, all JCS needs to do is try to load the
properties using the current thread's classloader and
everything would be fine for your configuration.

That change will be in the next patch release.  I've
already put in better config error messaging . . .

Cheers,

Aaron

--- James Andersen <lorinho99@gmail.com> wrote:

> Sankar,
>     I'm primarily using tomcat 5.0.19 and
> jre1.5.0_04 but as I
> mentioned in my first email I did try a few other
> combinations... 
> However, I think I may possibly have found my
> problem.  I still
> haven't gone back to JCS yet to try this but I fixed
> my ehcache
> problem by moving my  ehcache.jar from
> <tomcat-home>/common/lib to
> <webapp-root>/WEB-INF/lib.  At that point  ehcache
> (a fork of JCS
> right?) was able to find and use the config file I
> created.  I think
> the root cause has something to do with the way
> tomcat classloaders
> work and frankly I more interested in getting on
> with my webapp than
> delving into that but I'm thinking this has to be
> the reason I had
> some much trouble with my cache.ccf file because I
> had the JCS jar
> <tomcat-home>/common/lib as well...  Hopefully
> someone else can learn
> from my mistake...  Is the jcs jar only supposed to
> go in the
> WEB-INF/lib directory?  Did I miss that in the
> documentation?
> Thanks,
> James
> 
> On 8/15/05, Sankara Subramanian Ramakrishnan
> <sankarasr@aditi.com> wrote:
> > James,
> > 
> > can you let us know your web server and JDK
> versions.
> > 
> > - Sankar
> > 
> > -----Original Message-----
> > From: James Andersen [mailto:lorinho99@gmail.com]
> > Sent: Monday, August 15, 2005 7:09 PM
> > To: JCS Users List
> > Subject: Re: NullPointerExceptions with
> JCS.getInstance
> > 
> > 
> > Sankara,
> >    Well, in frustration I switched over to ehcache
> only to find that
> > my webapp wasn't picking up the ehcache.xml that
> is also supposed to
> > go just under the classes directory.  Ehcache does
> at least have a
> > failsafe configuration but my real problem is that
> for some reason
> > these configuration files I'm putting under
> WEB-INF/classes aren't
> > getting picked up...  I realize this is no longer
> a JCS specific
> > problem but if anyone has a tip I'd be much
> obliged...
> > Thanks,
> > James
> > 
> > On 8/15/05, Sankara Subramanian Ramakrishnan
> <sankarasr@aditi.com> wrote:
> > > James,
> > >
> > > I get a error similar to your error below if i
> remove the cache.ccf from the WEB-INF/Classes/
> within my webapp.
> > >
> > > 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:168)
> > > >>              at
> org.apache.jcs.JCS.ensureCacheManager(JCS.java:105)
> > > >>              at
> org.apache.jcs.JCS.getInstance(JCS.java:64)
> > >
> > >
> > > if i have the file in that particular folder, i
> don't get any error.
> > > If possible, send the webapp folder. Ill try to
> deploy on my machine and give an attempt.
> > >
> > > - Sankar
> > >
> > > -----Original Message-----
> > > From: Lorinho
> [mailto:james.j.andersen@gmail.com]
> > > Sent: Monday, August 15, 2005 3:55 PM
> > > To: JCS Users List
> > > Subject: Re: NullPointerExceptions with
> JCS.getInstance
> > >
> > >
> > > WEB-INF/classes/ within my webapp
> > > -James
> > >
> > > Sankara Subramanian Ramakrishnan wrote:
> > >
> > > >James,
> > > >
> > > >Where have you placed the cache.ccf file on the
> disk ?
> > > >-Sankar
> > > >
> > > >________________________________
> > > >
> > > >From: Lorinho
> [mailto:james.j.andersen@gmail.com]
> > > >Sent: Sat 8/13/2005 4:57 PM
> > > >To: JCS Users List
> > > >Subject: Re: NullPointerExceptions with
> JCS.getInstance
> > > >
> > > >
> > > >
> > > >Sankar,
> > > >    Thanks for the suggestion; I gave it a try
> but I'm still getting the
> > > >same error.  I had previously tried using the
> cache.ccf from "Basic Web
> > > >Example" on the site only changing "bookCache"
> to "pageCache" but that
> > > >didn't work either.  The  NullPointerException
> I'm getting when I first
> > > >access the page is thrown from the load method
> of java.util.Properties
> > > >which seems to indicate that JCS is somehow not
> finding or otherwise
> > > >unable to load my cache.ccf file but I really
> don't know what's going on.
> > > >Thanks! Any other ideas?
> > > >-James
> > > >
> > > >Sankara Subramanian Ramakrishnan wrote:
> > > >
> > > >
> > > >
> > > >>Hi There,
> > > >>
> > > >>You need to add this is your cache.ccf since
> you are trying to load  "pageCache"
> > > >>
> > > >>jcs.pageCache=
> > >
>
>>jcs.pageCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
> > > >>jcs.pageCache.cacheattributes.MaxObjects=1000
> > >
>
>>jcs.pageCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
> > > >>
> > > >>- Sankar
> > > >>
> > > >>
> > > >>      -----Original Message-----
> > > >>      From: James Andersen
> [mailto:lorinho99@gmail.com]
> > > >>      Sent: Sat 8/13/2005 11:24 PM
> > > >>      To: jcs-users@jakarta.apache.org
> > > >>      Cc:
> > > >>      Subject: NullPointerExceptions with
> JCS.getInstance
> > > >>
> > > >>
> > > >>
> > > >>      I've got high hopes for using JCS in my
> webapp, it looks like it will
> > > >>      make a great addition but I've been
> spinning my wheels fruitlessly for
> > > >>      several hours now trying to get it
> working...
> > > >>
> > > >>      I've got jcs-1.2.6.5.jar in tomcat's
> common/lib directory and the
> > > >>      following simplest possible cache.ccf
> file in WEB-INF/classes/ of my
> > > >>      webapp directory
> > > >>      -----------------------------------
> > > >>      # DEFAULT CACHE REGION
> > > >>
> > > >>      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
> > > >>      -------------------------
> > > >>
> > > >>      However, on startup, when execution
> reaches
> 
=== message truncated ===


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Mime
View raw message