cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting To Alfresco By Using CMIS API

narithota
Champ in-the-making
Champ in-the-making
Hi Team,

Previously I have worked with alfresco web-services to upload and download documents to alfresco. But now our organization need to upload the documents with our organization specific metadata. So I searched in the forum but I did not get any info on how to upload the documents with custom metadata by using web-services.

So I thought its better to use CMIS api because it is having additional methods to upload the documents with metadata.

So I connected to my alfresco by using CMIS api. I got the repository information. But when I am trying to get the ROOT Folder information, I am getting the following error trace.

Connected to repository:49cdee07-73a8-4f49-ab30-52403d9c7993
Exception in thread "main" java.lang.IllegalArgumentException: Unknown aspect property: null
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertProperties(AlfrescoObjectFactoryImpl.java:236)
   at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.initialize(AbstractCmisObject.java:108)
   at org.alfresco.cmis.client.impl.AlfrescoFolderImpl.initialize(AlfrescoFolderImpl.java:46)
   at org.apache.chemistry.opencmis.client.runtime.FolderImpl.<init>(FolderImpl.java:69)
   at org.alfresco.cmis.client.impl.AlfrescoFolderImpl.<init>(AlfrescoFolderImpl.java:39)
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertObject(AlfrescoObjectFactoryImpl.java:297)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:397)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:367)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getRootFolder(SessionImpl.java:472)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getRootFolder(SessionImpl.java:466)
   at com.rcv.alfresco.dao.Demo2.main(Demo2.java:62)


Following is the code

  
            SessionFactory factory = SessionFactoryImpl.newInstance();
            Map<String, String> parameter = new HashMap<String, String>();
            parameter.put(SessionParameter.USER, "user");
            parameter.put(SessionParameter.PASSWORD, "mypass");
            parameter.put(SessionParameter.ATOMPUB_URL, "http://<myhost>:8080/alfresco/cmisatom");
            parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
            parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
            List<Repository> repositories = factory.getRepositories(parameter);
            Session session = repositories.get(0).createSession();
            System.out.println("Connected to repository:" + repositories.get(0).getId());
           
          
            Folder root=null;
           
            root = session.getRootFolder();
         

Iam getting error at Line :

  root = session.getRootFolder(); 



Instead I tries to children of spacesstore by using the following url

http://<host>:8080/alfresco/service/cmis/s/workspaceSmiley FrustratedpacesStore/i/6cc685e0-9ac3-4d55-8af3-dd7b2bba78b7/children


but it is ging internal error as

Web Script Status 500 - Internal Error

The Web Script /alfresco/service/cmis/s/workspaceSmiley FrustratedpacesStore/i/6cc685e0-9ac3-4d55-8af3-dd7b2bba78b7/children has responded with a status of 500 - Internal Error.

500 Description:    An error inside the HTTP server which prevented it from fulfilling the request.

Message:   00080094 Wrapped Exception (with status template): 000819120 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/children.get.js': 000819119

Exception:   java.security.cert.CertificateExpiredException - NotAfter: Fri Aug 17 17:34:11 GMT+05:30 2012

sun.security.x509.CertificateValidity.valid(CertificateValidity.java:256)
sun.security.x509.X509CertImpl.checkValidity(X509CertImpl.java:570)
sun.security.provider.certpath.BasicChecker.verifyTimestamp(BasicChecker.java:157)
sun.security.provider.certpath.BasicChecker.check(BasicChecker.java:109)
sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(PKIXMasterCertPathValidator.java:117)
sun.security.provider.certpath.PKIXCertPathValidator.doValidate(PKIXCertPathValidator.java:328)
sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(PKIXCertPathValidator.java:178)
java.security.cert.CertPathValidator.validate(CertPathValidator.java:250)
sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:255)
sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:243)
sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:156)
sun.security.validator.Validator.validate(Validator.java:218)
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1014)
com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:124)
com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:506)
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient.executeQuery(SolrQueryHTTPClient.java:313)
org.alfresco.repo.search.impl.solr.SolrQueryLanguage.executeQuery(SolrQueryLanguage.java:49)
org.alfresco.repo.search.impl.solr.SolrSearchService.query(SolrSearchService.java:367)
org.alfresco.repo.search.SearcherComponent.query(SearcherComponent.java:78)
sun.reflect.GeneratedMethodAccessor2012.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.alfresco.repo.management.subsystems.SubsystemProxyFactory$1.invoke(SubsystemProxyFactory.java:65)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy13.query(Unknown Source)
sun.reflect.GeneratedMethodAccessor2012.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:146)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy13.query(Unknown Source)
org.alfresco.cmis.mapping.CMISServicesImpl.getChildren(CMISServicesImpl.java:570)
org.alfresco.repo.cmis.rest.CMISScript.queryChildren(CMISScript.java:402)
sun.reflect.GeneratedMethodAccessor2031.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
org.mozilla.javascript.gen.c6._c0(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/children.get.js:134)
org.mozilla.javascript.gen.c6.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/children.get.js)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
org.mozilla.javascript.gen.c6.call(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/children.get.js)
org.mozilla.javascript.gen.c6.exec(file:/C:/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/children.get.js)
org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:483)
org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:191)
org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:282)
org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1107)
org.alfresco.repo.cmis.rest.CMISWebScript.executeScript(CMISWebScript.java:46)
org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:393)
org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)
org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)
org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)
org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:352)
org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
java.lang.Thread.run(Thread.java:619)

