java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils from BaseClassLoader
Asked Answered
T

6

19

I am getting the following error, while running my following code:

java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils from BaseClassLoader

at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.dozer.util.ResourceLoader.getResource(ResourceLoader.java:53)
at org.dozer.util.DefaultClassLoader.loadResource(DefaultClassLoader.java:44)
at org.dozer.config.GlobalSettings.loadGlobalSettings(GlobalSettings.java:116)
at org.dozer.config.GlobalSettings.<init>(GlobalSettings.java:67)
at org.dozer.config.GlobalSettings.<clinit>(GlobalSettings.java:46)
at org.dozer.stats.StatisticsManagerImpl.<init>(StatisticsManagerImpl.java:39)
at org.dozer.stats.GlobalStatistics.<init>(GlobalStatistics.java:29)
at org.dozer.stats.GlobalStatistics.<clinit>(GlobalStatistics.java:24)
at org.dozer.DozerBeanMapper.<clinit>(DozerBeanMapper.java:59)

Kindly, guide me to fix the problems.

Tissue answered 22/7, 2013 at 7:7 Comment(1)
B
7

Your code seems to be using apace-commons-lang package . Do add the jar from here http://mvnrepository.com/artifact/commons-lang/commons-lang/2.6. Chek for the version you are using. Add the jar to your lib folder/classpath.

Bohannan answered 22/7, 2013 at 7:14 Comment(0)
N
16

I received the same error, I added to my pom.xml file the following lines and worked fine after maven install:

<dependencies>

        <!-- commons lang dependency -->
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>

</dependencies> 
Ninety answered 25/9, 2013 at 7:18 Comment(2)
In my situation, my pom.xml already has commons-lang dependency, but the tomcat server in Eclipse still fails to start. I checked the "tomcat server's lib directory" and found no dozer jar there. So I copy a dozer jar from .m2 directory to there, and the problem solved.Steel
for sbt use: libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.4"Alysiaalyson
B
10

In case you use maven and Ubuntu 14.04:

This can be caused by the maven version included in Ubuntu 14.04, and the workaround is to download the maven tarball from http://maven.apache.org/download.cgi and use that version instead of the default version provided by the distribution.

More information: https://github.com/airbnb/chronos/issues/211

EDIT: You can also add a symlink to commons-lang.jar to avoid having to do a custom install (Source and @Shoham in the comments)

cd /usr/share/maven/lib
sudo ln -s ../../java/commons-lang.jar .

Verify that the paths are correct on your system before attempting. They should work for Ubuntu 14.04 OOTB, but always verify.

Baily answered 21/7, 2014 at 12:44 Comment(2)
Thanks! Can also be fixed by 'cd /usr/share/maven/lib sudo ln -s ../../java/commons-lang.jar .'Carrissa
Wasted hours trying to fix all sorts of maven problems. Finally saw this answer. Removed my ~/.m2 directory, removed Ubuntu's mvn that I had installed via apt and then installed mvn afresh from mvn.apache.org. Everything works now!Erysipeloid
B
7

Your code seems to be using apace-commons-lang package . Do add the jar from here http://mvnrepository.com/artifact/commons-lang/commons-lang/2.6. Chek for the version you are using. Add the jar to your lib folder/classpath.

Bohannan answered 22/7, 2013 at 7:14 Comment(0)
L
3

Add the commons-lang jar either into WEB-INF/lib or server/lib

Lark answered 22/7, 2013 at 8:39 Comment(0)
A
1

include commons-lang-<version>.jar in your classpath

Archie answered 22/7, 2013 at 7:28 Comment(2)
Hi,I have added commons-lang3-3.1, and Dozer jars to class path. But i'm still getting below exception: 15:22:52,730 SEVERE [ContainerResponse] The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container java.lang.NoClassDefFoundError: Could not initialize class org.dozer.DozerBeanMapper at com.ingenico.atlas.b2b.helper.DozerHelper.map(DozerHelper.java:13)Tissue
@AmitKumar Looks like you are missing something on the classpath. Seems a dependency of com.ingenico.atlas.b2b.helper.DozerHelper.map is missing, class org.dozer.DozerBeanMapperArchie
P
1

I faced the same issue in latest version of IntelliJ Community Edition (idea-IC-13.224.1 or version 14) along with apache-maven 3.2.3.

Adding missing jar (commons-lang-2.6.jar) in $IDEA_HOME/plugins/maven/lib/maven3 folder seems to fix it.

Protist answered 24/11, 2014 at 12:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.