I am new on Mule and Anypoint Studio and want to deploy a project. When I run it I get exceptions that might get caused by a jar dependency called wrapper for Mapping the java classes that says could not be found, how do I have to install this dependency? And if it is not the dependency then how to fix it? I don't know what to do at this point so I appreciate any answer.
I get the following exceptions when I try to run and compile the project:
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [net.inspira.api.transformers.json.ObjectToJsonMapper] for bean with name 'JsonMapper' defined in class path resource [spring/config-beans.xml]; nested exception is org.mule.runtime.module.artifact.api.classloader.exception.CompositeClassNotFoundException: Cannot load class 'net.inspira.api.transformers.json.ObjectToJsonMapper': [
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' has no package mapping for region 'domain/default/app/mambo-supply'.,
Cannot load class 'net.inspira.api.transformers.json.ObjectToJsonMapper': [
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' has no package mapping for region '/domain/default'.,
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' not found in classloader for artifact 'container'.]]
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1391) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:641) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1490) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1013) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:741) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.3.21.jar:5.3.21]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.3.21.jar:5.3.21]
at org.mule.extension.spring.api.SpringConfig.lambda$configure$0(SpringConfig.java:63) ~[?:?]
at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:265) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:1032) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:970) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.extension.spring.api.SpringConfig.configure(SpringConfig.java:58) ~[?:?]
at org.mule.runtime.config.internal.MuleArtifactContext.prepareObjectProviders(MuleArtifactContext.java:311) ~[mule-module-spring-config-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.config.internal.MuleArtifactContext.prepareBeanFactory(MuleArtifactContext.java:303) ~[mule-module-spring-config-4.4.0-20220824.jar:4.4.0-20220824]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) ~[spring-context-5.3.21.jar:5.3.21]
at org.mule.runtime.config.internal.SpringRegistry.doInitialise(SpringRegistry.java:102) ~[mule-module-spring-config-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.registry.AbstractRegistry.initialise(AbstractRegistry.java:94) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:111) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:73) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:69) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.privileged.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:132) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.internal.context.DefaultMuleContext.initialise(DefaultMuleContext.java:352) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:177) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:60) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.artifact.ArtifactContextBuilder.lambda$build$1(ArtifactContextBuilder.java:485) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:224) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:1075) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:993) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.artifact.ArtifactContextBuilder.build(ArtifactContextBuilder.java:397) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.application.DefaultMuleApplication.doInit(DefaultMuleApplication.java:237) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.application.DefaultMuleApplication.init(DefaultMuleApplication.java:206) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:265) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:1032) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:970) ~[mule-core-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.artifact.DeployableArtifactWrapper.executeWithinArtifactClassLoader(DeployableArtifactWrapper.java:146) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.impl.internal.artifact.DeployableArtifactWrapper.init(DeployableArtifactWrapper.java:89) ~[mule-module-deployment-model-impl-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArtifactDeployer.doInit(DefaultArtifactDeployer.java:133) ~[mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:60) ~[mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:481) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:470) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.internalDeployPackagedArtifact(DefaultArchiveDeployer.java:578) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployOrRedeployPackagedArtifact(DefaultArchiveDeployer.java:543) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployPackagedArtifact(DefaultArchiveDeployer.java:387) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployPackagedArtifact(DefaultArchiveDeployer.java:53) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.deployPackedApps(DeploymentDirectoryWatcher.java:240) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.run(DeploymentDirectoryWatcher.java:311) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.start(DeploymentDirectoryWatcher.java:151) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.deployment.internal.MuleDeploymentService.start(MuleDeploymentService.java:156) [mule-module-deployment-4.4.0-20220824.jar:4.4.0-20220824]
at org.mule.runtime.module.launcher.MuleContainer.start(MuleContainer.java:256) [mule-module-launcher-4.4.0-20220824.jar:4.4.0-20220824]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_332]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_332]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_332]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_332]
at org.mule.runtime.module.reboot.internal.MuleContainerWrapper.start(MuleContainerWrapper.java:53) [mule-module-boot-ee-4.4.0-20220824.jar:4.4.0-20220824]
at org.tanukisoftware.wrapper.WrapperManager$11.run(WrapperManager.java:4537) [wrapper-3.5.50.jar:3.5.50]
Caused by: org.mule.runtime.module.artifact.api.classloader.exception.CompositeClassNotFoundException: Cannot load class 'net.inspira.api.transformers.json.ObjectToJsonMapper': [
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' has no package mapping for region 'domain/default/app/mambo-supply'.,
Cannot load class 'net.inspira.api.transformers.json.ObjectToJsonMapper': [
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' has no package mapping for region '/domain/default'.,
Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' not found in classloader for artifact 'container'.]]
Caused by: org.mule.runtime.module.artifact.api.classloader.exception.ClassNotFoundInRegionException: Class 'net.inspira.api.transformers.json.ObjectToJsonMapper' has no package mapping for region 'domain/default/app/mambo-supply'.
My pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.grupoareas</groupId>
<artifactId>mambo-supply-2017</artifactId>
<version>4.0.0-M4</version>
<packaging>mule-application</packaging>
<name>mambo-supply</name>
<description>Application migrated with MMA</description>
<properties>
<mule.tools.version>1.1</mule.tools.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<mule.version>3.8.4</mule.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<munit.version>2.2.5</munit.version>
</properties>
<dependencies>
<dependency>
<groupId>com.cloveretl</groupId>
<artifactId>cloveretl-engine</artifactId>
<version>3.8.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.inspira.api</groupId>
<artifactId>api-transformers</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency>
<dependency>
<groupId>com.mulesoft.modules</groupId>
<artifactId>mule-secure-configuration-property-module</artifactId>
<version>1.2.2</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.module</groupId>
<artifactId>mule-java-module</artifactId>
<version>1.2.6</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>com.mulesoft.mule.modules</groupId>
<artifactId>mule-compatibility-module</artifactId>
<version>1.4.0</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-db-connector</artifactId>
<version>1.8.1</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-scripting-module</artifactId>
<version>1.1.7</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-json-module</artifactId>
<version>2.1.3</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>com.mulesoft.munit</groupId>
<artifactId>munit-runner</artifactId>
<version>2.2.5</version>
<classifier>mule-plugin</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.munit</groupId>
<artifactId>munit-tools</artifactId>
<version>2.2.5</version>
<classifier>mule-plugin</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-spring-module</artifactId>
<version>1.3.3</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.17.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.17.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.17.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.3.17.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-http-connector</artifactId>
<version>1.4.2</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-objectstore-connector</artifactId>
<version>1.2.1</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-apikit-module</artifactId>
<version>1.5.1</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Central</id>
<name>Central</name>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
</repository>
<repository>
<id>anypoint-exchange</id>
<name>Anypoint Exchange</name>
<url>https://maven.anypoint.mulesoft.com/api/v1/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>mulesoft-release</id>
<name>mulesoft release repository</name>
<url>https://repository.mulesoft.org/releases/</url>
</pluginRepository>
</pluginRepositories>
<build>
<testResources>
<testResource>
<directory>src/test/munit</directory>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>project</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-clover-plugins</id>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>com.cloveretl</groupId>
<artifactId>cloveretl-engine</artifactId>
<version>3.8.4</version>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<unzip dest="${project.build.testOutputDirectory}" src="${project.build.testOutputDirectory}/cloveretl-engine.zip"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mulesoft.munit.tools</groupId>
<artifactId>munit-maven-plugin</artifactId>
<version>2.2.5</version>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<coverage>
<runCoverage>true</runCoverage>
<formats>
<format>html</format>
</formats>
</coverage>
</configuration>
</plugin>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>3.5.1</version>
<extensions>true</extensions>
<configuration>
<sharedLibraries>
<sharedLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</sharedLibrary>
<sharedLibrary>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</sharedLibrary>
</sharedLibraries>
<classifier>mule-application</classifier>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerArgs>
<args>-parameters</args>
</compilerArgs>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
The error is related to the class net.inspira.api.transformers.json.ObjectToJsonMapper
. This class seems to be coming from artifact net.inspira.api:api-transformers:2.0.0
. Since a quick search in Maven Central founds nothing related to that, I'll assume it is a proprietary library that your company uses. You would need to ask inside where it comes and how to install it.
Having said that, if there was no Maven error at built time, the dependency has been accessible to the build and the issue may be that the application can not see it because of Mule 4 classloader isolation. Try adding a Shared Library entry to the pom to make it visible. Example:
<sharedLibrary>
<groupId>net.inspira.api</groupId>
<artifactId>api-transformers</artifactId>
</sharedLibrary>
Put it with the other similar entries.
As a side note, this application seems to have been migrated from Mule 3 using the Mule Migration Assistant tool. Such migrations are not fully automated and required developers familiar with Mule 3 and Mule 4 to complete them. If you are new to Mule and the migration is not complete it may be extra hard for you to make it work.