1. 程式人生 > >web專案改成spring boot maven 引入jar包不一致啟動報錯

web專案改成spring boot maven 引入jar包不一致啟動報錯

 

        mavn 部署引入jar包不對,不提示找不到jar包,而是提示:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

Error creating bean with name 'auditProcessAction': Unsatisfied dependency expressed through field 'auditProcessService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditProcessService': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class xxx等資訊。

       費了好大勁,一點一點的註釋程式碼才找到是原來程式碼用的json包沒有引入,重新增加了pom依賴關係才解決:

<dependency>

    <groupId>org.json</groupId>

    <artifactId>json</artifactId>

    <version>20180130</version>

</dependency>

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

2018-12-29 14:25:40,347 INFO  bai.boss.App [line:50]- Starting App on zgh-pc with PID 7900 (D:\eclipse-workspace\boss\target\classes started by admin in D:\eclipse-workspace\boss)
2018-12-29 14:25:40,350 INFO  bai.boss.App [line:675]- No active profile set, falling back to default profiles: default
2018-12-29 14:25:42,684 INFO  org.springframework.boot.web.embedded.tomcat.TomcatWebServer [line:90]- Tomcat initialized with port(s): 8080 (http)
2018-12-29 14:25:42,705 INFO  org.apache.coyote.http11.Http11NioProtocol [line:173]- Initializing ProtocolHandler ["http-nio-8080"]
2018-12-29 14:25:42,717 INFO  org.apache.catalina.core.StandardService [line:173]- Starting service [Tomcat]
2018-12-29 14:25:42,718 INFO  org.apache.catalina.core.StandardEngine [line:173]- Starting Servlet Engine: Apache Tomcat/9.0.12
2018-12-29 14:25:42,740 INFO  org.apache.catalina.core.AprLifecycleListener [line:173]- The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_191\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\NetSarang;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Skype\Phone\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Java\jdk1.8.0_191\bin;C:\Program Files\Java\jdk1.8.0_191\jre\bin;D:\apache-maven-3.6.0\bin\;C:\Users\admin\AppData\Local\Microsoft\WindowsApps;;c:\program files\esafenet\cobra docguard client;.]
2018-12-29 14:25:43,439 INFO  org.apache.jasper.servlet.TldScanner [line:173]- At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2018-12-29 14:25:43,448 INFO  org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] [line:173]- Initializing Spring embedded WebApplicationContext
2018-12-29 14:25:43,449 INFO  org.springframework.web.context.ContextLoader [line:285]- Root WebApplicationContext: initialization completed in 3053 ms
2018-12-29 14:25:43,480 INFO  org.springframework.boot.web.servlet.ServletRegistrationBean [line:186]- Servlet dispatcherServlet mapped to [/]
2018-12-29 14:25:43,487 INFO  org.springframework.boot.web.servlet.FilterRegistrationBean [line:248]- Mapping filter: 'characterEncodingFilter' to: [/*]
2018-12-29 14:25:43,488 INFO  org.springframework.boot.web.servlet.FilterRegistrationBean [line:248]- Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-12-29 14:25:43,488 INFO  org.springframework.boot.web.servlet.FilterRegistrationBean [line:248]- Mapping filter: 'formContentFilter' to: [/*]
2018-12-29 14:25:43,489 INFO  org.springframework.boot.web.servlet.FilterRegistrationBean [line:248]- Mapping filter: 'requestContextFilter' to: [/*]
2018-12-29 14:25:43,709 WARN  org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext [line:554]- Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditProcessAction': Unsatisfied dependency expressed through field 'auditProcessService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditProcessService': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [bai.boss.action.bss.audit.AuditProcessService] from ClassLoader [
[email protected]
] 2018-12-29 14:25:43,713 INFO org.apache.catalina.core.StandardService [line:173]- Stopping service [Tomcat] 2018-12-29 14:25:43,771 INFO org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener [line:142]- Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2018-12-29 14:25:43,792 ERROR org.springframework.boot.SpringApplication [line:858]- Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditProcessAction': Unsatisfied dependency expressed through field 'auditProcessService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditProcessService': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [bai.boss.action.bss.audit.AuditProcessService] from ClassLoader [
[email protected]
] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) at bai.boss.App.main(App.java:11) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditProcessService': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [bai.boss.action.bss.audit.AuditProcessService] from ClassLoader [[email protected]] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:265) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1236) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1151) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ... 19 common frames omitted Caused by: java.lang.IllegalStateException: Failed to introspect Class [bai.boss.action.bss.audit.AuditProcessService] from ClassLoader [[email protected]] at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:680) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:577) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:562) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:248) ... 31 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/json/JSONException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.getDeclaredMethods(Class.java:1975) at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:662) ... 34 common frames omitted Caused by: java.lang.ClassNotFoundException: org.json.JSONException at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 38 common frames omitted