Java 中注入失败,初始化失败 5C

D:\Java\Apache\tomcat\bin\catalina.bat run
[2018-07-06 10:17:02,297] Artifact mmall:war: Server is not connected. Deploy is not available.
Using CATALINA_BASE: "C:\Users\Administrator.IntelliJIdea15\system\tomcat\Unnamed_mmall_5"
Using CATALINA_HOME: "D:\Java\Apache\tomcat"
Using CATALINA_TMPDIR: "D:\Java\Apache\tomcat\temp"
Using JRE_HOME: "D:\Java\jdk1.8"
Using CLASSPATH: "D:\Java\Apache\tomcat\bin\bootstrap.jar;D:\Java\Apache\tomcat\bin\tomcat-juli.jar"
06-Jul-2018 10:17:04.197 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.36
06-Jul-2018 10:17:04.202 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 9 2016 13:55:50 UTC
06-Jul-2018 10:17:04.202 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.36.0
06-Jul-2018 10:17:04.203 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 7
06-Jul-2018 10:17:04.203 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 6.1
06-Jul-2018 10:17:04.203 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
06-Jul-2018 10:17:04.204 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: D:\Java\jdk1.8\jre
06-Jul-2018 10:17:04.204 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_31-b13
06-Jul-2018 10:17:04.205 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
06-Jul-2018 10:17:04.205 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\Administrator.IntelliJIdea15\system\tomcat\Unnamed_mmall_5
06-Jul-2018 10:17:04.205 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:\Java\Apache\tomcat
06-Jul-2018 10:17:04.210 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
06-Jul-2018 10:17:04.211 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
06-Jul-2018 10:17:04.213 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
06-Jul-2018 10:17:04.214 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
06-Jul-2018 10:17:04.214 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
06-Jul-2018 10:17:04.215 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
06-Jul-2018 10:17:04.218 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\Administrator.IntelliJIdea15\system\tomcat\Unnamed_mmall_5\conf\logging.properties
06-Jul-2018 10:17:04.218 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
06-Jul-2018 10:17:04.219 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=D:\Java\Apache\tomcat\endorsed
06-Jul-2018 10:17:04.221 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\Administrator.IntelliJIdea15\system\tomcat\Unnamed_mmall_5
06-Jul-2018 10:17:04.221 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\Java\Apache\tomcat
06-Jul-2018 10:17:04.222 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\Java\Apache\tomcat\temp
06-Jul-2018 10:17:04.222 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.7 using APR version 1.5.2.
06-Jul-2018 10:17:04.222 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
06-Jul-2018 10:17:05.281 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2h 3 May 2016)
06-Jul-2018 10:17:05.603 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
06-Jul-2018 10:17:05.630 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
06-Jul-2018 10:17:05.634 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 2175 ms
06-Jul-2018 10:17:05.705 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
06-Jul-2018 10:17:05.705 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.36
06-Jul-2018 10:17:05.727 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
06-Jul-2018 10:17:05.766 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
06-Jul-2018 10:17:05.788 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 153 ms
Connected to server
[2018-07-06 10:17:05,995] Artifact mmall:war: Artifact is being deployed, please wait...
06-Jul-2018 10:17:11.679 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars 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.
06-Jul-2018 10:17:11.805 INFO [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization started
06-Jul-2018 10:17:12.113 INFO [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.AbstractApplicationContext.prepareRefresh Refreshing Root WebApplicationContext: startup date [Fri Jul 06 10:17:12 CST 2018]; root of context hierarchy
06-Jul-2018 10:17:12.267 INFO [RMI TCP Connection(2)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [applicationContext.xml]
06-Jul-2018 10:17:13.049 INFO [RMI TCP Connection(2)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [applicationContext-datasource.xml]
06-Jul-2018 10:17:13.857 INFO [RMI TCP Connection(2)-127.0.0.1] org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties Loading properties file from class path resource [datasource.properties]
10:17:14,340 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
10:17:14,340 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
10:17:14,341 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/D:/Java/Apache/tomcat/webapps/ROOT/WEB-INF/classes/logback.xml]
10:17:14,499 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
10:17:14,502 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeFilter scanning period to 1 minutes
10:17:14,502 |-INFO in ReconfigureOnChangeFilter{invocationCounter=0} - Will scan for changes in [[D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\logback.xml]] every 60 seconds.
10:17:14,502 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Adding ReconfigureOnChangeFilter as a turbo filter
10:17:14,512 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
10:17:14,522 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console]
10:17:14,578 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:19 - no applicable action for [encoding], current ElementPath is [[configuration][appender][encoding]]
10:17:14,583 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
10:17:14,766 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
10:17:14,775 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [mmall]
10:17:14,831 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@18:21 - no applicable action for [append], current ElementPath is [[configuration][appender][rollingPolicy][append]]
10:17:14,843 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use gz compression
10:17:14,851 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern /developer/apache-tomcat-7.0.73/logs/mmall.log.%d{yyyy-MM-dd} for the active file
10:17:14,865 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern '/developer/apache-tomcat-7.0.73/logs/mmall.log.%d{yyyy-MM-dd}.gz'.
10:17:14,865 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
10:17:14,866 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Tue Jul 03 20:52:38 CST 2018
10:17:14,874 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
10:17:14,881 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[mmall] - Active log file name: /developer/apache-tomcat-7.0.73/logs/mmall.log
10:17:14,881 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[mmall] - File property is set to [/developer/apache-tomcat-7.0.73/logs/mmall.log]
10:17:14,885 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
10:17:14,885 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [error]
10:17:14,886 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@33:21 - no applicable action for [append], current ElementPath is [[configuration][appender][rollingPolicy][append]]
10:17:14,888 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use gz compression
10:17:14,888 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern /devsoft/apache-tomcat-7.0.73/logs/error.log.%d{yyyy-MM-dd} for the active file
10:17:14,894 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern '/devsoft/apache-tomcat-7.0.73/logs/error.log.%d{yyyy-MM-dd}.gz'.
10:17:14,894 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
10:17:14,894 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Tue Jul 03 20:52:38 CST 2018
10:17:14,895 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
10:17:14,914 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[error] - Active log file name: /developer/apache-tomcat-7.0.73/logs/error.log
10:17:14,914 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[error] - File property is set to [/developer/apache-tomcat-7.0.73/logs/error.log]
10:17:14,918 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.mmall] to INFO
10:17:14,918 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.mmall] to false
10:17:14,918 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [mmall] to Logger[com.mmall]
10:17:14,920 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [console] to Logger[com.mmall]
10:17:14,920 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.mmall.dao] to DEBUG
10:17:14,920 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
10:17:14,920 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [console] to Logger[ROOT]
10:17:14,921 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [error] to Logger[ROOT]
10:17:14,921 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
10:17:14,923 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@4fd39943 - Registering current configuration as safe fallback point

[10:17:14.980][DEBUG][org.apache.ibatis.logging.LogFactory][RMI TCP Connection(2)-127.0.0.1] Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
[10:17:15.587][DEBUG][org.mybatis.spring.SqlSessionFactoryBean][RMI TCP Connection(2)-127.0.0.1] Property configuration or 'configLocation' not specified, using default MyBatis Configuration
[10:17:15.736][DEBUG][org.mybatis.spring.SqlSessionFactoryBean][RMI TCP Connection(2)-127.0.0.1] Registered plugin: 'com.github.pagehelper.PageHelper@16a000a1'
06-Jul-2018 10:17:15.795 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:\Java\Apache\tomcat\webapps\manager
06-Jul-2018 10:17:16.008 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:\Java\Apache\tomcat\webapps\manager has finished in 212 ms
[10:17:16.139][DEBUG][org.mybatis.spring.SqlSessionFactoryBean][RMI TCP Connection(2)-127.0.0.1] Parsed mapper file: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\CartMapper.xml]'
[10:17:16.195][DEBUG][org.mybatis.spring.SqlSessionFactoryBean][RMI TCP Connection(2)-127.0.0.1] Parsed mapper file: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\CategoryMapper.xml]'
[10:17:16.285][DEBUG][org.mybatis.spring.SqlSessionFactoryBean][RMI TCP Connection(2)-127.0.0.1] Parsed mapper file: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\OrderItemMapper.xml]'
[10:17:16.350][DEBUG][org.mybatis.spring.SqlSessionFactoryBean][RMI TCP Connection(2)-127.0.0.1] Parsed mapper file: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\OrderMapper.xml]'
[10:17:16.422][DEBUG][org.mybatis.spring.SqlSessionFactoryBean][RMI TCP Connection(2)-127.0.0.1] Parsed mapper file: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\PayInfoMapper.xml]'
[10:17:16.507][DEBUG][org.mybatis.spring.SqlSessionFactoryBean][RMI TCP Connection(2)-127.0.0.1] Parsed mapper file: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\ProductMapper.xml]'
[10:17:16.526][DEBUG][org.mybatis.spring.SqlSessionFactoryBean][RMI TCP Connection(2)-127.0.0.1] Parsed mapper file: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\ShippingMapper.xml]'
06-Jul-2018 10:17:16.547 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userManageController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mmall.service.IUserService com.mmall.controller.backend.UserManageController.iUserService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iUserService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mmall.dao.UserMapper com.mmall.service.impl.UserServiceImpl.userMapper; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\com\mmall\dao\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1696)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:484)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:433)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:828)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$240(TCPTransport.java:683)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/1865884405.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mmall.service.IUserService com.mmall.controller.backend.UserManageController.iUserService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iUserService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mmall.dao.UserMapper com.mmall.service.impl.UserServiceImpl.userMapper; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\com\mmall\dao\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
... 59 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iUserService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mmall.dao.UserMapper com.mmall.service.impl.UserServiceImpl.userMapper; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\com\mmall\dao\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:957)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:855)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:480)
... 61 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mmall.dao.UserMapper com.mmall.service.impl.UserServiceImpl.userMapper; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\com\mmall\dao\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
... 72 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\com\mmall\dao\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1278)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1170)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:957)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:855)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:480)
... 74 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:957)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1263)
... 85 more
Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:522)
at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:381)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
... 95 more
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:259)
at org.apache.ibatis.parsing.XPathParser.(XPathParser.java:125)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.(XMLMapperBuilder.java:78)
at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:519)
... 98 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:1994)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:879)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:348)
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:257)
... 101 more

