• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

cachefullexception while Entity bean Create

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All,
I get cachefullexception while I try to do EJB create. I get this even after setting the <max-beans-in-cache>200</max-beans-in-cache> for entity beans.
Can anyone give suggestions.
Detailed explanation of the problem.
I have to put message on to a JMS queue. But before sending the message to the queue I have to persist the data so I create that many instances of objects value objects and then call the ejbCreate simultaneously to insert into database in a loop which is when I get cachefullexception when I try to send 5000 messages.
So,
I want to do it in batches in order to insert into database in batches. So, that I can avoid the cacheException.
I am not able to figure out a way to do it.

I need suggestions to avoid cachefullexception and also to do inserts in batches. If anyone has faced similar problems please help me.

Thanks in advance.
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kalpana,

If the underlying database driver that you are using supports batch updates, weblogic will attempt a batch update anyways. (it should )
You can enable batch updates by making an entry in weblogic-ejb-jar.xml i think. I dont remeber the exact xml file but yuo can specify that. I think you also need to specify the type of database (oracle for eg).

Dont try to configure the cache size / bean. Its very difficult to predict the maximum number of entity beans that will be loaded in a given transaction since you wouldnt know what the user is trying to do. So if the number of beans that are getting loaded into the memory exceeds the max-beans-in-cache setting for a given transaction, weblogic will throw a cachefull exception.

Configure an application level cache instead and specify a huge value for max-beans-in-cache and test your application under max load
See if you are running to cachefullexception and adjust the value.
Ofcourse you must have enough memory when you started weblogic in the first place ..large enough not to throw a OutOfMemoryerror.

check this
weblogic-application.xml

good luck
 
kalpana Kumar
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Karthik,
Thank you very much. I too did the same thing
Configured an application level cache to be 20000 for max-beans-in-cache, in application.xml and tested my application under max load. Yet I get the CachefullException error.
And also deploying the application has become a pain. Everytime I have dismount the server itself since I get OutOfMemoryerror while deployment.
Can you tell me any other option.
Please I need help.

Thanks
Kalpana.K
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kalpana,

If you canot afford the memory needed by the cache to hold onto the beans then the only option you have is to go for direct inserts into database using JDBC. Nothing wrong actually, I guess there are very few pure EJB systems. Its always a mix and match to an extent. You have to identify some of the intensive workflows upfront and employ JDBC.
I dont know what concurrency setting you have specified. If its database concurrency strategy which is the default, you should be ok. I mean the new data inserted through jdbc will be visible to your ejb finders if any.
This is a workaround and it hopefully a viable one for you.
 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic