linux中使用java -cp 使用通配符 执行主类的main方法出现异常

风儿刮来一座山 发布于 2016/09/13 17:57
阅读 870
收藏 0

java -cp 我把所有引用到的jar包一个个罗列出来能启动成功,但是使用通配符就出现异常。异常信息如下


java -cp .:./lib/*: XXX.XXXX.XXXX.XXXX
Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.resolveTypeArguments(Ljava/lang/Class;Ljava/lang/Class;)[Ljava/lang/Class;
        at org.springframework.core.convert.support.GenericConversionService.getRequiredTypeInfo(GenericConversionService.java:260)
        at org.springframework.core.convert.support.GenericConversionService.addConverter(GenericConversionService.java:83)
        at org.springframework.core.convert.support.DefaultConversionService.addScalarConverters(DefaultConversionService.java:63)
        at org.springframework.core.convert.support.DefaultConversionService.addDefaultConverters(DefaultConversionService.java:54)
        at org.springframework.core.convert.support.DefaultConversionService.<init>(DefaultConversionService.java:43)
        at org.springframework.core.env.AbstractPropertyResolver.<init>(AbstractPropertyResolver.java:41)
        at org.springframework.core.env.PropertySourcesPropertyResolver.<init>(PropertySourcesPropertyResolver.java:41)
        at org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:112)
        at org.springframework.core.env.StandardEnvironment.<init>(StandardEnvironment.java:54)
        at org.springframework.context.support.AbstractApplicationContext.createEnvironment(AbstractApplicationContext.java:442)
        at org.springframework.context.support.AbstractApplicationContext.getEnvironment(AbstractApplicationContext.java:288)
        at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.resolvePath(AbstractRefreshableConfigApplicationContext.java:122)
        at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.setConfigLocations(AbstractRefreshableConfigApplicationContext.java:80)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:137)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
        at XXX.XXXX.XXXX.XXXX.main(XXXX.java:14)

}

请问是使用通配符有问题吗,网上找了各种解决办法都不对,请大神解答


加载中
0
holo
holo

不支持通配符。。。

写个shell脚本好,循环列出来所有的jar,然后 java -cp a.jar:b.jar:c.jar 好了,只能这样。

返回顶部
顶部