org.mule.runtime.core.api.config.ConfigurationException: Could not load class org.mule.extension.http.api.request.client.HttpClient (java.lang.IllegalArgumentException)

MuleSoft JIRA | Lautaro Fernandez | 8 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

    Consuming the HTTP connector from a test ends up in classloading issues throwing the following exception: {code:java}================================================================================ = Testing: test = ================================================================================ org.mule.runtime.core.api.config.ConfigurationException: Could not load class org.mule.extension.http.api.request.client.HttpClient (java.lang.IllegalArgumentException) at org.mule.runtime.core.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43) at org.mule.runtime.core.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:83) at org.mule.runtime.core.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:191) at org.mule.runtime.core.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:77) at org.mule.tck.junit4.AbstractMuleContextTestCase.createMuleContext(AbstractMuleContextTestCase.java:214) at org.mule.tck.junit4.AbstractMuleContextTestCase.setUpMuleContext(AbstractMuleContextTestCase.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74) Caused by: java.lang.IllegalArgumentException: Could not load class org.mule.extension.http.api.request.client.HttpClient at org.mule.metadata.java.api.utils.JavaTypeUtils.getType(JavaTypeUtils.java:41) at org.mule.metadata.java.api.utils.JavaTypeUtils.getType(JavaTypeUtils.java:25) at org.mule.runtime.module.extension.internal.model.property.ConnectivityModelProperty.<init>(ConnectivityModelProperty.java:34) at org.mule.runtime.module.extension.internal.introspection.enricher.ConnectionModelEnricher.addModelProperty(ConnectionModelEnricher.java:117) at org.mule.runtime.module.extension.internal.introspection.enricher.ConnectionModelEnricher.access$000(ConnectionModelEnricher.java:46) at org.mule.runtime.module.extension.internal.introspection.enricher.ConnectionModelEnricher$1.onOperation(ConnectionModelEnricher.java:70) at org.mule.runtime.module.extension.internal.util.IdempotentDeclarationWalker$$Lambda$73/143293910.accept(Unknown Source) at org.mule.runtime.module.extension.internal.util.IdempotentDeclarationWalker.doOnce(IdempotentDeclarationWalker.java:66) at org.mule.runtime.module.extension.internal.util.IdempotentDeclarationWalker.onOperation(IdempotentDeclarationWalker.java:56) at org.mule.runtime.extension.api.introspection.declaration.fluent.util.DeclarationWalker.lambda$walkOperations$14(DeclarationWalker.java:128) at org.mule.runtime.extension.api.introspection.declaration.fluent.util.DeclarationWalker$$Lambda$72/2120054390.accept(Unknown Source) at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1235) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at org.mule.runtime.extension.api.introspection.declaration.fluent.util.DeclarationWalker.walkOperations(DeclarationWalker.java:126) at org.mule.runtime.extension.api.introspection.declaration.fluent.util.DeclarationWalker.lambda$walk$10(DeclarationWalker.java:53) at org.mule.runtime.extension.api.introspection.declaration.fluent.util.DeclarationWalker$$Lambda$65/1983324438.accept(Unknown Source) at java.lang.Iterable.forEach(Iterable.java:75) at org.mule.runtime.extension.api.introspection.declaration.fluent.util.DeclarationWalker.walk(DeclarationWalker.java:48) at org.mule.runtime.module.extension.internal.introspection.enricher.ConnectionModelEnricher.enrich(ConnectionModelEnricher.java:82) at org.mule.runtime.module.extension.internal.introspection.DefaultExtensionFactory.lambda$enrichModel$139(DefaultExtensionFactory.java:138) at org.mule.runtime.module.extension.internal.introspection.DefaultExtensionFactory$$Lambda$64/2114005651.accept(Unknown Source) at java.lang.Iterable.forEach(Iterable.java:75) at org.mule.runtime.module.extension.internal.introspection.DefaultExtensionFactory.enrichModel(DefaultExtensionFactory.java:138) at org.mule.runtime.module.extension.internal.introspection.DefaultExtensionFactory.createFrom(DefaultExtensionFactory.java:121) at org.mule.functional.junit4.infrastructure.ExtensionsTestInfrastructureDiscoverer.loadExtensionModel(ExtensionsTestInfrastructureDiscoverer.java:146) at org.mule.functional.junit4.infrastructure.ExtensionsTestInfrastructureDiscoverer.loadExtensionsFromDescribers(ExtensionsTestInfrastructureDiscoverer.java:140) at org.mule.functional.junit4.infrastructure.ExtensionsTestInfrastructureDiscoverer.discoverExtensions(ExtensionsTestInfrastructureDiscoverer.java:88) at org.mule.functional.junit4.ExtensionFunctionalTestCase.createExtensionsManager(ExtensionFunctionalTestCase.java:102) at org.mule.functional.junit4.ExtensionFunctionalTestCase.access$000(ExtensionFunctionalTestCase.java:52) at org.mule.functional.junit4.ExtensionFunctionalTestCase$1.doConfigure(ExtensionFunctionalTestCase.java:88) at org.mule.runtime.core.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:39) ... 16 more Caused by: org.mule.runtime.module.artifact.classloader.exception.NotExportedClassException: Class 'org.mule.extension.http.api.request.client.HttpClient' not found in classloader for artifact 'mule'. at org.mule.runtime.module.artifact.classloader.FilteringArtifactClassLoader.loadClass(FilteringArtifactClassLoader.java:61) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.apache.commons.lang3.ClassUtils.getClass(ClassUtils.java:909) at org.mule.metadata.java.api.utils.JavaTypeUtils.getType(JavaTypeUtils.java:39) ... 46 more WARN 2016-08-30 11:08:46,600 [main] org.mule.tck.junit4.AbstractMuleTestCase: -------------------------------------------------------------------------------- Hung threads count: 1. Test case: org.mule.test.operation.HttpExtIntegrationTest. Thread names: -> Log4j2-AsyncLoggerConfig-2 - 15 --------------------------------------------------------------------------------{code} To try to workaround the issue, I edited the HttpConnector class, adding the HttpClient with the @Export annotation (making it visible in the plugin.properties as an exported package) but still got the same issue. Code of the Java test {code:java}import static org.junit.Assert.assertThat; import org.mule.functional.junit4.ExtensionFunctionalTestCase; import org.mule.runtime.core.api.MuleEvent; import org.hamcrest.core.Is; import org.junit.Test; public class HttpExtIntegrationTest extends ExtensionFunctionalTestCase { @Override protected String getConfigFile() { return "http-ext-integration-test.xml"; } @Override protected Class<?>[] getAnnotatedExtensionClasses() { return new Class<?>[] {org.mule.extension.http.internal.HttpConnector.class}; } @Test public void test() throws Exception { MuleEvent muleEvent = flowRunner("test").run(); assertThat(muleEvent.getMessage().getPayload(), Is.is("value1")); } }{code} Code of the http-ext-integration-text.xml {code:xml}<?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd"> <flow name="test"> <set-payload value="value1"/> </flow> </mule>{code} Dependencies for the test I needed: {code:xml} <dependency> <!--added this one due to MULE-10051--> <groupId>org.mule.modules</groupId> <artifactId>mule-module-http</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-module-http-ext</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-module-sockets</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency>{code}

    MuleSoft JIRA | 8 months ago | Lautaro Fernandez
    org.mule.runtime.core.api.config.ConfigurationException: Could not load class org.mule.extension.http.api.request.client.HttpClient (java.lang.IllegalArgumentException)

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Could not load class org.mule.extension.http.api.request.client.HttpClient

      at org.mule.metadata.java.api.utils.JavaTypeUtils.getType()
    2. org.mule.metadata
      JavaTypeUtils.getType
      1. org.mule.metadata.java.api.utils.JavaTypeUtils.getType(JavaTypeUtils.java:41)
      2. org.mule.metadata.java.api.utils.JavaTypeUtils.getType(JavaTypeUtils.java:25)
      2 frames
    3. org.mule.runtime
      ConnectionModelEnricher$1.onOperation
      1. org.mule.runtime.module.extension.internal.model.property.ConnectivityModelProperty.<init>(ConnectivityModelProperty.java:34)
      2. org.mule.runtime.module.extension.internal.introspection.enricher.ConnectionModelEnricher.addModelProperty(ConnectionModelEnricher.java:117)
      3. org.mule.runtime.module.extension.internal.introspection.enricher.ConnectionModelEnricher.access$000(ConnectionModelEnricher.java:46)
      4. org.mule.runtime.module.extension.internal.introspection.enricher.ConnectionModelEnricher$1.onOperation(ConnectionModelEnricher.java:70)
      4 frames