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 | 3 months ago
  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 | 3 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)
  2. 0

    error creating client bean

    GitHub | 1 year ago | sufyanshoaib
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'paymentRequestClient': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Class' for property 'clientInterface'; nested exception is java.lang.IllegalArgumentException: Could not load class []!
  3. 0

    CxfClientGrailsPlugin - Web service client abcClient cannot be created before setting the clientInterface=[:] and serviceEndpointAddress

    Stack Overflow | 1 year ago | sufyan.shoaib
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'paymentRequestClient': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Class' for property 'clientInterface'; nested exception is java.lang.IllegalArgumentException: Could not load class []!
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Could not load JDBC driver class [com.microsoft.sqlserver.jdbc.SQLServerDriver] for ODI

    Oracle Community | 3 years ago | user7374943
    java.lang.RuntimeException: java.lang.IllegalArgumentException: Could not load JDBC driver class [com.microsoft.sqlserver.jdbc.SQLServerDriver]
  6. 0

    ODI 12.2.1: Excel technology - getting java.lang.IllegalArgumentException: Could not load JDBC driver class [sun.jdbc.odbc.JdbcOdbcDriver]

    Oracle Community | 12 months ago | jkoradba
    java.lang.RuntimeException: java.lang.IllegalArgumentException: Could not load JDBC driver class [sun.jdbc.odbc.JdbcOdbcDriver]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    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