Home

Search error

You are here

10 posts / 0 new
Last post
Search error

Hello,
I am trying to use CMIS query to retrieve list of folders in the repository using the following code:

query = "SELECT cmis:path, cmis:name, cmis:objectId, cmis:creationDate, cmis:lastModificationDate FROM cmis:folder";
ItemIterable<QueryResult> rows = m_session.query(query, false);
 
for (QueryResult row : rows)
{
    List<PropertyData<?>> properties = row.getProperties();
 
    for (PropertyData<?> property : properties)
    {
          ......
    }
}

Sometimes, it throws this exception:

ERROR RPCMessageReceiver - Cannot access https://api.alfresco.com/domain.com/public/cmis/versions/1.0/atom/query: Unexpected end of file from server
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Cannot access https://api.alfresco.com/domain.com/public/cmis/versions/1.0/atom/query: Unexpected end of file from server
at org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils.invoke(HttpUtils.java:224)
at org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils.invokePOST(HttpUtils.java:74)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:566)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:142)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:567)
at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
at org.apache.chemistry.opencmis.client.runtime.util.CollectionIterator.hasNext(CollectionIterator.java:48)
at com.test.provider.CMIS.CMISManager.search(CMISManager.java:1135)
... 25 more
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:781)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:640)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:318)
at org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils.invoke(HttpUtils.java:204)
... 35 more

I use the following code for create session:

// default factory implementation
SessionFactory factory = SessionFactoryImpl.newInstance();
Map<String, String> parameter = new HashMap<String, String>();
 
// connection settings
parameter.put(SessionParameter.ATOMPUB_URL, "https://api.alfresco.com/cmis/versions/1.0/atom");
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameter.put(SessionParameter.AUTH_HTTP_BASIC, "false");
parameter.put(SessionParameter.HEADER + ".0", "Authorization: Bearer " + accessToken);
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
 
List<Repository> repositories = factory.getRepositories(parameter);
session = repositories.get(0).createSession();

I doing something wrong?
Thanks.

Unexpected end of file from server

Were you able to figure out the problem behind this? I am facing a similar issue. Exception below.

Caused by: org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Cannot access http://alfrescohost.com/alfresco/cmisatom/c5a3942e-a2f4-4247-8565-7c289b06511e/query: Unexpected end of file from server
       at org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils.invoke(HttpUtils.java:208)
       at org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils.invokePOST(HttpUtils.java:70)
       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:566)
       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.__AW_query(DiscoveryServiceImpl.java:142)
       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java)
       at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:557)
       at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
       at org.apache.chemistry.opencmis.client.runtime.util.CollectionIterator.hasNext(CollectionIterator.java:48)
       at com.company.alfresco.service.AlfrescoServiceImpl.getDocumentList(AlfrescoServiceImpl.java:526)
       at com.company.alfresco.service.AlfrescoServiceImpl.getDocumentList_aroundBody20(AlfrescoServiceImpl.java:468)
       at com.company.alfresco.service.AlfrescoServiceImpl.getDocumentList_aroundBody21$advice(AlfrescoServiceImpl.java:88)
       ... 66 more

I tried changing the alfresco tomcat's Connector configuration to increase connectionTimeout but it did not seem to help.

File: /home/alfresco/alfresco-4.0.e/p_alf_svc1/conf/ server.xml

    <Connector port="8080" URIEncoding="UTF-8" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" address="10.3.4.84" />

Any other pointers/help?

Were you able to resolve this

Were you able to resolve this problem? I'm facing a similar issue.

Caused by: org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Cannot access http://alfrescohost/alfresco/cmisatom/c5a3942e-a2f4-4247-8565-7c289b06511e/query: Unexpected end of file from server
       at org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils.invoke(HttpUtils.java:208)
       at org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils.invokePOST(HttpUtils.java:70)
       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:566)
       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.__AW_query(DiscoveryServiceImpl.java:142)
       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java)
       at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:557)
       at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
       at org.apache.chemistry.opencmis.client.runtime.util.CollectionIterator.hasNext(CollectionIterator.java:48)
       at com.company.alfresco.service.AlfrescoServiceImpl.getDocumentList(AlfrescoServiceImpl.java:526)
       at com.company.alfresco.service.AlfrescoServiceImpl.getDocumentList_aroundBody20(AlfrescoServiceImpl.java:468)
       at com.company.alfresco.service.AlfrescoServiceImpl.getDocumentList_aroundBody21$advice(AlfrescoServiceImpl.java:88)
       ... 66 more

