DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Mule ESB and the NoSuchMethodError: org.mule.util.ClassUtils.getClass exception

Mule ESB and the NoSuchMethodError: org.mule.util.ClassUtils.getClass exception

$$anonymous$$ user avatar by
$$anonymous$$
·
Jan. 29, 13 · Interview
Like (0)
Save
Tweet
Share
5.09K Views

Join the DZone community and get the full member experience.

Join For Free
Currently I am adding some SAML related functionality to a Mule3 implementation of one of our clients. To work with the SAML objects I make use of the OpenSAML library that is provided here as open source.

I added the following dependencies to my pom.xml to make it work:

<!-- SAML dependencies -->
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml</artifactId>
  <version>2.5.1-1</version>
</dependency>
<dependency>
  <groupId>joda-time</groupId>
  <artifactId>joda-time</artifactId>
  <version>2.1</version>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>openws</artifactId>
  <version>1.4.2-1</version>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>xmltooling</artifactId>
  <version>1.3.2-1</version>
  <exclusions>
    <exclusion>
      <artifactId>log4j-over-slf4j</artifactId>
      <groupId>org.slf4j</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
  <version>1.7.2</version>
</dependency>

However, after adding these dependencies and running a test with the Mule instance I received this exception:

java.lang.NoSuchMethodError: org.mule.util.ClassUtils.getClass(Ljava/lang/String;Z)Ljava/lang/Class;
at org.mule.util.ClassUtils.initializeClass(ClassUtils.java:356)
at org.mule.lifecycle.NotificationLifecycleObject.(NotificationLifecycleObject.java:45)
at org.mule.lifecycle.phases.MuleContextStopPhase.(MuleContextStopPhase.java:66)
at org.mule.lifecycle.phases.MuleContextStopPhase.(MuleContextStopPhase.java:56)
at org.mule.lifecycle.RegistryBrokerLifecycleManager.registerPhases(RegistryBrokerLifecycleManager.java:43)
at org.mule.lifecycle.RegistryLifecycleManager.(RegistryLifecycleManager.java:57)
at org.mule.lifecycle.RegistryBrokerLifecycleManager.(RegistryBrokerLifecycleManager.java:33)
at org.mule.registry.AbstractRegistryBroker.(AbstractRegistryBroker.java:37)
at org.mule.registry.DefaultRegistryBroker.(DefaultRegistryBroker.java:27)
at org.mule.DefaultMuleContext.createRegistryBroker(DefaultMuleContext.java:159)
at org.mule.DefaultMuleContext.(DefaultMuleContext.java:150)
at org.mule.context.DefaultMuleContextBuilder.buildMuleContext(DefaultMuleContextBuilder.java:89)
at org.mule.context.DefaultMuleContextFactory.buildMuleContext(DefaultMuleContextFactory.java:199)
at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:189)
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:75)
at org.mule.tck.AbstractMuleTestCase.createMuleContext(AbstractMuleTestCase.java:520)
at org.mule.tck.AbstractMuleTestCase.setUp(AbstractMuleTestCase.java:446)
at junit.framework.TestCase.runBare(TestCase.java:132)
at org.mule.tck.AbstractMuleTestCase.runBare(AbstractMuleTestCase.java:301)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at org.mule.tck.AbstractMuleTestCase.run(AbstractMuleTestCase.java:280)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)


Which was weird because I wouldn’t expect OpenSAML libraries to influence the org.mule.util package! After googling around I discovered that the exception is caused when an older version of Apache commons-lang is being put on the classpath. So by excluding this dependency from the project the issue was fixed:

<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml</artifactId>
  <version>2.5.1-1</version>
  <exclusions>
    <exclusion>
      <artifactId>commons-lang</artifactId>
      <groupId>commons-lang</groupId>
    </exclusion>
  </exclusions>
</dependency>

Just too bad that the message looks like to suggest there is something wrong with the Mule libraries. With this exclusion in place the ‘commons-lang-2.1.jar’ is not added to the classpath but the ‘commons-lang-2.4.jar’ which is expected by Mule to be available.

Enterprise service bus

Published at DZone with permission of $$anonymous$$. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Securing VMs, Hosts, Kubernetes, and Cloud Services
  • Writing a Modern HTTP(S) Tunnel in Rust
  • SAST: How Code Analysis Tools Look for Security Flaws
  • Why Open Source Is Much More Than Just a Free Tier

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: