[opencms-dev] cmsObject.getFilesInFolder() return from cache.

Jonathan Woods jonathan.woods at scintillance.com
Fri Feb 20 11:38:39 CET 2009

You say "from my other application" - what runtime environment does that
have?  If it's not running in the same web application as the code you've
written below, then yes - it could be a caching issue, because OpenCms might
choose to go to the database for some operations but use in-memory caches
for others.  It isn't enough just to have two CmsObjects referring to the
same OpenCms installation - to be sure of avoiding caching issues, you have
to have obtained the CmsObjects in the same runtime context.


From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Govind R
Sent: 20 February 2009 07:47
To: opencms-dev at opencms.org
Subject: [opencms-dev] cmsObject.getFilesInFolder() return from cache.

Hello All.

I have a strange problem when i am using cmsObject.getFilesInFolder().

I have OpenCms Version 6.2.3 deployed in Jboss4.2.0GA

My Test Case:-

I have my MyBeanLoader as i using spring and opencms.

MyOperations myOperations = null;
public void testOpencms()
        myOperations = (MyOperations)
            try {
              // Gets the  list of files from resource.

                Vector<CmsFile> documentsize = myOperations
                System.out.println("Document::"+documentsize .size());

                // Checks for the existence of resource.

                boolean checkExistsDocument = myOperations
                // Gets the document

                byte[] document = myOperations
                System.out.println("document ::"+document );
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block


MyOperations  is wrapper for CmsObject and the above api's
getDocumentsFromFolder will call getFilesInFolder of CmsObject,
getDocument will call  readFile of CmsObject,existsDocument will call
existsResource of CmsObject.

when i run the test case  i will not be having "abc" file in "MyResource"

So the output which i get 

Document::" 0
document ::null

After some execution i create "abc" file in "MyResource" folder from my
other appilication .

So the output which i get is 

Document::" 0
document ::@fgdfgdfh

i am not able to find why it gives 0 size. i think may be its is returning
the size from cache 

But if i  do OpenCms.initCmsObject every time i get the proper count.Why???

Can u help me why.

Govind R 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencms.org/pipermail/opencms-dev/attachments/20090220/f47a8ad8/attachment.html>

More information about the opencms-dev mailing list