-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Author Message
 Post subject: Can i use jcs in container,such as jboss ?
PostPosted: Thu Sep 18, 2003 8:43 pm 
Regular
Regular

Joined: Wed Sep 03, 2003 8:04 am
Posts: 55
After adding jcs-cache line as below:
<class name="com.omnet.bean.Device" table="device">
<jcs-cache usage="read-write"/>
<id name="devId">
<column name="dev_id" sql-type="int" not-null="true"/>
<generator class="native"/>
</id>
...
</class>

then error occurs as beow:

08:36:54,490 INFO [Binder] Mapping class: com.omnet.bean.Device -> device
08:36:54,490 INFO [Configuration] creating JCS cache region: com.omnet.bean.Device, usage: read-write
08:36:54,508 ERROR [Configuration] Could not configure datastore from input stream
java.lang.NullPointerException
at org.apache.jcs.config.OptionConverter.findAndSubst(OptionConverter.java:241)
at org.apache.jcs.config.OptionConverter.instantiateByKey(OptionConverter.java:132)
at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseElement
Attributes(CompositeCacheConfigurator.java:316)
at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(
CompositeCacheConfigurator.java:207)
at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(
CompositeCacheConfigurator.java:189)
at org.apache.jcs.engine.control.CompositeCacheManager.getCache(Composit
eCacheManager.java:302)
at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:261)
at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:254)
at org.apache.jcs.JCS.getInstance(JCS.java:103)
at net.sf.hibernate.cache.JCSCache.setRegion(JCSCache.java:22)
at net.sf.hibernate.cfg.Configuration.createJCSCache(Configuration.java:906)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:282)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1094)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
at net.sf.hibernate.jmx.HibernateService.buildSessionFactory(HibernateService.java:160)
at net.sf.hibernate.jmx.HibernateService.start(HibernateService.java:131)
.......

if remove <jcs-cache usage="read-write"/> all works fine !

the cache.ccf is as below:

# DEFAULT CACHE REGION (memory cache)
jcs.default=DC
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=2000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.MaxLifeSeconds=240
jcs.default.elementattributes.IdleTime=1800
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=false
jcs.default.elementattributes.IsLateral=false

# System CACHE REGION
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

#Auxiliary CACHE (disk cache)
#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=cache


Top
 Profile  
 
 Post subject: why no answer.........
PostPosted: Fri Sep 19, 2003 9:10 pm 
Regular
Regular

Joined: Wed Sep 03, 2003 8:04 am
Posts: 55
The post has been viewed for about 11 times but there is no answer ?!

donot i describe it clearly ?



regards!


Top
 Profile  
 
 Post subject: Re: why no answer.........
PostPosted: Sat Sep 20, 2003 2:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I don't have the sourcecode of JCS in front of me - but I would suggest you go to: org.apache.jcs.config.OptionConverter.findAndSubst(OptionConverter.java:241) abd see what it says. (and if that does not help - then step up through the stacktrace to see what is actuaylly happening)

My guess is JCS is looking for some required configuraiton option/file that is not available which result in a NP-exception.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: thanks...
PostPosted: Sat Sep 20, 2003 2:24 am 
Regular
Regular

Joined: Wed Sep 03, 2003 8:04 am
Posts: 55
Maybe cache.ccf is at wrong place. I have put it together with *hbm.xml file.

i will try your suggestion later !



regards!


