0

I have a jar locator1.1. On extracting the jar I can see the lib folder containing all the required jars. I also have the applicationContext-locator.xml in the locator1.1 folder.

The Manifest file shows

    Manifest-Version: 1.0
    Archiver-Version: Plexus Archiver
    Created-By: Apache Maven
    Built-By: abc
    Build-Jdk: 1.7.0_55
    Main-Class: com.abc.Locator
    Class-Path: ./ lib/activemq-all-5.8.0.jar lib/activemq-amqp-5.8.0.jar 
     lib/activemq-broker-5.8.0.jar lib/activemq-openwire-legacy-5.8.0.jar 
     lib/proton-jms-0.3.0-fuse-2.jar lib/proton-0.3.0-fuse-2.jar lib/proto....
     lib/spring-core-3.2......
 .4.RELEASE.jar lib/commons-logging-1.1.1.jar lib/spring-jmx-2.0.8.jar
  lib/spring-context-3.2.4.RELEASE.jar lib/spring-expression-3.2.4.REL

But on running the jar using java -jar locator1.1.jar. I am getting the following error. But all the required spring jars are there in the lib

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/ConfigurableApplicationContext
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ConfigurableApplicationContext
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 6 more
likeGreen
  • 1,001
  • 1
  • 20
  • 40
  • possible duplicate of [How to put all required jars in a lib folder inside the final jar with Maven ?](http://stackoverflow.com/questions/11758594/how-to-put-all-required-jars-in-a-lib-folder-inside-the-final-jar-with-maven) –  Nov 28 '14 at 18:19
  • @RC. the correct answer marked in the link suggests that it is not possible to do so "i found out that this is not workable solution because the class loader doesn't load jars from within jars" Is that what you suggest. – likeGreen Nov 28 '14 at 18:40

0 Answers0