Resolve ActiveMQConnectionFactory class not found exception

0Shares

If you encounter the following error while running the mule application, the reason is it is looking for activemq supporting classes in your project and it is not finding it.  Those classes are available in activemq-all-x.xx.xx.jar file (Add activemq-all-x.xx.jar file if your flow is very simple. Otherwise, you may want to check whatever relevant jar files have to be added as a dependency to your project.) that is available in the root folder where you have unzipped the activemq zip file.

+ Failed to deploy artifact 'activemqpublisher', see below +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
org.mule.module.launcher.DeploymentStartException: ClassNotFoundException: org.apache.activemq.ActiveMQConnectionFactory
at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:164) ~[mule-module-launcher-3.8.0.jar:3.8.0]
at org.mule.module.launcher.artifact.ArtifactWrapper$4.execute(ArtifactWrapper.java:105) ~[mule-module-launcher-3.8.0.jar:3.8.0]
at org.mule.module.launcher.artifact.ArtifactWrapper.executeWithinArtifactClassLoader(ArtifactWrapper.java:136) ~[mule-module-launcher-3.8.0.jar:3.8.0]
at org.mule.module.launcher.artifact.ArtifactWrapper.start(ArtifactWrapper.java:100) ~[mule-module-launcher-3.8.0.jar:3.8.0]
at org.mule.module.launcher.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:26) ~[mule-module-launcher-3.8.0.jar:3.8.0]
at org.mule.module.launcher.DefaultArchiveDeployer.redeploy(DefaultArchiveDeployer.java:544) ~[mule-module-launcher-3.8.0.jar:3.8.0]
at org.mule.module.launcher.DeploymentDirectoryWatcher.redeployModifiedArtifacts(DeploymentDirectoryWatcher.java:555) ~[mule-module-launcher-3.8.0.jar:3.8.0]
at org.mule.module.launcher.DeploymentDirectoryWatcher.redeployModifiedApplications(DeploymentDirectoryWatcher.java:532) ~[mule-module-launcher-3.8.0.jar:3.8.0]
at org.mule.module.launcher.DeploymentDirectoryWatcher.run(DeploymentDirectoryWatcher.java:348) ~[mule-module-launcher-3.8.0.jar:3.8.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_74]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) ~[?:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_74]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[?:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_74]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_74]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_74]
Caused by: org.mule.retry.RetryPolicyExhaustedException: org.apache.activemq.ActiveMQConnectionFactory (java.lang.ClassNotFoundException)

the reason should be one of the following based on how you have built the application:

If your application is mavenized, then go to POM file and add the following dependency:

<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>5.14.0</version>
</dependency>

 

If your application is not mavenized, then right click on your project and click on “Properties” and in the properties window, click/select “Java Build Path” and select the tab “Libraries” and click on the button “Add external JARS..” and select file “activemq-all-x.xx.x,jar” which will be available in the root folder of the apache-activemq folder.

0Shares