9/08/2015

Starting Karaf 4 results in java.lang.ClassNotFoundException: org.apache.karaf.main.Main

When you try to start Karaf and you'll get

#dell:apache-karaf-4.0.1 doma$ bin/karaf 
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/karaf/main/Main
Caused by: java.lang.ClassNotFoundException: org.apache.karaf.main.Main
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

...there's a good chance that it is caused by an incorrect KARAF_HOME:

#dell:apache-karaf-4.0.1 doma$ bin/karaf 
Error: Could not find or load main class org.apache.karaf.main.Main
#dell:apache-karaf-4.0.1 doma$ set | grep KARAF
KARAF_HOME=/opt/karaf
#dell:apache-karaf-4.0.1 doma$ unset KARAF_HOME
#dell:apache-karaf-4.0.1 doma$ set | grep KARAF
_=KARAF_HOME
#dell:apache-karaf-4.0.1 doma$ bin/karaf 
        __ __                  ____      
       / //_/____ __________ _/ __/      
      / ,<  / __ `/ ___/ __ `/ /_        
     / /| |/ /_/ / /  / /_/ / __/        
    /_/ |_|\__,_/_/   \__,_/_/         

  Apache Karaf (4.0.1)

Hit '' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '' or type 'system:shutdown' or 'logout' to shutdown Karaf.

karaf@root()>

No comments:

Post a Comment