pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.elvish</groupId>
<artifactId>pdm-mobile</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>pdm-mobile</name>
<description>pdm-mobile</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<shiro.version>1.2.4</shiro.version>
<java.version>1.8</java.version>
</properties>
<repositories>
<repository>
<id>nutz</id>
<url>https://jfrog.nutz.cn/artifactory/jcenter</url>
</repository>
<repository>
<id>nutz-snapshots</id>
<url>https://jfrog.nutz.cn/artifactory/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>Nexus aliyun</id>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- 打成war包应排除tomcat的包,因为只是demo,懒得操作 -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- 支持html -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- nutz -->
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutz-plugins-spring-boot-starter</artifactId>
<version>1.r.63-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
<build>
<finalName>pdm-mobile</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
日志
10:45:49.051 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : [/nutz-.*.jar]
10:45:49.053 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]
10:45:49.054 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/D:/office/java/workspace/pdm-mobile/target/classes/, file:/D:/office/maven/repertory/org/nutz/nutz-plugins-spring-boot-starter/1.r.63-SNAPSHOT/nutz-plugins-spring-boot-starter-1.r.63-SNAPSHOT.jar, file:/D:/office/maven/repertory/org/nutz/nutz-integration-spring/1.r.63-SNAPSHOT/nutz-integration-spring-1.r.63-SNAPSHOT.jar, file:/D:/office/maven/repertory/org/nutz/nutz-plugins-sqlmanager/1.r.63-SNAPSHOT/nutz-plugins-sqlmanager-1.r.63-SNAPSHOT.jar, file:/D:/office/maven/repertory/org/nutz/nutz/1.r.63-SNAPSHOT/nutz-1.r.63-SNAPSHOT.jar]
+++++ +++++++++
++++++++++++++++++++
+++++++++++++++++++
+++++++++++++++I7+++++
+++++++++++++++~ =++=
++++++++++++++ ~7=.====
++++++++++++++I~~ ~======
+++++++++++++ ~~~:========
++++++++++++ ~~~~~~~======
++++++++++: ~~~~~~~~:~=====
+++++++ == ~=++~~~=:~======
++++ ======~~ ~~?:~=======
+ ==========7~~:~========
========7~I:~=========
====== ~:~==========
======~~==========
===============
===========
' ███╗ ██╗██╗ ██╗████████╗███████╗ ███████╗████████╗ █████╗ ██████╗ ████████╗███████╗██████╗
' ████╗ ██║██║ ██║╚══██╔══╝╚══███╔╝ ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔══██╗
' ██╔██╗ ██║██║ ██║ ██║ ███╔╝█████╗███████╗ ██║ ███████║██████╔╝ ██║ █████╗ ██████╔╝
' ██║╚██╗██║██║ ██║ ██║ ███╔╝ ╚════╝╚════██║ ██║ ██╔══██║██╔══██╗ ██║ ██╔══╝ ██╔══██╗
' ██║ ╚████║╚██████╔╝ ██║ ███████╗ ███████║ ██║ ██║ ██║██║ ██║ ██║ ███████╗██║ ██║
' ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚══════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝
'
powered by nutz.cn version 1.r.63
2017-12-12 10:45:49.491 INFO 1304 --- [ restartedMain] c.e.pdm.mobile.PdmMobileApplication : Starting PdmMobileApplication on DESKTOP-ENB3GMH with PID 1304 (D:\office\java\workspace\pdm-mobile\target\classes started by Elvish in D:\office\java\workspace\pdm-mobile)
2017-12-12 10:45:49.493 INFO 1304 --- [ restartedMain] c.e.pdm.mobile.PdmMobileApplication : No active profile set, falling back to default profiles: default
2017-12-12 10:45:49.794 INFO 1304 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1138b86d: startup date [Tue Dec 12 10:45:49 CST 2017]; root of context hierarchy
2017-12-12 10:45:52.098 INFO 1304 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8081 (http)
2017-12-12 10:45:52.115 INFO 1304 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2017-12-12 10:45:52.116 INFO 1304 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.23
2017-12-12 10:45:52.242 INFO 1304 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-12-12 10:45:52.242 INFO 1304 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2452 ms
2017-12-12 10:45:52.490 INFO 1304 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-12-12 10:45:52.492 INFO 1304 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'statViewServlet' to [/druid/*]
2017-12-12 10:45:52.496 INFO 1304 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-12-12 10:45:52.497 INFO 1304 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-12-12 10:45:52.497 INFO 1304 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-12-12 10:45:52.498 INFO 1304 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-12-12 10:45:52.498 INFO 1304 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webStatFilter' to urls: [/*]
2017-12-12 10:45:52.934 INFO 1304 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1138b86d: startup date [Tue Dec 12 10:45:49 CST 2017]; root of context hierarchy
2017-12-12 10:45:53.009 INFO 1304 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/hello]}" onto public java.lang.String com.elvish.pdm.mobile.busin.controller.IndexController.helloHtml(java.util.HashMap<java.lang.String, java.lang.Object>)
2017-12-12 10:45:53.012 INFO 1304 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-12-12 10:45:53.013 INFO 1304 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-12-12 10:45:53.063 INFO 1304 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-12 10:45:53.064 INFO 1304 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-12 10:45:53.117 INFO 1304 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-12 10:45:54.612 INFO 1304 --- [ restartedMain] org.nutz.dao.jdbc.Jdbcs : Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
2017-12-12 10:45:54.637 WARN 1304 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao' defined in class path resource [org/nutz/plugin/spring/boot/NutzDaoAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.nutz.dao.Dao]: Factory method 'dao' threw exception; nested exception is java.lang.NullPointerException
2017-12-12 10:45:54.637 INFO 1304 --- [ restartedMain] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed
2017-12-12 10:45:54.641 INFO 1304 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2017-12-12 10:45:54.660 INFO 1304 --- [ restartedMain] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-12-12 10:45:54.674 ERROR 1304 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao' defined in class path resource [org/nutz/plugin/spring/boot/NutzDaoAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.nutz.dao.Dao]: Factory method 'dao' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at com.elvish.pdm.mobile.PdmMobileApplication.main(PdmMobileApplication.java:10) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.8.RELEASE.jar:1.5.8.RELEASE]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.nutz.dao.Dao]: Factory method 'dao' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
... 23 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.springframework.boot.devtools.restart.classloader.RestartClassLoader.loadClass(RestartClassLoader.java:140) ~[spring-boot-devtools-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_111]
at com.alibaba.druid.util.JdbcUtils.createDriver(JdbcUtils.java:556) ~[druid-1.1.2.jar:1.1.2]
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:757) ~[druid-1.1.2.jar:1.1.2]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1129) ~[druid-1.1.2.jar:1.1.2]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1125) ~[druid-1.1.2.jar:1.1.2]
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:104) ~[druid-1.1.2.jar:1.1.2]
at org.nutz.trans.Trans.getConnectionAuto(Trans.java:263) ~[nutz-1.r.63-SNAPSHOT.jar:1.r.63-SNAPSHOT]
at org.nutz.dao.jdbc.Jdbcs.getExpert(Jdbcs.java:106) ~[nutz-1.r.63-SNAPSHOT.jar:1.r.63-SNAPSHOT]
at org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:187) ~[nutz-1.r.63-SNAPSHOT.jar:1.r.63-SNAPSHOT]
at org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:178) ~[nutz-1.r.63-SNAPSHOT.jar:1.r.63-SNAPSHOT]
at org.nutz.dao.impl.NutDao.<init>(NutDao.java:105) ~[nutz-1.r.63-SNAPSHOT.jar:1.r.63-SNAPSHOT]
at org.nutz.dao.impl.NutDao.<init>(NutDao.java:109) ~[nutz-1.r.63-SNAPSHOT.jar:1.r.63-SNAPSHOT]
at org.nutz.plugin.spring.boot.NutzDaoAutoConfiguration.dao(NutzDaoAutoConfiguration.java:34) ~[nutz-plugins-spring-boot-starter-1.r.63-SNAPSHOT.jar:na]
at org.nutz.plugin.spring.boot.NutzDaoAutoConfiguration$$EnhancerBySpringCGLIB$$af1c23a.CGLIB$dao$1(<generated>) ~[nutz-plugins-spring-boot-starter-1.r.63-SNAPSHOT.jar:na]
at org.nutz.plugin.spring.boot.NutzDaoAutoConfiguration$$EnhancerBySpringCGLIB$$af1c23a$$FastClassBySpringCGLIB$$58588bd1.invoke(<generated>) ~[nutz-plugins-spring-boot-starter-1.r.63-SNAPSHOT.jar:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.nutz.plugin.spring.boot.NutzDaoAutoConfiguration$$EnhancerBySpringCGLIB$$af1c23a.dao(<generated>) ~[nutz-plugins-spring-boot-starter-1.r.63-SNAPSHOT.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
... 24 common frames omitted
现象
当把nutz-plugins-spring-boot-starter和druid-spring-boot-starter去除后,项目正常启动。
疑问
版本问题吗????