AEM Hybris Integration | Adobe Higher Education
Skip to main content
kishore_polsani
Level 4
January 2, 2017

AEM Hybris Integration

  • January 2, 2017
  • 3 Antworten
  • 3700 Ansichten

Hi All,

I have tried the AEM + Hybris integration(out of box), I have followed the steps from docs.adobe.com. When I am trying to import catalog (outdoors) from hybris, I am getting the following error in AEM error logs.

Error message:
02.01.2017 16:36:33.090 *ERROR* [0:0:0:0:0:0:0:1 [1483355193013] GET /content/geometrixx-outdoors/en_US/men/shirts/bambara-cargo.html HTTP/1.1] com.adobe.cq.commerce.hybris.impl.OAuthHandler Server did not respond with 2xx -> authentication failed.

Environment:

  •     AEM : 6.1 
  •     Hybris: 5.7
  •     Packages installed: 
    • cq-geometrixx-hybris-content-6.1.2.zip 
    • cq-hybris-content-6.1.2.zip

I have provided below connection params in configMgr (Day CQ Commerce Hybris Connection Handler)
    Base URL: http://localhost:9001
    Username: admin
    Pwd: nimda

When I try to access any url under /content/geometrixx-outdoors/en_US its redirecting to http://localhost:4502/content/geometrixx-outdoors/en_US/toolbar/offline.html.

Let me know if I miss anything.


 

Dieses Thema wurde für Antworten geschlossen.

3 Antworten

smacdonald2008
Level 10
January 3, 2017

Did you follow the documentation exactly? 

Level 4
January 3, 2017

kishore.polsani wrote...

Hi All,

I have tried the AEM + Hybris integration(out of box), I have followed the steps from docs.adobe.com. When I am trying to import catalog (outdoors) from hybris, I am getting the following error in AEM error logs.

Error message:
02.01.2017 16:36:33.090 *ERROR* [0:0:0:0:0:0:0:1 [1483355193013] GET /content/geometrixx-outdoors/en_US/men/shirts/bambara-cargo.html HTTP/1.1] com.adobe.cq.commerce.hybris.impl.OAuthHandler Server did not respond with 2xx -> authentication failed.

Environment:

  •     AEM : 6.1 
  •     Hybris: 5.7
  •     Packages installed: 
    • cq-geometrixx-hybris-content-6.1.2.zip 
    • cq-hybris-content-6.1.2.zip

I have provided below connection params in configMgr (Day CQ Commerce Hybris Connection Handler)
    Base URL: http://localhost:9001
    Username: admin
    Pwd: nimda

When I try to access any url under /content/geometrixx-outdoors/en_US its redirecting to http://localhost:4502/content/geometrixx-outdoors/en_US/toolbar/offline.html.

Let me know if I miss anything.


 

 


Hi,

It's due to below piece of code in oauth handler.java-

public void executeAuthenticated(CloseableHttpClient client,
            HybrisRequest hybrisRequest, String username, String password)
            throws IOException, CommerceException {
        try {
            HttpUriRequest request = hybrisRequest.getRequest();
            URI uri = request.getURI();
            if (uri.getPath().startsWith("/ws410/rest")) {
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                HttpHost targetHost = new HttpHost(uri.getHost(),
                        uri.getPort(), uri.getScheme());
                credsProvider.setCredentials(
                        new AuthScope(targetHost.getHostName(), targetHost
                                .getPort()), new UsernamePasswordCredentials(
                                username, password));

                AuthCache authCache = new BasicAuthCache();
                BasicScheme basicAuth = new BasicScheme();
                authCache.put(targetHost, basicAuth);
                HttpClientContext context = HttpClientContext.create();
                context.setAuthCache(authCache);
                context.setCredentialsProvider(credsProvider);
                CloseableHttpResponse response = client.execute(request,
                        context);
                HybrisConnection connection = (HybrisConnection) getService(HybrisConnection.class
                        .getName());
                String responseEncoding = connection.getResponseEncoding();
                ungetService(HybrisConnection.class.getName());
                hybrisRequest.setResult(new CommandResult(response,
                        responseEncoding));
            }

 

As it looks for uri.getPath().startsWith("/ws410/rest")) and it fails here thts why its not working for you , you need to override it.

Hope it helps.

 

Regards

Ankur

January 3, 2017

Thanks for the reply Ankur & Scott,

Is this a bug? It should work without any code changes right?. I have followed steps provided in below URLs.

  1. https://docs.adobe.com/docs/en/aem/6-1/administer/ecommerce/hybris.html
  2. https://docs.adobe.com/docs/en/aem/6-1/deploy/ecommerce/hybris.html

Attached configs:

kautuk_sahni
Community Manager
Community Manager
January 3, 2017

Hi

Wish you a very happy new year.

Please have a look at this similar forum post:-

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__oymc-hi_friends_ihave.html

// The Hybris server may be up and this AEM request is not allowed by your server. The Server treats this request as bad request. Does the server have any firewall in place which prevents AEM request to complete?

Also read other comments, i hope this will help you.

~kautuk

Kautuk Sahni
kishore_polsani
Level 4
January 4, 2017

Hi Kautuk,

I have checked the link shared by you. Both AEM and Hybris are in my local, I have disabled firewall and tested, still connection is not established. I have retested with Hybris latest version 6.1. Is this something to do with Hybris?

Error Message:

04.01.2017 10:23:07.037 *ERROR* [0:0:0:0:0:0:0:1 [1483505585709] POST /libs/commerce/products HTTP/1.1] com.adobe.cq.commerce.hybris.impl.OAuthHandler Server did not respond with 2xx -> authentication failed.

 

04.01.2017 10:23:07.134 *WARN* [0:0:0:0:0:0:0:1 [1483505585709] POST /libs/commerce/products HTTP/1.1] com.adobe.cq.commerce.hybris.impl.OAuthHandler Failed to execute request after retrying, server responded with status 401

04.01.2017 10:23:07.136 *ERROR* [0:0:0:0:0:0:0:1 [1483505585709] POST /libs/commerce/products HTTP/1.1] com.adobe.cq.commerce.hybris.importer.DefaultHybrisImporter Importing catalog "outdoors" from Hybris failed: 
com.adobe.cq.commerce.api.NotAuthorizedException: You are not authorized.

I have also added hybris extension  <extension name='ycommercewebservices' />

Attached logs for reference.

Level 1
September 22, 2017

Hello all,

I have the same exact problem tryng to import a catalog into AEM 6.2 from Hybris.

Is there any solution ?

Regards,

Gianantonio .