Ask Your Question
0

ODL controller build error: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils

asked 2015-05-20 03:30:34 -0700

eya.get gravatar image

Dear all,

I wanted to contribute on the development of the odl controller and I have cloned only the controller repo using ssh. But I couldn't manage to handle the error while building it with maven on Ubuntu 14.04 CLI. May Java version is 1.7.0_79 and maven version 3.3.3. Build fails on odl-model-project. Please have a look on the full error trace bellow:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:jar (default-jar) on project odl-model-project: Execution default-jar of goal org.apache.maven.plugins:maven-archetype-plugin:2.2:jar failed: A required class was missing while executing org.apache.maven.plugins:maven-archetype-plugin:2.2:jar: org/apache/commons/lang/StringUtils

With -X debugging, the trace is as follows:

at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:166) ... 21 more Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:165) at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:594) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:241) at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:116) at org.codehaus.plexus.velocity.DefaultVelocityComponent.initialize(DefaultVelocityComponent.java:95) at org.eclipse.sisu.plexus.PlexusLifecycleManager.initialize(PlexusLifecycleManager.java:308) at org.eclipse.sisu.plexus.PlexusLifecycleManager.activate(PlexusLifecycleManager.java:207) at org.eclipse.sisu.bean.BeanScheduler$Pending.activate(BeanScheduler.java:156) at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:185) at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126) at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68) at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68) at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:46) at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1009) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1059) at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1005) at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:36) at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81) at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51) at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263) at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:543) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121) ... 21 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) ... 44 more

Could you please point me out how to solve this error/bug? Please let me know if there is a workaround on this error.

Thank you,

edit retag flag offensive close merge delete

Comments

I have the same problem. I followed all the instructions on the wiki for setting up the development environment on Ubuntu 14.04, but somehow there is a problem with maven/java. In fact, when I just run "mvn archetype:generate" I get the java.lang.NoClassDefFound exception.

Chris Lauwers ( 2015-05-20 14:21:14 -0700 )edit

I figured out that the problem is related to maven-archetype-plugin. It is defined on pom.xml but it is not getting downloaded while building the project. I don't know why.

eya.get ( 2015-05-20 14:27:49 -0700 )edit

Hi, I am facing a similar problem. Can you share if you moved ahead with this error. I found a link to a probable solution-> http://stackoverflow.com/questions/28167020/noclassdeffounderror-org-apache-commons-lang-stringutils

sidhant13 ( 2015-05-21 00:15:29 -0700 )edit

Thanks sidhant13 for your input. Adding the following dependency in file ~/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin/2.2/maven-archetype-plugin-2.2.pom solves the problem for me. <dependency> <groupid>commons-lang</groupid> <artifactid>commons-lang</artifactid> <version>2.3</version> </dependency> It might not be a permanent solution though.

eya.get ( 2015-05-21 11:01:39 -0700 )edit

4 answers

Sort by ยป oldest newest most voted
0

answered 2015-05-20 03:54:56 -0700

Check this wiki: https://wiki.opendaylight.org/view/InstallOnUbuntu_14.04 . This may help you.

edit flag offensive delete publish link more

Comments

Hi Subhash, thank you for the reply. I followed all the steps, but it doesn't work. There is no problem with the integration project. The problem is on the controller project. I have been trying to build only the controller repo, i.e., git clone https://git.opendaylight.org/gerrit/p/controller.git. JDK and Maven are correctly installed. But build fails at odl-model-project

eya.get ( 2015-05-20 04:12:39 -0700 )edit
0

answered 2015-05-21 10:11:09 -0700

eya.get gravatar image

updated 2015-05-23 21:59:16 -0700

Adding the following dependency in file ~/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin/2.2/maven-archetype-plugin-2.2.pom solves the problem for me.

<dependency> <groupid>commons-lang</groupid> <artifactid>commons-lang</artifactid> <version>2.3</version>
</dependency>

It might not be a permanent solution though.

edit flag offensive delete publish link more

Comments

Thanks. It worked but guess the comment here is formatted such that inline Uppercase characters are converted to lowercase, and in pasting the above dependency to pom file gives a null dependency error. So i in groupid and artifactid have to be in uppercase.

sidhant13 ( 2015-05-22 05:34:46 -0700 )edit

you are right, but I don't know why this editor converts all inline Uppercase characters to lower case.

eya.get ( 2015-05-23 21:57:44 -0700 )edit

It worked fine also for me! Thanks

mattedallo ( 2015-06-03 06:18:39 -0700 )edit
0

answered 2015-05-21 15:10:12 -0700

I had a similar problem trying to run the MD-SAL example described in https://wiki.opendaylight.org/view/OpenDaylightController:MD-SAL:StartupProject_Archetype

I got the StringUtils exception when running the "mvn archetype:generate" command shown in the example. I finally got this to work as follows:

  1. delete the entire ~/.m2/repository
  2. delete ~/.m2/settings.xml
  3. run the mvn archetype:generate command (with the arguments listed on the wiki). This now succeeds without problems
  4. create ~/.m2/settings.xml based on the instructions from the "setting up your dev environment" section on the wiki
  5. run "mvn clean install"

From this, I surmise that there might be a discrepancy between the repos in repo.maven.apache.org and nexus.opendaylight.org

edit flag offensive delete publish link more

Comments

This worked fine for me as well. Thanks.

pbraun ( 2015-06-05 05:12:00 -0700 )edit
0

answered 2015-05-22 17:06:15 -0700

Bruno Lopes gravatar image

You can try the solution of this post https://ask.opendaylight.org/question/3816/odl-conntroller-build-error-execution-default-jar-of-goal-orgapachemavenpluginsmaven-archetype-plugin22jar-failed/ . This worked with me.

edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
3 followers

Stats

Asked: 2015-05-20 03:30:34 -0700

Seen: 1,554 times

Last updated: May 23 '15