2
votes

I have Anypoint 6.2.5
Mule 3.8.1 CE
When I am trying to send json to Magento2 Api.
Im using http request like that:

<http:request config-ref="HTTP_Request_Configuration" path="/products/attributes" method="POST" doc:name="HTTP">
<http:request-builder>
<http:header headerName="Authorization" value="Bearer xxxx"/>
<http:header headerName="Content-Type" value="application/json"/>
</http:request-builder>
</http:request>

Response Timeout is set to 10s
I got an error :

cze 28, 2017 8:48:03 AM org.glassfish.grizzly.nio.SelectorRunner doSelect
SEVERE: doSelect exception
java.lang.IllegalAccessError: tried to access method com.ning.http.client.providers.grizzly.HttpTransactionContext.getAsyncHandler()Lcom/ning/http/client/AsyncHandler; from class org.mule.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy
at org.mule.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.getWorkManager(FlowWorkManagerIOStrategy.java:119)
at org.mule.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.getThreadPoolFor(FlowWorkManagerIOStrategy.java:90)
at org.mule.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.executeIoEvent(FlowWorkManagerIOStrategy.java:69)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.executeIoEvent(AbstractIOStrategy.java:89)
at org.glassfish.grizzly.nio.SelectorRunner.iterateKeyEvents(SelectorRunner.java:415)
at org.glassfish.grizzly.nio.SelectorRunner.iterateKeys(SelectorRunner.java:384)
at org.glassfish.grizzly.nio.SelectorRunner.doSelect(SelectorRunner.java:348)
at org.glassfish.grizzly.nio.SelectorRunner.run(SelectorRunner.java:279)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:748)

ERROR 2017-06-28 08:48:10,554 [[magento].readAttributeMessagesFromQueueFlow.stage1.01] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Error sending HTTP request.
Payload               : {"attribute":{"is_visible":true,"attribute_code":"ts_size","frontend_input":"select","default_frontend_label":"ts_size","options":[{"label":"36","value":"36","sort_order":0,"is_default":true,"store_labels":[{"label":"36","store_id":0}]},{"label":"S","value":"S","sort_order":0,"is_default":true,"store_labels":[{"label":"S","store_id":0}]},{"label":"XS","value":"XS","sort_order":0,"is_default":true,"store_labels":[{"label":"XS","store_id":0}]},{"label":"XL","value":"XL","sort_order":0,"is_default":true,"store_labels":[{"label":"XL","store_id":0}]},{"label":"L","value":"L","sort_order":0,"is_default":true,"store_labels":[{"label":"L","store_id":0}]},{"label":"M","value":"M","sort_order":0,"is_default":true,"store_labels":[{"label":"M","store_id":0}]},{"label":"ONE SIZE","value":"ONE SIZE","sort_order":0,"is_default":true,"store_labels":[{"label":"ONE SIZE","store_id":0}]},{"label":"34","value":"34","sort_order":0,"is_default":true,"store_labels":[{"label":"34","store_id":0}]},{"label":"40","value":"40","sort_order":0,"is_default":true,"store_labels":[{"label":"40","store_id":0}]},{"label":"42","value":"42","sort_order":0,"is_default":true,"store_labels":[{"label":"42","store_id":0}]},{"label":"38","value":"38","sort_order":0,"is_default":true,"store_labels":[{"label":"38","store_id":0}]}],"frontend_labels":[{"label":"ts_size","store_id":0}]}}
Payload Type          : [B
Element               : /readAttributeMessagesFromQueueFlow/processors/2 @ magento:Attributes.xml:24 (HTTP)
Element XML           : <http:request config-ref="HTTP_Request_Configuration" path="/products/attributes" method="POST" doc:name="HTTP">
                        <http:request-builder>
                        <http:header headerName="Authorization" value="Bearer 3vh5yv803usi8ik2ix695ukweu2j8nnq"></http:header>
                        <http:header headerName="Content-Type" value="application/json"></http:header>
                        </http:request-builder>
                        </http:request>
--------------------------------------------------------------------------------
Root Exception stack trace:
java.util.concurrent.TimeoutException: Timeout exceeded
    at com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider.timeout(GrizzlyAsyncHttpProvider.java:433)
    at com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider$3.onTimeout(GrizzlyAsyncHttpProvider.java:281)
    at org.glassfish.grizzly.utils.IdleTimeoutFilter$DefaultWorker.doWork(IdleTimeoutFilter.java:401)
    at org.glassfish.grizzly.utils.IdleTimeoutFilter$DefaultWorker.doWork(IdleTimeoutFilter.java:380)
    at org.glassfish.grizzly.utils.DelayedExecutor$DelayedRunnable.run(DelayedExecutor.java:158)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

I dont really know how can I fix it.
I am sure that sending request works - new attribute in Magento was created correctly but error shown up and flow is stopped.
Some more details:

eclipse.buildId=unknown  
java.version=1.8.0_131  
java.vendor=Oracle Corporation  
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=pl_PL  
Command-line arguments:  -os linux -ws gtk -arch x86_64

It works without problems and without errors on my friends Pc. Am I missing some packages on my system?

2

2 Answers

2
votes

I solved issue.

You need to remove a jar called async-http-client from you CE Runtime located at /lib/user folder.

Inside your AnyPointStudio installation locate you CE Runtime. It's something like this:

"../Eclipse/plugins/org.mule.tooling.server.3.8.1_6.0.0.201612271237/mule/lib/user"

Located and delete the mentioned jar file, restart your AnyPointStudio and will be fine.

For Standalone Runtime just download the latest version from github and use maven to build it.