2017-05-26 134 views
0

我有作爲java應用程序運行時正常工作的spring引導應用程序。Guava在websphere中部署spring引導應用程序的問題

現在我跟着從以下網址步驟,並試圖部署到WebSphere: How to deploy Spring Boot application in IBM Liberty and WAS 8.5

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: com/google/common/collect/Lists.reverse(Ljava/util/List;)Ljava/util/List; (loaded from file:/C:/Users/IBM_ADMIN/Downloads/spring-tool-suite-3.8.3.RELEASE-e4.6.2-win32-x86_64/sts-bundle/WLP/usr/servers/defaultServer/apps/expanded/wps-source-document-0.0.1-SNAPSHOT.war/WEB-INF/lib/google-collections-1.0.jar by [email protected]) called from class springfox.documentation.spring.web.ObjectMapperConfigurer (loaded from file:/C:/Users/IBM_ADMIN/Downloads/spring-tool-suite-3.8.3.RELEASE-e4.6.2-win32-x86_64/sts-bundle/WLP/usr/servers/defaultServer/apps/expanded/wps-source-document-0.0.1-SNAPSHOT.war/WEB-INF/lib/springfox-spring-web-2.7.0.jar by [email protected]). 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:86) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169) [spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:2523) [com.ibm.ws.webcontainer_1.1.16.jar:na] 
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1054) [com.ibm.ws.webcontainer_1.1.16.jar:na] 
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6565) [com.ibm.ws.webcontainer_1.1.16.jar:na] 
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:468) [com.ibm.ws.webcontainer_1.1.16.jar:na] 
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:463) [com.ibm.ws.webcontainer_1.1.16.jar:na] 
at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1051) [com.ibm.ws.webcontainer_1.1.16.jar:na] 
at com.ibm.ws.webcontainer.osgi.WebContainer.access$000(WebContainer.java:104) [com.ibm.ws.webcontainer_1.1.16.jar:na] 
at com.ibm.ws.webcontainer.osgi.WebContainer$2.run(WebContainer.java:870) [com.ibm.ws.webcontainer_1.1.16.jar:na] 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:522) [na:1.8.0] 
at java.util.concurrent.FutureTask.run(FutureTask.java:277) [na:1.8.0] 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153) [na:1.8.0] 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [na:1.8.0] 
at java.lang.Thread.run(Thread.java:785) [na:1.8.0] 
Caused by: java.lang.NoSuchMethodError: com/google/common/collect/Lists.reverse(Ljava/util/List;)Ljava/util/List; (loaded from file:/C:/Users/IBM_ADMIN/Downloads/spring-tool-suite-3.8.3.RELEASE-e4.6.2-win32-x86_64/sts-bundle/WLP/usr/servers/defaultServer/apps/expanded/wps-source-document-0.0.1-SNAPSHOT.war/WEB-INF/lib/google-collections-1.0.jar by [email protected]) called from class springfox.documentation.spring.web.ObjectMapperConfigurer (loaded from file:/C:/Users/IBM_ADMIN/Downloads/spring-tool-suite-3.8.3.RELEASE-e4.6.2-win32-x86_64/sts-bundle/WLP/usr/servers/defaultServer/apps/expanded/wps-source-document-0.0.1-SNAPSHOT.war/WEB-INF/lib/springfox-spring-web-2.7.0.jar by [email protected]). 
at springfox.documentation.spring.web.ObjectMapperConfigurer.jackson2Converters(ObjectMapperConfigurer.java:76) ~[springfox-spring-web-2.7.0.jar:2.7.0] 
at springfox.documentation.spring.web.ObjectMapperConfigurer.configureMessageConverters(ObjectMapperConfigurer.java:63) ~[springfox-spring-web-2.7.0.jar:2.7.0] 
at springfox.documentation.spring.web.ObjectMapperConfigurer.postProcessBeforeInitialization(ObjectMapperConfigurer.java:47) ~[springfox-spring-web-2.7.0.jar:2.7.0] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
... 29 common frames omitted 

我注意到,有有在這個環節上的類似問題幾個夥計:Exception caused by Guava library?

下面是我最新的依賴層次樹與番石榴依賴關係:enter image description here

我試過下面的解決方案:

​​
+0

@Dilip克里斯南:你可以看一下 – javaMan

回答

1

它看起來像你的springfox和谷歌集合罐子不兼容。 NoSuchMethodError意味着一個類正在調用目標類中不存在的方法。每異常消息,這個類:

springfox.documentation.spring.web.ObjectMapperConfigurer

被調用此方法:

com.google.common.collect.Lists.reverse

其在已加載的類的版本中不存在該簽名。

異常顯示哪個罐子這些類是從哪裏來的(都是在WAR的WEB-INF/lib目錄):

從springfox彈簧的web-2.7.0.jar ObjectMapperConfigurer從谷歌

列表-collections-1.0.jar

鑑於您的應用程序中有番石榴,我認爲解決方案只是取出舊的Google收藏夾jar。

+0

你可以詳細說明你的意思嗎?刪除舊的谷歌收藏罐。在我共享的depenency層次結構屏幕截圖中,我看到19.0是我迫使所有庫使用的版本。 – javaMan

+0

我不知道你的構建環境(或者對於這個問題一般而言),但它顯然會以某種方式進入你的應用程序。檢查你的構建環境以獲取對該jar名稱的引用,因爲有些東西在那裏。 – Jarid