When trying to connect to the Artemis server using the MuleSoft JMS connector and the test connection is not working and throws the error "Test connection failed" as demonstrated in the screenshot below.
On deploying the application locally in the MuleSoft AnyPoint Studio, you see the below logs:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Disposing application 'jms-test' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ERROR 2022-06-22 13:08:56,905 [WrapperListener_start_runner] [processor: ; event: ] org.mule.runtime.module.deployment.impl.internal.application.DefaultMuleApplication: Cannot instantiate class: org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
org.mule.runtime.module.artifact.api.classloader.exception.ClassNotFoundInRegionException: Class 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory' has no package mapping for region 'domain/default/app/jms-test'.
INFO 2022-06-22 13:08:56,913 [WrapperListener_start_runner] [processor: ; event: ] org.mule.runtime.module.deployment.impl.internal.artifact.AbstractDeployableArtifact: Application 'jms-test' never started, nothing to dispose of
INFO 2022-06-22 13:08:57,344 [WrapperListener_start_runner] org.mule.runtime.core.internal.logging.LogUtil:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Failed to deploy artifact 'jms-test', +
+ org.mule.runtime.deployment.model.api.DeploymentInitException: +
+ ClassNotFoundInRegionException: Class +
+ 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory' has no +
+ package mapping for region 'domain/default/app/jms-test'. +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ERROR 2022-06-22 13:08:57,345 [WrapperListener_start_runner] org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer: Failed to deploy artifact [jms-test]
org.mule.runtime.deployment.model.api.DeploymentException: Failed to deploy artifact [jms-test]
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: org.mule.runtime.deployment.model.api.DeploymentInitException: ClassNotFoundInRegionException: Class 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory' has no package mapping for region 'domain/default/app/jms-test'.
Caused by: org.mule.runtime.deployment.model.api.DeploymentInitException: ClassNotFoundInRegionException: Class 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory' has no package mapping for region 'domain/default/app/jms-test'.
Caused by: org.mule.runtime.core.api.config.ConfigurationException: Cannot instantiate class: org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
Caused by: org.mule.runtime.api.lifecycle.InitialisationException: Cannot instantiate class: org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
Caused by: org.mule.runtime.api.lifecycle.InitialisationException: Cannot instantiate class: org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:685) ~[?:1.8.0_322]
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) ~[?:1.8.0_322]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_322]
at org.mule.runtime.module.reboot.internal.MuleContainerWrapper.start(MuleContainerWrapper.java:53) [mule-module-boot-ee-4.4.0-20220221.jar:4.4.0-20220221]
at org.tanukisoftware.wrapper.WrapperManager$11.run(WrapperManager.java:4514) [wrapper-3.5.45.jar:3.5.45]
Caused by: org.mule.runtime.module.artifact.api.classloader.exception.CompositeClassNotFoundException: Cannot load class 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory': [
Class 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory' has no package mapping for region 'domain/default/app/jms-test'.,
Cannot load class 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory': [
Class 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory' has no package mapping for region '/domain/default'.,
Class 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory' not found in classloader for artifact 'container'.]]
Caused by: org.mule.runtime.module.artifact.api.classloader.exception.ClassNotFoundInRegionException: Class 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory' has no package mapping for region 'domain/default/app/jms-test'.
INFO 2022-06-22 13:08:57,387 [WrapperListener_start_runner] org.mule.runtime.core.internal.logging.LogUtil:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Mule is up and kicking (every 5000ms) +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2022-06-22 13:08:57,424 [WrapperListener_start_runner] org.eclipse.jetty.server.AbstractConnector: Started ServerConnector@1d554944{HTTP/1.1, (http/1.1)}{127.0.0.1:53212}
INFO 2022-06-22 13:08:57,427 [WrapperListener_start_runner] org.mule.runtime.core.internal.logging.LogUtil:
**********************************************************************
* - - + DOMAIN + - - * - - + STATUS + - - *
**********************************************************************
* default * DEPLOYED *
**********************************************************************
*******************************************************************************************************
* - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - *
*******************************************************************************************************
* jms-test * default * FAILED *
*******************************************************************************************************When trying to connect to Artemis' server with the JMS Connector using MuleSoft and seeing errors such as "has no package mapping for region", one of the plausible reasons could be that you don't have the required dependencies present in the project's pom.xml file.
Please add the following dependency in the <sharedLibraries> </sharedLibraries> section of the pom.xml file
<sharedLibrary> <groupId>org.apache.activemq</groupId> <artifactId>artemis-jms-client-all</artifactId> </sharedLibrary>
and the below dependency in the <dependencies> </dependencies> section of the same project's pom.xml file.
<dependency> <groupId>org.apache.activemq</groupId> <artifactId>artemis-jms-client-all</artifactId> <version>2.10.1</version> </dependency>
Please make sure to check with your Artemis team on the version you should be using for the "artemis-jms-client-all" dependency.
Disclaimer: This article involves products and technologies which do not form part of the MuleSoft product set. Technical assistance for such products is limited to this article.
001118988

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.