binarywang / weixin-java-mp-demo

基于Spring Boot 和 WxJava 实现的微信公众号Java后端Demo,支持多公众号
1.92k stars 975 forks source link

呃。。。。demo运行错误 #29

Closed PoorManyn closed 5 years ago

PoorManyn commented 5 years ago

. _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v2.0.4.RELEASE)

2018-12-06 00:17:43.782 INFO 8384 --- [ main] c.g.b.demo.wx.mp.WxMpDemoApplication : Starting WxMpDemoApplication on Mabin-PC with PID 8384 (D:\javawork\mvc\weixin-java-mp-demo-springboot\target\classes started by Mabin in D:\javawork\mvc\weixin-java-mp-demo-springboot) 2018-12-06 00:17:43.798 DEBUG 8384 --- [ main] c.g.b.demo.wx.mp.WxMpDemoApplication : Running with Spring Boot v2.0.4.RELEASE, Spring v5.0.8.RELEASE 2018-12-06 00:17:43.798 INFO 8384 --- [ main] c.g.b.demo.wx.mp.WxMpDemoApplication : No active profile set, falling back to default profiles: default 2018-12-06 00:17:44.416 INFO 8384 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@72d1ad2e: startup date [Thu Dec 06 00:17:44 CST 2018]; root of context hierarchy 2018-12-06 00:17:52.199 INFO 8384 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2018-12-06 00:17:52.496 INFO 8384 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2018-12-06 00:17:52.496 INFO 8384 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.32 2018-12-06 00:17:52.533 INFO 8384 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [D:\Program Files\Java\jre1.8.0_161\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/Program Files/Java/jre1.8.0_161/bin/server;D:/Program Files/Java/jre1.8.0_161/bin;D:/Program Files/Java/jre1.8.0_161/lib/amd64;C:\Program Files\VanDyke Software\Clients\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\nodejs\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Users\Mabin.Mabin-PC.windows-build-tools\python27\;C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Mabin.Mabin-PC\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules.bin;C:\Users\Mabin.Mabin-PC\AppData\Roaming\npm\node_modules.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\nodejs\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\OpenVPN\bin;D:\javawork\java-jdk\apache-maven-3.3.9\bin;C:\Program Files\Git;C:\Users\Mabin.Mabin-PC\AppData\Roaming\npm;D:\javawork\java-jdk\gradle-4.10.2\bin;C:\Windows\system32;;.] 2018-12-06 00:17:53.405 INFO 8384 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2018-12-06 00:17:53.406 INFO 8384 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 9019 ms 2018-12-06 00:17:53.646 INFO 8384 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/] 2018-12-06 00:17:53.652 INFO 8384 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/] 2018-12-06 00:17:53.652 INFO 8384 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/] 2018-12-06 00:17:53.652 INFO 8384 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/] 2018-12-06 00:17:53.653 INFO 8384 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/] 2018-12-06 00:17:54.033 WARN 8384 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'services' defined in class path resource [com/github/binarywang/demo/wx/mp/config/WxMpConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.lang.Object]: Factory method 'services' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/HttpRequest 2018-12-06 00:17:54.036 INFO 8384 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2018-12-06 00:17:54.121 INFO 8384 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2018-12-06 00:17:54.173 ERROR 8384 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'services' defined in class path resource [com/github/binarywang/demo/wx/mp/config/WxMpConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.lang.Object]: Factory method 'services' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/HttpRequest at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:590) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1247) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:330) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at com.github.binarywang.demo.wx.mp.WxMpDemoApplication.main(WxMpDemoApplication.java:13) [classes/:na] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.lang.Object]: Factory method 'services' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/HttpRequest at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:582) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] ... 18 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/apache/http/HttpRequest at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_161] at java.lang.ClassLoader.defineClass(Unknown Source) ~[na:1.8.0_161] at java.security.SecureClassLoader.defineClass(Unknown Source) ~[na:1.8.0_161] at java.net.URLClassLoader.defineClass(Unknown Source) ~[na:1.8.0_161] at java.net.URLClassLoader.access$100(Unknown Source) ~[na:1.8.0_161] at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_161] at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_161] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_161] at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_161] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_161] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_161] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_161] at com.github.binarywang.demo.wx.mp.config.WxMpConfiguration.lambda$0(WxMpConfiguration.java:89) ~[classes/:na] at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[na:1.8.0_161] at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[na:1.8.0_161] at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[na:1.8.0_161] at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[na:1.8.0_161] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[na:1.8.0_161] at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[na:1.8.0_161] at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[na:1.8.0_161] at com.github.binarywang.demo.wx.mp.config.WxMpConfiguration.services(WxMpConfiguration.java:93) ~[classes/:na] at com.github.binarywang.demo.wx.mp.config.WxMpConfiguration$$EnhancerBySpringCGLIB$$33212d69.CGLIB$services$0() ~[classes/:na] at com.github.binarywang.demo.wx.mp.config.WxMpConfiguration$$EnhancerBySpringCGLIB$$33212d69$$FastClassBySpringCGLIB$$2587b82a.invoke() ~[classes/:na] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE] at com.github.binarywang.demo.wx.mp.config.WxMpConfiguration$$EnhancerBySpringCGLIB$$33212d69.services() ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161] at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_161] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] ... 19 common frames omitted Caused by: java.lang.ClassNotFoundException: org.apache.http.HttpRequest at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_161] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_161] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_161] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_161] ... 50 common frames omitted

PoorManyn commented 5 years ago

已经在pom.xml文件中增加

`

org.apache.httpcomponents httpcore 4.4 org.apache.commons commons-lang3 3.3.1 com.google.code.gson gson 2.7 ` 解决
binarywang commented 5 years ago

demo本身没问题,是你自己的项目的jar包版本冲突导致的