user2361591
user2361591

Reputation: 153

Connecting to Alfresco Repository using Chemistry cmis without using port

I have a requirement where i need to connect to Alfresco Repository using the below atompuburl

https://www.myalfresco.com/alfresco/api/-default-/public/cmis/versions/1.1/atom

where www.myalfresco.com is my aws alfresco url.

I use the below snippet to get a session of alfresco

public Session connectToRepository(String username,String password,String atompuburl)
    {
        // Create session.
        Session session = null;
        try
        {
            // Default factory implementation of client runtime.
            final SessionFactory sessionFactory = SessionFactoryImpl.newInstance();

            // prepare connection parameters
            final Map<String, String> connectionParameters = new HashMap<String, String>();

            // User credentials.
            connectionParameters.put(SessionParameter.USER,username);
            connectionParameters.put(SessionParameter.PASSWORD,password);

            // Connection settings.
            connectionParameters.put(SessionParameter.ATOMPUB_URL,atompuburl);
            connectionParameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
            session = sessionFactory.getRepositories(connectionParameters).get(0).createSession();
        } catch (CmisConnectionException ce){
            System.out.println("CMIS error=========");
            ce.printStackTrace();
        } catch (CmisPermissionDeniedException cmisPermissionDeniedException)
        {

        }

where i use the above mentioned url in the atompul url.

Is there any way to connect to the Alfresco Repository without the ports(as it is not given to me).

Is there any other way than this for Chemistry Cmis.

Kindly help.

This is the exception it gives

org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Cannot access "https://www.myalfresco.com:443/alfresco/api/-default-/public/cmis/versions/1.1/atom": Connection timed out: connect at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:230) at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invokeGET(DefaultHttpInvoker.java:57) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:641) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getRepositoriesInternal(AbstractAtomPubService.java:808) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:65) at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:90) at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:135) at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:112) at com.ge.test.CMISConnector.connectToRepository(CMISConnector.java:35) at com.ge.test.MyApp.main(MyApp.java:10) connected Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153) at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:205) ... 9 more

Upvotes: 0

Views: 1475

Answers (1)

Jeff Potts
Jeff Potts

Reputation: 10538

Looks like your port is 443 because your URL protocol is "https" and you aren't specifying a port, so it must be the default SSL port.

Make sure you can successfully hit that URL via curl or a similar HTTP client. If you can't do that, check the firewall. Also check that your SSL certificate is valid.

Upvotes: 1

Related Questions