cancel
Showing results for 
Search instead for 
Did you mean: 

Datalist to create content less information using CMIS

sandhya_nair
Confirmed Champ
Confirmed Champ

Hi,

I want to store the employee information content less object format. So I have created a sub type of dl:dataListType instead of cm:content and then I am storing the employee metadata in that datalist.

Also using CMIS code to populate this employee information. I am receiving the data in csv format and it contains more than 2,00,000 rows of information.

A standlone java code is written using CMIS to insert values on datalist but it is getting failed after inserting 1500 rows. Is the datalist is right approach to store more data?

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Cannot access "http://localhost:9090/alfresco/api/-default-/public/cmis/versions/1.1/atom/children?id=dd2dcc76-5c1d-4dee-a928-7d3eb755969f": Unexpected end of file from server

       at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:233)

       at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invokePOST(DefaultHttpInvoker.java:68)

       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:713)

       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:122)

       at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1197)

       at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1317)

       at com.post.adm.job.UpdateEmployeeDataList.addItem(UpdateEmployeeDataList.java:175)

       at com.post.adm.job.UpdateEmployeeDataList.updateCSV(UpdateEmployeeDataList.java:115)

       at com.post.adm.job.UpdateEmployeeDataList.main(UpdateEmployeeDataList.java:59)

Caused by: java.net.SocketException: Unexpected end of file from server

       at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:862)

       at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:689)

       at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1604)

       at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)

       at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)

       at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:211)

       ... 8 more

Thanks in advance,

Sandhya

5 REPLIES 5

abhinavmishra14
World-Class Innovator
World-Class Innovator

As far as approach as concerned, there should not be any problem using dataList for this use case. A datalist node would be created for every row which you have in your csv file. It is same as creating a cm:content type content less object having metadata. 

I doubt if the issue is due to the csv file itself as the error says 'Unexpected end of file from server'. Not i am not 100 % sure. If you know the 1500th row, create a new csv and add next available rows to the new csv file and run the script and see if you get the same error. 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

It is not always 1500th row sometimes it is failing at 200th row and sometimes it create nearly 2500 objects. I doubt is there anything to do with CMIS Session.

Seems right, it could be session issue as well. You could add a log by catching the exception where the above given exception (CmisConnectionException) is thrown to check if you session is still valid. 

How are you getting the session? And which version of alfresco you are using. 

An example of getting the session in correct way can be found here: Java Clients | Alfresco Documentation 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

sandhya_nair
Confirmed Champ
Confirmed Champ

Below is the code used to get session. Alfresco version 6.1 Enterprise Edition SDK. One more thing is that alfresco content server is going down as well sometimes.

I am getting error at the line

session.createItem(properties, datalistId);

Also I have created 5000+ rows in datalist. But when trying to open that datalist in datalist page or document library I am getting the socket time out error and Java Heap space issue.


public Session getSession(String username, String pwd) {
SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Map<String, String> parameters = new HashMap<String, String>();
parameters.put(SessionParameter.USER, username);
parameters.put(SessionParameter.PASSWORD, pwd);
parameters.put(SessionParameter.ATOMPUB_URL,
"http://localhost:8080/alfresco/api/-default-/cmis/versions/1.1/atom");
parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameters.put(SessionParameter.COMPRESSION, "true");
parameters.put(SessionParameter.CACHE_TTL_OBJECTS, "0");

// If there is only one repository exposed (e.g. Alfresco), these
// lines will help detect it and its ID
List<Repository> repositories = sessionFactory.getRepositories(parameters);
Repository alfrescoRepository = null;
if (repositories != null && repositories.size() > 0) {
alfrescoRepository = repositories.get(0);
} else {
throw new CmisConnectionException(
"Could not connect to the Alfresco Server, no repository found!");
}

// Create a new session with the Alfresco repository
Session session = alfrescoRepository.createSession();

return session;
}

Your code looks okay. When i trying locally, it get the session as well. Looks like inline issue is "Java Heap space error" which could be causing server crash. Trying setting appropriate heap memory as per your configuration.

Refer here : https://docs.alfresco.com/6.1/concepts/jvm-tuning.html 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)