RE: FW: [Hibernate-devel] Getting Collections to pull data from t he cache
>> Hibernate got everything you need to run JCS, are you sure you >> put the cache.ccf in the classpath, it's more likely the issue here. Yup. The cache.ccf from the Hibernate build is in my class path. This is the full exception I was gettting: WARNING: Could not instantiate cache - probably the JCS jar is missing: NoClassDefFoundError: org/apache/commons/lang/exception/NestableException So I added the commons-lang package. I don't get that exception, but I still don't see the cache working. This is what Hibernate is logging: Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: setting defaults to DC Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: setting defaultCompositeCacheAttributes to [ useLateral = true, useRemote = true, useDisk = true, maxObjs = 1000 ] Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: setting defaultElementAttributes to [ IS_LATERAL = false, IS_SPOOL = true, IS_REMOTE = false, IS_ETERNAL = false, MaxLifeSeconds = 120, IdleTime = 1800, CreateTime = 1028900336921, LastAccessTime = 1028900336921, getTimeToLiveSeconds() = 119984, createTime = 1028900336921 ] Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not find value for key jcs.auxiliary.DC Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger error SEVERE: Could not instantiate auxFactory named "DC". Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not find value for key jcs.system.groupIdCache.elementattributes Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not instantiate eAttr named 'jcs.system.groupIdCache.elementattributes', using defaults. Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: initialized LRUMemoryCache for groupIdCache Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: Constructed cache with name: groupIdCache Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not find value for key jcs.auxiliary.DC Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger error SEVERE: Could not instantiate auxFactory named "DC". Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not find value for key jcs.region.com.idexx.cstone.messagecenter.domain.AddresseeGroup.elementattri butes Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not instantiate eAttr named 'jcs.region.com.idexx.cstone.messagecenter.domain.AddresseeGroup.elementattr ibutes', using defaults. Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: initialized LRUMemoryCache for com.idexx.cstone.messagecenter.domain.AddresseeGroup Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: Constructed cache with name: com.idexx.cstone.messagecenter.domain.AddresseeGroup Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not find value for key jcs.auxiliary.DC Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger error SEVERE: Could not instantiate auxFactory named "DC". Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not find value for key jcs.region.AddresseeGroup.entries.elementattributes Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not instantiate eAttr named 'jcs.region.AddresseeGroup.entries.elementattributes', using defaults. Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: initialized LRUMemoryCache for AddresseeGroup.entries Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: Constructed cache with name: AddresseeGroup.entries Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: Parsing XML: unknown system id Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not find value for key jcs.auxiliary.DC Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger error SEVERE: Could not instantiate auxFactory named "DC". Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not find value for key jcs.region.com.idexx.cstone.messagecenter.domain.AddresseeGroupEntry.element attributes Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn WARNING: Could not instantiate eAttr named 'jcs.region.com.idexx.cstone.messagecenter.domain.AddresseeGroupEntry.elemen tattributes', using defaults. Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: initialized LRUMemoryCache for com.idexx.cstone.messagecenter.domain.AddresseeGroupEntry Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info INFO: Constructed cache with name: com.idexx.cstone.messagecenter.domain.AddresseeGroupEntry Aug 9, 2002 8:38:57 AM or
RE: [Hibernate-devel] RE: JMX/JBoss
Thanks for the link. I followed some of the further reading links and ended up at http://www.javageeks.com/Papers/ClassForName/ClassForName.pdf. On page 14, I found the following: "Using Thread.getContextClassLoader relies on the Thread's context ClassLoader to be appropriately set. What if the Thread's current context ClassLoader isn't the one expected, but is instead set by an arbitrary third-party package (like RMI or JNDI)? In fact, there's not much you can do to prevent this" I wonder if this is the problem since the SessionFactoryStub is sitting in JNDI. If that's the case, I bet the way to fix it is to pass the class loader of the EJB to the SessionFactoryStub before it opens a session. Sounds kind of ugly... It seems like we are trying to create a system wide resource that is tied to single EJB jar file. If some other EJB tries to use it, it won't work. Wouldn't it be better to just let the EJB handle this internally? If we still want a JNDI factory built in an MBean, I would suggest building it in the MBean at startup before we bind it to JNDI and require that all the classes and mappings be loaded into the server's context loader on startup. Thoughts? Regards, John -Original Message- From: Christian Meunier [mailto:[EMAIL PROTECTED] Sent: Thursday, August 08, 2002 10:47 AM To: Urberg, John; Gavin_King/[EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [Hibernate-devel] RE: JMX/JBoss In case it could help http://kb.atlassian.com/content/atlassian/howto/classloaders.jsp Chris - Original Message - From: "Urberg, John" <[EMAIL PROTECTED]> To: ; <[EMAIL PROTECTED]> Sent: Thursday, August 08, 2002 4:04 PM Subject: RE: [Hibernate-devel] RE: JMX/JBoss > > Damn! I really don't understand why the following line wouldn't > > work: > > > > ds.storeResource( > >resources[i], Thread.currentThread().getContextClassLoader() > > ); > > > >( in SessionFactoryStub.getImpl() ). Have I got it totally wrong, > > or isn't Thread.currentThread.getContextClassLoader() meant to get > > the classloader used by the calling EJB? Perhaps I'm > > hallucinating... > > I often feel that way when confronted with class loaders. I don't know much > about them yet, so I can't be much help there. > > >> The only way I can see making this MBean useful is if users put all >> > their mapped classes and mappings in the server's classpath. Then > >> they can put them all in one mapping or split them up and it won't > >> matter because the MBean and SessionFactoryStub will have access > >> to them. > > I should always test it out before I make pronounciations! I tried my > little example with the jar files containing the mapping files in Jboss's > lib/ext directory (which get loaded when JBoss starts up). I got the same > exception as I did when it was in the EJB jar file. The SesstionFactory > stub could not find it. When I moved the creation of the SessionFactory > completely into a class in my jar file, everything worked a.o.k. (This last > version is what I'm doing in my application) > > My original attempt created the session factory in the MBean at startup. I > had the domain classes in jboss's lib/ext directory and the MBean seemed to > find them ok. Unless someone has some classloader answers for you, this > will probably be the only way to do it. > > Regards, > John > > > --- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > ___ > Hibernate-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: [Hibernate-devel] Configuration file
>I'm new to Hibernate and have a simple question: Must Hibernate's >config file (not the mapping file, but the config/properties file) be in >the classpath? If not, how do I use it to configure Hibernate? >Hibernate.configure does not accept a URI and I don't see any other >methods that would do the trick. yes. There are two possible types of config files: (1) hibernate.properties (2) hibernate.cfg.xml Both of them are loaded as a resource from the classpath. hibernate.properties is automatically picked up and you don't need to do anything special to use it. ie. you dont need to call Hibernate.configure (). hibernate.cfg.xml is parsed and SessionFactory(s) are registered in JNDI upon the first invocation of Hibernate.configure(). If you are doing something more complicated, there are programmatic ways to do things. For example, (1) you can pass an instance of java.util.Properties do Datastore.buildSessionFactory() as an alternative to hibernate.properties. (2)You can instantiate your own instance of cirrus.hibernate.cfg.Configuration as an alternative to hibernate.cfg.xml / Hibernate.configure(). Hope that helps :) Gavin --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: FW: [Hibernate-devel] Getting Collections to pull data from the cache
>It comes from your auxiliary DC (Disk Cache ) cache. >My guess is that the path you gave to store objects on the disk is not >correct or it's a file permission issue. oh yeah. stupid. I didn't notice the SEVERE. yeah, ummm ... what he said... just try disabling the auxiliary cache for a start >Here i dont understand ( beside the fact that there is a technical issue i >dont figure out ) , why i would want to get 2 JCS cache region for the >exactly same class of objects ? well, for a start we have toplevel collections which don't actually belong to any class a particular *instance* might belong to an instance of a particular class but in general the toplevel collection role doesn't belong to a class. So if we want to keep all instances of a collection role in the same region (a good thing), the role needs its own region. I mean, we can write some special code for special cases (nested collections), but I'm not sure its worth the effort. Its not like the application should be looking at or caring about the layout of the JCS regions. --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: FW: [Hibernate-devel] Getting Collections to pull data from the cache
It comes from your auxiliary DC (Disk Cache ) cache. My guess is that the path you gave to store objects on the disk is not correct or it's a file permission issue. Try to comment the DC cache to test this. Chris - Original Message - From: "Urberg, John" <[EMAIL PROTECTED]> To: "'Christian Meunier'" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, August 09, 2002 3:40 PM Subject: RE: FW: [Hibernate-devel] Getting Collections to pull data from the cache > >> Hibernate got everything you need to run JCS, are you sure you > >> put the cache.ccf in the classpath, it's more likely the issue here. > > Yup. The cache.ccf from the Hibernate build is in my class path. This is > the full exception I was gettting: > > WARNING: Could not instantiate cache - probably the JCS jar is missing: > NoClassDefFoundError: org/apache/commons/lang/exception/NestableException > > So I added the commons-lang package. I don't get that exception, but I > still don't see the cache working. This is what Hibernate is logging: > > Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger info > INFO: setting defaults to DC > Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger info > INFO: setting defaultCompositeCacheAttributes to [ useLateral = true, > useRemote = true, useDisk = true, maxObjs = 1000 ] > Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger info > INFO: setting defaultElementAttributes to [ IS_LATERAL = false, IS_SPOOL = > true, IS_REMOTE = false, IS_ETERNAL = false, MaxLifeSeconds = 120, IdleTime > = 1800, CreateTime = 1028900336921, LastAccessTime = 1028900336921, > getTimeToLiveSeconds() = 119984, createTime = 1028900336921 ] > Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not find value for key jcs.auxiliary.DC > Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger error > SEVERE: Could not instantiate auxFactory named "DC". > Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not find value for key > jcs.system.groupIdCache.elementattributes > Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not instantiate eAttr named > 'jcs.system.groupIdCache.elementattributes', using defaults. > Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger info > INFO: initialized LRUMemoryCache for groupIdCache > Aug 9, 2002 8:38:56 AM org.apache.commons.logging.impl.Jdk14Logger info > INFO: Constructed cache with name: groupIdCache > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not find value for key jcs.auxiliary.DC > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger error > SEVERE: Could not instantiate auxFactory named "DC". > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not find value for key > jcs.region.com.idexx.cstone.messagecenter.domain.AddresseeGroup.elementattri > butes > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not instantiate eAttr named > 'jcs.region.com.idexx.cstone.messagecenter.domain.AddresseeGroup.elementattr > ibutes', using defaults. > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info > INFO: initialized LRUMemoryCache for > com.idexx.cstone.messagecenter.domain.AddresseeGroup > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info > INFO: Constructed cache with name: > com.idexx.cstone.messagecenter.domain.AddresseeGroup > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not find value for key jcs.auxiliary.DC > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger error > SEVERE: Could not instantiate auxFactory named "DC". > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not find value for key > jcs.region.AddresseeGroup.entries.elementattributes > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not instantiate eAttr named > 'jcs.region.AddresseeGroup.entries.elementattributes', using defaults. > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info > INFO: initialized LRUMemoryCache for AddresseeGroup.entries > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info > INFO: Constructed cache with name: AddresseeGroup.entries > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger info > INFO: Parsing XML: unknown system id > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not find value for key jcs.auxiliary.DC > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger error > SEVERE: Could not instantiate auxFactory named "DC". > Aug 9, 2002 8:38:57 AM org.apache.commons.logging.impl.Jdk14Logger warn > WARNING: Could not find value for key > jcs.region.com.idexx.cstone.messagecen
Re: FW: [Hibernate-devel] Getting Collections to pull data from the cache
- Original Message - From: To: "Christian Meunier" <[EMAIL PROTECTED]> Cc: "Urberg, John" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, August 09, 2002 3:48 PM Subject: Re: FW: [Hibernate-devel] Getting Collections to pull data from the cache > > >you can of course use usage='read-only' isnt it ? > > yes, if appropriate. Good hehe i am not a big fan of read-write cache in clustered env ;) > > >I am wondering something here: > > > >If we got this simple one to many: > > > >i have declarated the class bar and the class foo to use jcs-cache, > shoudnt > >the collection of bar in the class foo cached automatically ? > > No. That is not a big issue, it's something that could be enhanced later i guess > > >If i have to specify that the collection need to be cached, will it use > the > >same JCS region as the com.illflow.Bar ? > > No. Here i dont understand ( beside the fact that there is a technical issue i dont figure out ) , why i would want to get 2 JCS cache region for the exactly same class of objects ? Peace Christian Meunier --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: FW: [Hibernate-devel] Getting Collections to pull data from the cache
> >Here i dont understand ( beside the fact that there is a technical issue i > >dont figure out ) , why i would want to get 2 JCS cache region for the > >exactly same class of objects ? > > well, for a start we have toplevel collections which don't actually belong > to any class a particular *instance* might belong to an instance of a > particular class but in general the toplevel collection role doesn't belong > to a class. So if we want to keep all instances of a collection role in the > same region (a good thing), the role needs its own region. I see, however ideally i believe collections that represent one-to-many associations should not have their own region. Again it's some optimization and it's not urgent at all Thanks for your comments gavin Regards Christian Meunier --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
RE: FW: [Hibernate-devel] Getting Collections to pull data from the cache
>And I would expect 3 SQL statements with all the many-to-ones and >collections should get resolved from the cache. To enable caching, you need to add to all , , , , , elements that you want to cache. :) >My first shot at this returned: > >cirrus.hibernate.HibernateException: You tried to persist an object with a >reference to a transient instance - save the transient instance first This usually means you have an object sitting in the session with a reference to a transient object, at a point when the session was flushed. (ie. you saved a parent but not its child or you loaded an object and then assigned a reference to a child you hadn't saved yet.) If this exception occurred in any other circumstance, it would be a bug and I would *need* to know about it. But I doubt that --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: FW: [Hibernate-devel] Getting Collections to pull data from the cache
>you can of course use usage='read-only' isnt it ? yes, if appropriate. >I am wondering something here: > >If we got this simple one to many: > >i have declarated the class bar and the class foo to use jcs-cache, shoudnt >the collection of bar in the class foo cached automatically ? No. >If i have to specify that the collection need to be cached, will it use the >same JCS region as the com.illflow.Bar ? No. we can discuss this; to me its an implementation detail + the current behaviour was the simplest solution. --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
RE: FW: [Hibernate-devel] Getting Collections to pull data from t he cache
>>And I would expect 3 SQL statements with all the many-to-ones and >>collections should get resolved from the cache. > >To enable caching, you need to add > > > >to all , , , , , elements >that you want to cache. Ahh, I thought that was optional. That would explain it. So I tried it out and got the following warning: WARNING: Could not instantiate cache - probably the JCS jar is missing:... Then I looked at the JCS web site to see what the dependencies are and found the following: commons-configuration 1.0-dev commons-configuration-1.0-dev.jar commons-logging 1.0 commons-logging-1.0.jar commons-lang 1.0-dev commons-lang-1.0-dev.jar concurrent 1.0 concurrent-1.0.jar hsqldb 1.7.0 hsqldb-1.7.0.jar log4j 1.1.3 log4j-1.1.3.jar servletapi 2.2 servletapi-2.2.jar javagroups 2.0 javagroups-2.0.jar jisp 1.0.2 jisp-1.0.2.jar tomcat-util 3.2.1 tomcat-util-3.2.1.jar velocity 1.3-dev velocity-1.3-dev.jar xmlrpc 1.1 xmlrpc-1.1.jar stratum 1.0-b2-dev stratum-1.0-b2-dev.jar Anyone know where I can find all these in one spot? (I can't find commons-configuration anywhere) Maybe it's time to build a third party jar file so folks (like me for example) don't have to track all this stuff down seperately. >>My first shot at this returned: >> >>cirrus.hibernate.HibernateException: You tried to persist an object with a >>reference to a transient instance - save the transient instance first I figured this one out. I was getting a little too tricky. My set function put an adapter around a class to make it fit another interface and then returned the same wrapper; which also implemented the interface of the original class; in the getter. I changed the getter to return the original instead of the wrapped class and all is well. I take it this functionality is based on object identity instead of Object.equals()? Regards, John --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