Exception:   java.security.cert.CertPathValidatorException - timestamp check failed

sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(PKIXMasterCertPathValidator.java:139)

Exception:   sun.security.validator.ValidatorException - PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed

sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:260)

Exception:   javax.net.ssl.SSLHandshakeException - sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed

com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)

Exception:   org.alfresco.repo.search.impl.lucene.LuceneQueryParserException - 000819119

org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient.executeQuery(SolrQueryHTTPClient.java:359)

Exception:   org.alfresco.scripts.ScriptException - 000819120 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/children.get.js': 000819119

org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:195)

Exception:   org.springframework.extensions.webscripts.WebScriptException - 00080094 Wrapped Exception (with status template): 000819120 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/children.get.js': 000819119

org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:884)

Server:   Community v4.0.0 (a 3755) schema 5,018
Time:   Jan 8, 2013 1:03:51 PM

Diagnostics:   Inspect Web Script (org/alfresco/cmis/children.get)


We are using alfresco 3.4.e ,org.apache.chemistry.opencmis 0.8 and org.alfresco.cmis.client 0.3.

But our product version is showing 4.0.0. Is that cause the error.

Please provide some suggestion to solve this error.

And also I need help in uploading the documents with custom metadata. Please provide any links.




Thanks.
9 REPLIES 9

mikeh
Star Contributor
Star Contributor
You need to read the following post, as it seems to apply to your situation: https://forums.alfresco.com/en/viewtopic.php?f=47&t=45940

narithota
Champ in-the-making
Champ in-the-making
Hi MikeH,

First of all thanks for the quick response.

So, In order to search the repository by using the CMIS API, we need to manually create the SSL certificates.

But our searching by using web-services is working fine and by using CMIS API we are able to connect to repository,get the repository information but getting error while getting the folder information. Is lack of SSL certificates causes these problems?

mikeh
Star Contributor
Star Contributor
You need to replace the SSL certificate that was shipped with 4.0.
Exception:   java.security.cert.CertificateExpiredException - NotAfter: Fri Aug 17 17:34:11 GMT+05:30 2012

Your other option is to upgrade to the latest Community Edition (4.2.c) which replaces the SOLR certificate with one that has an expiration date in the far future.

Thanks,
Mike

narithota
Champ in-the-making
Champ in-the-making
Hi Mike,

Sorry for inconvenience.

So do we need to upgrade the alfresco to perform the search by using CMIS.

But we can able to download the documents by searching in alfresco based on document id by using alfresco java web services api.

Is expiration of SOLR certificates restricts only CMIS API?

Is following error also caused by the expiration of SOLR certificates?

Exception in thread "main" java.lang.IllegalArgumentException: Unknown aspect property: null
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertProperties(AlfrescoObjectFactoryImpl.java:236)
   at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.initialize(AbstractCmisObject.java:108)
   at org.alfresco.cmis.client.impl.AlfrescoFolderImpl.initialize(AlfrescoFolderImpl.java:46)
   at org.apache.chemistry.opencmis.client.runtime.FolderImpl.<init>(FolderImpl.java:69)
   at org.alfresco.cmis.client.impl.AlfrescoFolderImpl.<init>(AlfrescoFolderImpl.java:39)
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertObject(AlfrescoObjectFactoryImpl.java:297)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:397)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:367)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getRootFolder(SessionImpl.java:472)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getRootFolder(SessionImpl.java:466)
   at com.rcv.alfresco.dao.Demo2.main(Demo2.java:62)



Thanks
Naresh