atom url

In your previous post you said your alfresco port is 8080,but the url you pasted did not contain the port part.
And make sure you provided the correct atom url

http://localhost:8080/alfresco/cmisatom for cmis version 1.0
http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom for cmis version 1.1

You can paste your code here.

If this post was helpful, please click Yes on the Post Rating

port 8080 does not show up on

port 8080 does not show up on the URL since the requests are handled by apache.
the error "Unexpected end of file from server" only happens sporadically.

I'm using the below 2 cmis client libraries. I believe they are cmis version 1.0. How do I know if I need to use cmis 1.0 or 1.1 url?:

<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-impl</artifactId>
<version>0.7.0</version>
 
 
<groupId>org.alfresco.cmis.client</groupId>
<artifactId>alfresco-opencmis-extension</artifactId>
<version>0.3</version>

without apache.

Have you tried to send request to alfresco server directly ?
Which url you are using depends on whether you want to use features in cmis specification 1.1.
I sugest you use 1.1 url.

If this post was helpful, please click Yes on the Post Rating

without apache

I bypassed apache and dont seem to be getting the error now.
During my tests what I noticed was that the sporadic errors coincided with some packet loss issues in the network (was testing with pings).

however when I bypassed apache, the packet loss issues were not impacting the alfresco transaction.
My guess is the default Keep Alive configuration in Apache might be the one causing the issue, will try to remove that and see if that solves it.

Thanks for the pointer!

Errors without apache as well

Initially I though the problem was gone. in my tests I was running from my desktop against the production servers. Later when I tried running the client from a remotely located production server (actual final location of the code), I started seeing the Unexpected end of file from server once again. Didn't help bypassing the apache server. It fails intermittently about 30% of the time.

ERROR: com.matson.arch.poc.alfresco.cmis.opencmis.GatesIntegrationTestMain.testGetDocumentListRepeatedly(GatesIntegrationTestMain.java:134) - Error running test cmis query
org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Cannot access http://10.3.4.84:8080/alfresco/cmisatom/c5a3942e-a2f4-4247-8565-7c289b06511e/query: Unexpected end of file from server
	at org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils.invoke(HttpUtils.java:208)
	at org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils.invokePOST(HttpUtils.java:70)
	at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:566)
	at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:142)
	at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:557)
	at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
	at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getPageNumItems(AbstractIterator.java:57)
	at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterable.getPageNumItems(AbstractIterable.java:86)
	at com.matson.arch.poc.alfresco.cmis.opencmis.GatesIntegrationTestMain.test_cmisQuery(GatesIntegrationTestMain.java:110)
	at com.matson.arch.poc.alfresco.cmis.opencmis.GatesIntegrationTestMain.testGetDocumentListRepeatedly(GatesIntegrationTestMain.java:132)
	at com.matson.arch.poc.alfresco.cmis.opencmis.GatesIntegrationTestMain.main(GatesIntegrationTestMain.java:189)
Caused by: java.net.SocketException: Unexpected end of file from server
	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:781)
	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:640)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
	at org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils.invoke(HttpUtils.java:188)
	... 10 more

cmis 1.1

I can't use CMIS 1.1 url since I'm on Alfresco version 4.0.e which does not implement/support cmis 1.1. only 4.2 seems to support that.
ref: http://wiki.alfresco.com/wiki/CMIS#CMIS_Service_URL

test in other alfresco version

Have you ever tried your code in other alfresco version,for example 4.2.
And make sure test your code without apache.

If this post was helpful, please click Yes on the Post Rating

forums index