06-Jul-2018 10:17:16.653 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
06-Jul-2018 10:17:16.654 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
[2018-07-06 10:17:16,722] Artifact mmall:war: Error during artifact deployment. See server log for details.

7个回答

xml格式没问题吧?

applicationContext-datasource.xml的配置有问题,还有UserMapper.xml也有问题,可以贴出来看下

检查下UserMapper.xml的这个文件,可能有一个tag写错了。。可以把这个文件贴出来

nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。;

[D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]

columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。;
意思是UserMapper.xml文件的第十行的标签的属性名必须在以上几个关键词中,不能自己定义,检查一下是不是写错了

Failed to parse mapping resource: 'file [D:\Java\Apache\tomcat\webapps\ROOT\WEB-INF\classes\mappers\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 209; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。;
很明显的错啊,UserMapper.xml那里写错了,贴出来看一下

低级问题,xml里标签名或者属性写错了,估计已经解决了吧

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
ios提示初始化数据失败
ios提示初始化数据失败ios提示初始化数据失败ios提示初始化数据失败ios提示初始化数据失败ios提示初始化数据失败ios提示初始化数据失败ios提示初始化数据失败
java中有时候初始化一个对象不需要new关键词
java中有时候初始化一个对象不需要new关键词 比如 camera =Camera.open( ); 就不需要new关键词 还有那些类初始化可以像这样子的呢
Java中的初始化块有什么作用啊?
书上说,Java中的初始化块总是优先于构造器执行,可是他们两个都是在进行变量的初始化,为什么初始化了一次,还要调用构造器初始化呢?这我就有点不理解了,他们两个到底有什么区别啊?创建对象的时候他们俩到底都干了些什么啊?求好人指点!!!
java中static初始化模块的使用
我在编写中反复调用一个类中的方法,该类中有一个静态初始化模块static{},没有主方法,那么这个类的初始化模块会不会反复初始化? 怎么让它之初始化一次? 是在作c/s模型中出现的,客户端发送请求,要求修改服务器端的static模块,修改成功后,再次访问static模块又初始化了。
java数组的初始化问题
java数组在使用之前一定要初始化吗?为什么?如果不进行初始化,底层的状态是什么?使用的话会发生什么错误?
java数组静态初始化简化写法
java数组静态初始化的简化写法: int[] arr = {12, 23, 34, 45}; 这种写法可不可以看成是一种语法糖? 是不是在编译过程中仍然会被编译为: int[] arr = new int[]{12, 23, 34, 45};
java 怎么测试一个对象初始化用了多少时间
``` public static void main(String[] args) { int sum = 0; for(int i = 0; i < 100; i++){ long startTime = System.currentTimeMillis(); Tika tika = new Tika(); long endTime = System.currentTimeMillis(); long num = endTime - startTime; sum += num; System.out.println("程序初始化时间: " + num + "ms"); } System.out.println("平均耗费时间为:" + sum/100); } ``` 这样写对吗,为什么第一次对象初始化的时间比后面大了这么多,是什么原因 ``` 程序初始化时间: 914ms 程序初始化时间: 14ms 程序初始化时间: 28ms 程序初始化时间: 23ms 程序初始化时间: 11ms 程序初始化时间: 12ms 程序初始化时间: 11ms 程序初始化时间: 10ms 程序初始化时间: 11ms 程序初始化时间: 10ms 程序初始化时间: 9ms 程序初始化时间: 10ms 程序初始化时间: 8ms 程序初始化时间: 9ms 程序初始化时间: 8ms 程序初始化时间: 31ms 程序初始化时间: 14ms 程序初始化时间: 12ms 程序初始化时间: 10ms 程序初始化时间: 12ms 程序初始化时间: 18ms 程序初始化时间: 14ms 程序初始化时间: 27ms 程序初始化时间: 8ms 程序初始化时间: 10ms 程序初始化时间: 9ms 程序初始化时间: 10ms 程序初始化时间: 9ms 程序初始化时间: 7ms 程序初始化时间: 10ms 程序初始化时间: 10ms 程序初始化时间: 10ms 程序初始化时间: 15ms 程序初始化时间: 9ms 程序初始化时间: 8ms 程序初始化时间: 9ms 程序初始化时间: 8ms 程序初始化时间: 8ms 程序初始化时间: 7ms 程序初始化时间: 6ms 程序初始化时间: 7ms 程序初始化时间: 12ms 程序初始化时间: 8ms 程序初始化时间: 7ms 程序初始化时间: 6ms 程序初始化时间: 8ms 程序初始化时间: 7ms 程序初始化时间: 8ms 程序初始化时间: 7ms 程序初始化时间: 8ms 程序初始化时间: 8ms 程序初始化时间: 6ms 程序初始化时间: 7ms 程序初始化时间: 6ms 程序初始化时间: 24ms 程序初始化时间: 8ms 程序初始化时间: 9ms 程序初始化时间: 11ms 程序初始化时间: 7ms 程序初始化时间: 8ms 程序初始化时间: 7ms 程序初始化时间: 8ms 程序初始化时间: 14ms 程序初始化时间: 10ms 程序初始化时间: 9ms 程序初始化时间: 6ms 程序初始化时间: 11ms 程序初始化时间: 44ms 程序初始化时间: 10ms 程序初始化时间: 6ms 程序初始化时间: 8ms 程序初始化时间: 7ms 程序初始化时间: 7ms 程序初始化时间: 6ms 程序初始化时间: 7ms 程序初始化时间: 7ms 程序初始化时间: 6ms 程序初始化时间: 7ms 程序初始化时间: 6ms 程序初始化时间: 9ms 程序初始化时间: 6ms 程序初始化时间: 7ms 程序初始化时间: 6ms 程序初始化时间: 11ms 程序初始化时间: 9ms 程序初始化时间: 12ms 程序初始化时间: 7ms 程序初始化时间: 14ms 程序初始化时间: 5ms 程序初始化时间: 6ms 程序初始化时间: 6ms 程序初始化时间: 5ms 程序初始化时间: 8ms 程序初始化时间: 6ms 程序初始化时间: 6ms 程序初始化时间: 11ms 程序初始化时间: 9ms 程序初始化时间: 7ms 程序初始化时间: 5ms 程序初始化时间: 5ms 平均耗费时间为:18 ```
Java编程中的初始化问题
为啥初始化字符串数组要放在无参构造函数中?放在外面时,就会报数组越界异常?代码如下: import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.util.HashMap; import java.util.Map; import com.bdqn.hibernate.model.Student; public class Session { //模拟配置文件 String tableName="_Student"; Map<String, String> cfs=new HashMap<String, String>(); //定义一个String数组,来存储方法名 String[] methodNames; public Session() { cfs.put("_id", "id"); cfs.put("_name", "name"); cfs.put("_age", "age"); methodNames=new String[cfs.size()]; } public void save(Student s) throws Exception{ //创建sql语句 String sql=createSql(); //加载驱动类 /*Class.forName("com.mysql.jdbc.Driver"); Connection conn=DriverManager.getConnection( "jdbc:mysql://localhost:3306/hibernate", "root", ""); PreparedStatement pst=conn.prepareStatement(sql); pst.executeUpdate(); pst.close(); conn.close();*/ } private String createSql() { String str1=""; //定义变量,用来存储方法名数组的下标 int index=0; for(String s:cfs.keySet()){ //通过键获取值 String value=cfs.get(s); //将值的首字母转换成大写 value=Character.toUpperCase(value.charAt(0))+value.substring(1); //获取方法名 methodNames[index]="get"+value; System.out.println(methodNames[index]); index++; str1+=s+","; } str1=str1.substring(0, str1.length()-1); System.out.println(str1); String str2=""; for(int i=0; i<cfs.size(); i++){ str2+="?,"; } str2=str2.substring(0, str2.length()-1); System.out.println(str2); String sql="insert into "+tableName+" ("+str1+") value("+str2+")"; System.out.println(sql); return sql; } }
java HashMap需要设置初始化大小吗?
HashMap需要设置初始化大小吗?hashmap即使设置初始化大小也是设置值为二的幂次方,但hashmap本身也会resize,自动扩容,也是乘以二的扩容,这样看来,hashmap设置初始化大小就没有意义了啊!
windows Azure Storage Emulator初始化失败
windows Azure Storage Emulator初始化失败问题如何解决?
关于java中加载和初始化的疑问?各位帮忙分析下
public class ExA { private static ExA a = new ExA(); static { System.out.println("父类--静态代码块"); } public ExA() { System.out.println("父类--构造函数"); } { System.out.println("父类--非静态代码块"); } public static void main(String[] args) { new ExB(); } } 程序执行时先找到程序入口即main函数,接着加载和初始化main函数所在的类即ExA,那么第一句就是private static ExA a = new ExA();那么执行这句代码的时候发生了什么?我知道的是先把a设置为null,然后才去赋值为new ExA();关键是new ExA()(第一次创建对象)的时候按道理不是会触发ExA类的加载和初始化吗?但这句代码就在ExA类初始化的第一行,难道要跳过去初始化static { System.out.println("父类--静态代码块"); }吗?还是有别的理解? 第二个疑问:是不是当要首次创建一个类的对象时,前提条件是这个类必须先加载和初始化都完成后才能首次创建类的对象?还是说只要这个类加载了虽然没有初始化就可以创建类的对象了? class ExB extends ExA { private static ExB b = new ExB(); static { System.out.println("子类--静态代码块"); } { System.out.println("子类--非静态代码块"); } public ExB() { System.out.println("子类--构造函数"); } }
Java的变量初始化顺序问题
![图片说明](https://img-ask.csdn.net/upload/201509/21/1442807084_568277.jpg) 结果为0 很有意思 有木有!变量初始化顺序是显示初始化之后再构造方法初始化对吧, 答案为何如此,求详解 ``` class Base { private int i = 2; public Base() { System.out.println(i); this.display(); } public void display() { System.out.println(i); } } class Derived extends Base { private int i = 22; public Derived() { //System.out.println(i); i = 222; } public void display() { System.out.println(i); } } public class Test { public static void main(String[] args) { new Derived(); } } ```
Java类的初始化顺序问题
一般在Java对象能够调用方法之前,此类中的成员变量就已经初始化完毕,那如果这个成员是匿名内部类呢?也会等到这个匿名内部类中的代码全部跑完吗?
java变量的初始化和属性的默认值
java变量的初始化和属性的默认值问题。 为什么local variables 使用时要赋初值,而global variables 系统默认初值?(我这样理解对吗?本人小白,求各路大神指点!)
java 使用密码技术进行会话初始化验证
java 应用系统中如何使用密码技术进行会话初始化验证。。。。
java中如何理解这种初始化类实例的方式,我只懂new的方式
java中public boolean setViewValue(Viewarg0,Object arg1){ImageView imageView =(ImageView)arg0 Bitmap bitmap=(Bitmap)arg1}如何理解这种初始化类实例的方式,我只懂new的方式
在java中如何获取或初始化scala.collection.immutable.Map?
java调用kafka API时需要一个一个scala.collection.immutable.Map参数,但不知道如何初始化或通过其他API获取
java抽象类中私有属性初始化之后与预期结果不一致
背景是这样的,项目使用的是Spring MVC类与类之间是通过@Autowired注解进行 注入的,我有一个Email的抽象类 ``` public abstract class Mail { protected boolean isEmailContentValid = true; } ``` 然后有多个子类机型了这个Email抽象类,比如AEmail extends Mail ``` public class MailFactory { @Autowired AEMail aEMail; } ``` 在MailFactory中,通过aEMail访问其父类的属性isEmailContentValid, 竟然是false的,一直想不通是为什么,我已经在父类Email中显示初始化 了isEmailContentValid=true,为什么初始化之后确实false的?
java单例初始化为什么不一直循环初始化的问题
程序很简单: ``` public class User { static User u=new User(); public static User getUser(){ return u; } User01 u01=User01.getUser01(); public User(){ System.out.println("User新建一次"); } } public class User01 { static User01 u01=new User01(); public static User01 getUser01(){ return u01; } User u=User.getUser(); public User01(){ System.out.println("User01新建一次"); } } public class Test { public static void main(String[] args) { User u=User.getUser(); User01 u01=User01.getUser01(); System.out.println(u.u01); System.out.println(u01.u); } } ``` 接着我运行test的main函数,得到结果如下: User01新建一次 User新建一次 User01@40ac8360 null 为什么会有这个结果?为什么没有循环地一直初始化下去呢?为什么最后的u01.u是空指针呢?跪求大神解释一下整个程序运行过程中到底发生了什么!
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
redis分布式锁,面试官请随便问,我都会
文章有点长并且绕,先来个图片缓冲下! 前言 现在的业务场景越来越复杂,使用的架构也就越来越复杂,分布式、高并发已经是业务要求的常态。像腾讯系的不少服务,还有CDN优化、异地多备份等处理。 说到分布式,就必然涉及到分布式锁的概念,如何保证不同机器不同线程的分布式锁同步呢? 实现要点 互斥性,同一时刻,智能有一个客户端持有锁。 防止死锁发生,如果持有锁的客户端崩溃没有主动释放锁,也要保证锁可以正常释...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
Python 编程开发 实用经验和技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法和技巧,包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等,会持续更新......
YouTube排名第一的励志英文演讲《Dream(梦想)》
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
Java世界最常用的工具类库
Apache Commons Apache Commons有很多子项目 Google Guava 参考博客
相关热词 c# 输入ip c# 乱码 报表 c#选择结构应用基本算法 c# 收到udp包后回包 c#oracle 头文件 c# 序列化对象 自定义 c# tcp 心跳 c# ice连接服务端 c# md5 解密 c# 文字导航控件
立即提问