mikeh
Star Contributor
Star Contributor
I'm not sure what's causing your unknown aspect issue - possibly a custom model you've not migrated across to a new version..? But it's best to tackle one problem at a time.

Thanks,
Mike

narithota
Champ in-the-making
Champ in-the-making
Hi Mike,

I installed Alfresco Enterprise - v4.1.2 (372) and configured it.

Now
http://<host>:8080/alfresco/service/cmis/s/workspaceSmiley FrustratedpacesStore/i/6cc685e0-9ac3-jnk34s-4d55-8af3-dd7b2bba78b7/children
url is working.

But when I tried to connect to alfresco by using CMIS API, it is giving same exception :
Exception in thread "main" java.lang.IllegalArgumentException: Unknown aspect property: null
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertProperties(AlfrescoObjectFactoryImpl.java:236)
   at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.initialize(AbstractCmisObject.java:108)
   at org.alfresco.cmis.client.impl.AlfrescoFolderImpl.initialize(AlfrescoFolderImpl.java:46)
   at org.apache.chemistry.opencmis.client.runtime.FolderImpl.<init>(FolderImpl.java:69)
   at org.alfresco.cmis.client.impl.AlfrescoFolderImpl.<init>(AlfrescoFolderImpl.java:39)
   at org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl.convertObject(AlfrescoObjectFactoryImpl.java:297)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObjectByPath(SessionImpl.java:444)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObjectByPath(SessionImpl.java:418)
   at com.rcv.alfresco.dao.CMISExampleBase.getSession(CMISExampleBase.java:72)
   at com.rcv.alfresco.dao.CMISExampleBase.main(CMISExampleBase.java:89)

Following piece of code from AlfrescoObjectFactoryImpl is throwing the exception


            for (CmisExtensionElement property : extension.getChildren())
            {
                String id = property.getAttributes().get("propertyDefinitionId");

                // find the aspect type
                ObjectType aspectType = AlfrescoAspectsUtils.findAspect(aspectTypes, id);
                if (aspectType == null)
                {
                    throw new IllegalArgumentException("Unknown aspect property: " + id);
                }
Following are Maven Dependencies of CMIS JARs

 <dependency>
   <groupId>org.alfresco.cmis.client</groupId>
   <artifactId>alfresco-opencmis-extension</artifactId>
   <version>0.3</version>
</dependency>

  <dependency>
   <groupId>org.apache.chemistry.opencmis</groupId>
   <artifactId>chemistry-opencmis-client-impl</artifactId>
   <version>0.8.0</version>
</dependency>

narithota
Champ in-the-making
Champ in-the-making
Its working!!!!!!!!


Actually I am using Chemistry API to connect but for OBJECT_FACTORY_CLASS  I have used opencmis's objectfactory class. Thats caused the problem.

Thanks
Naresh

jonbarril
Champ in-the-making
Champ in-the-making
I'm having a similar problem.  What exactly did you do to fix the problem?  What values are you using for OBJECT_FACTORY_CLASS, etc?

Thanks
–jon

Its working!!!!!!!!


Actually I am using Chemistry API to connect but for OBJECT_FACTORY_CLASS  I have used opencmis's objectfactory class. Thats caused the problem.

Thanks
Naresh

narithota
Champ in-the-making
Champ in-the-making
I am using following class for object factory

org.apache.chemistry.opencmis.client.runtime.repository.ObjectFactoryImpl which is apache chemistry's object factory impl class…

my code follows

 String serviceUrl = "http://<my host>:8080/alfresco/service/cmis"; // Uncomment for Atom Pub binding

     Session session = null;
   
   public Session getSession() throws Exception {
      if (session == null) {
         // default factory implementation
         SessionFactory factory = SessionFactoryImpl.newInstance();
         Map<String, String> parameter = new HashMap<String, String>();
   
         // user credentials
         parameter.put(SessionParameter.USER, "user");
         parameter.put(SessionParameter.PASSWORD, "my pass");
   
         // connection settings
         parameter.put(SessionParameter.ATOMPUB_URL, getServiceUrl()); // Uncomment for Atom Pub binding
               
         
         parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); // Uncomment for Atom Pub binding
            
         // Set the alfresco object factory
         // Used when using the CMIS extension for Alfresco for working with aspects
         parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.apache.chemistry.opencmis.client.runtime.repository.ObjectFactoryImpl");
         
         List<Repository> repositories = factory.getRepositories(parameter);         
         System.out.println("repository : "+repositories.get(0).getId());                                 
         session = repositories.get(0).createSession();                  
         Folder root=session.getRootFolder();