Top
 Profile  
 
 Post subject: still doesnot work :(
PostPosted: Mon Sep 29, 2003 10:20 pm 
Regular
Regular

Joined: Wed Sep 03, 2003 8:04 am
Posts: 55
I have tried many ways but same error still occurs :(

$ jar -tvf ../build/omnet-hibernate.sar
1639 Mon Sep 29 11:36:06 2003 META-INF/jboss-service.xml
3146 Tue Sep 16 08:53:14 2003 META-INF/User.hbm.xml
4274 Tue Sep 30 10:08:34 2003 META-INF/Device.hbm.xml
1025 Tue Sep 30 10:08:52 2003 com/omnet/bean/Icon.class
1791 Tue Sep 30 10:08:52 2003 com/omnet/bean/Location.class
466 Tue Sep 30 10:08:52 2003 com/omnet/bean/DevParam.class
....
1179 Wed Sep 17 11:33:38 2003 cache.ccf

<class name="com.omnet.bean.Icon" table="icon">
<jcs-cache usage="read-only"/> <id name="iconId" type="integer">
<column name="icon_id" sql-type="int" not-null="true"/>
<generator class="native"/>
</id>
<property name="iconName" type="string">
<column name="icon_name" sql-type="varchar(30)" not-null="true"/>
</property>
<property name="image" type="blob">
<column name="image" sql-type="blob" not-null="false"/>
</property>
</class>


Does anyone use jcs in jboss successfully ?


Top
 Profile  
 
 Post subject: I just got a help....
PostPosted: Mon Sep 29, 2003 11:18 pm 
Regular
Regular

Joined: Wed Sep 03, 2003 8:04 am
Posts: 55
After put cache.ccf into D:\jboss-3.2.1_tomcat-4.1.24\server\default\lib\ext, i can successfully deploy the omnet-hibernate.sar which will not contain cache.ccf.
...
<class name="com.omnet.bean.Icon" table="icon">
<jcs-cache usage="read-only"/> <id name="iconId" type="integer">
<column name="icon_id" sql-type="int" not-null="true"/
<generator class="native"/>
</id>
<property name="iconName" type="string">
<column name="icon_name" sql-type="varchar(30)" not-null="true"/>
</property>
<property name="image" type="blob">
<column name="image" sql-type="blob" not-null="false"/>
</property>
</class>
....

however when i can getIcon() method as below ,the exception is raised :

StringWriter result = new StringWriter();
Session sess = null;
try {
Marshaller marshaller = new Marshaller(result);

sess = sf.openSession();

com.omnet.bean.Icon icon = null;

Iterator iter = sess.find("from dc in class com.omnet.bean.Icon").iterator(); // error here

while ( iter.hasNext() ) {
icon = (com.omnet.bean.Icon)iter.next();
marshaller.marshal( icon );
}
}
catch(Exception e) {
throw new OMException(e);
}


exception

com.omnet.util.OMException: java.lang.ClassCastException
at com.omnet.ejb.IconBean.getIcon(IconBean.java:65)
.....
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
at $Proxy68.getIcon(Unknown Source)
at com.omnet.web.IconServlet.doGet(IconServlet.java:101)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
.....
Caused by: java.lang.ClassCastException
at net.sf.hibernate.type.AbstractType.disassemble(AbstractType.java:41)
at net.sf.hibernate.impl.CacheEntry.disassemble(CacheEntry.java:35)
at net.sf.hibernate.impl.CacheEntry.(CacheEntry.java:26)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1966)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
at net.sf.hibernate.loader.Loader.find(Loader.java:620)
at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:928)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1343)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1322)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1314)
at com.omnet.ejb.IconBean.getIcon(IconBean.java:58)
... 66 more

why isnot it happy to run jcs in jboss ?!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 30, 2003 5:24 pm 
Beginner
Beginner

Joined: Tue Sep 09, 2003 5:28 pm
Posts: 33
Location: Cincinnati, OH
I am not sure if this will help you out.

Try to use nonstrict-read-write other than read-write, also check to see if cache.ccf is in the same directory as your hibernate.properties or hibernate.cfg.xml file.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 30, 2003 5:27 pm 
Beginner
Beginner

Joined: Tue Sep 09, 2003 5:28 pm
Posts: 33
Location: Cincinnati, OH
Okay, I did not see you are using read-only, that shouldn't have any problem. I did not try JCS on JBOSS, but it worked ok on Websphere.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 30, 2003 5:33 pm 
Beginner
Beginner

Joined: Tue Sep 09, 2003 5:28 pm
Posts: 33
Location: Cincinnati, OH
Okay, I did not see you are using read-only, that shouldn't have any problem. I did not try JCS on JBOSS, but it worked ok on Websphere.

try this:
Query q = session.createQuery("from dc in class com.omnet.bean.Icon");

Iterator iter = q.iterate();
while ( iter.hasNext() ) {
icon = (com.omnet.bean.Icon)iter.next();
marshaller.marshal( icon );
}


Top
 Profile  
 
 Post subject: sorry,i have taken a holiday...
PostPosted: Sun Oct 05, 2003 8:25 pm 
Regular
Regular

Joined: Wed Sep 03, 2003 8:04 am
Posts: 55
sorry,i have taken holiday !
After do as you said,it still has error ! can you tell me where you put cache.ccf in your jboss environment ?

BTW,
i use jmx to config hibernate .

thanks again !


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.