java.lang.IllegalAccessError: tried to access method com.ning.http.client.providers.grizzly.HttpTransactionContext.getAsyncHandler()Lcom/ning/http/client/AsyncHandler; from class org.mule.runtime.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy

MuleSoft JIRA | Lautaro Fernandez | 10 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    When consuming the `http:requester` MP built by the SDK in a test, the override HttpTransactionContext class by mule is not being picked up, provoking the following stack (it tries to access a method that hasn't the necessary visibility): {code:java}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.runtime.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy at org.mule.runtime.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.getWorkManager(FlowWorkManagerIOStrategy.java:119) at org.mule.runtime.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.getThreadPoolFor(FlowWorkManagerIOStrategy.java:90) at org.mule.runtime.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:745){code} Steps to reproduce: 1) Write an xml that uses the new http requester [1] 2) Write a test that extends `ExtensionFunctionalTestCase` and add `org.mule.extension.http.internal.HttpConnector.class` as a describer [2] 3) Use *ONLY* the dependency of the mule-module-http-ext [3] 4) Run the test Workaround: Add the following dependency to force the proper loading of overriden java classes {code:xml} <dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-module-http</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency>{code} [1] {code:xml}<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:httpn="http://www.mulesoft.org/schema/mule/httpn" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/httpn http://www.mulesoft.org/schema/mule/httpn/current/mule-httpn.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <httpn:request-config basePath="/basic-auth" followRedirects="true" enableCookies="true" name="simple-config" sendBodyMode="AUTO" requestStreamingMode="AUTO" parseResponse="true"> <httpn:request-connection protocol="HTTP" port="80" host="httpbin.org" usePersistentConnections="true" connectionIdleTimeout="30000" maxConnections="-1"/> <httpn:authentication> <httpn:basic-authentication password="#['passLP']" preemptive="true" username="#['userLP']"/> </httpn:authentication> </httpn:request-config> <flow initialState="started" name="testHttpDoLogin"> <processor-chain> <httpn:request path="/{aUser}/{aPass}" method="GET" config-ref="simple-config" key="ANY"> <httpn:request-builder> <httpn:simple-request-builder> <httpn:uri-params> <httpn:uri-param value="userLP" key="aUser"/> <httpn:uri-param value="passLP" key="aPass"/> </httpn:uri-params> </httpn:simple-request-builder> </httpn:request-builder> </httpn:request> </processor-chain> </flow> </mule>{code} [2] {code:java}public class OperationModuleWithConfigGlobalElementTestCase extends ExtensionFunctionalTestCase { @Override protected String getConfigFile() { return "operation-with-config-global-elements-module-flow.xml"; } @Override protected Class<?>[] getAnnotatedExtensionClasses() { return new Class<?>[] {org.mule.extension.http.internal.HttpConnector.class}; } @Override public int getTestTimeoutSecs() { return 10000000; } @Test public void testHttpDoLogin() throws Exception{ MuleEvent muleEvent = flowRunner("testHttpDoLogin").run(); assertThat(muleEvent.getMessage().getPayload(), Is.is("success with basic-authentication for user: userLP")); } }{code} [3] {code:xml} <dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-module-http-ext</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency>{code}

    MuleSoft JIRA | 10 months ago | Lautaro Fernandez
    java.lang.IllegalAccessError: tried to access method com.ning.http.client.providers.grizzly.HttpTransactionContext.getAsyncHandler()Lcom/ning/http/client/AsyncHandler; from class org.mule.runtime.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy

    Root Cause Analysis

    1. java.lang.IllegalAccessError

      tried to access method com.ning.http.client.providers.grizzly.HttpTransactionContext.getAsyncHandler()Lcom/ning/http/client/AsyncHandler; from class org.mule.runtime.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy

      at org.mule.runtime.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.getWorkManager()
    2. org.mule.runtime
      FlowWorkManagerIOStrategy.executeIoEvent
      1. org.mule.runtime.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.getWorkManager(FlowWorkManagerIOStrategy.java:119)
      2. org.mule.runtime.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.getThreadPoolFor(FlowWorkManagerIOStrategy.java:90)
      3. org.mule.runtime.module.http.internal.request.grizzly.FlowWorkManagerIOStrategy.executeIoEvent(FlowWorkManagerIOStrategy.java:69)
      3 frames
    3. Grizzly
      AbstractThreadPool$Worker.run
      1. org.glassfish.grizzly.strategies.AbstractIOStrategy.executeIoEvent(AbstractIOStrategy.java:89)
      2. org.glassfish.grizzly.nio.SelectorRunner.iterateKeyEvents(SelectorRunner.java:415)
      3. org.glassfish.grizzly.nio.SelectorRunner.iterateKeys(SelectorRunner.java:384)
      4. org.glassfish.grizzly.nio.SelectorRunner.doSelect(SelectorRunner.java:348)
      5. org.glassfish.grizzly.nio.SelectorRunner.run(SelectorRunner.java:279)
      6. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
      7. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
      7 frames