如何使包含外部罐子的弹簧maven项目罐工作

时间:2014-11-28 02:43:36

标签: java spring maven jar

我有一个罐子locator1.1。在解压缩jar时,我可以看到包含所有必需jar的lib文件夹。我在locator1.1文件夹中也有applicationContext-locator.xml

清单文件显示

    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

但是在使用java -jar locator1.1.jar运行jar时。我收到以下错误。但是所有必需的弹簧罐都在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

0 个答案:

没有答案