NutzCN Logo
问答 在spring中整合nutz的dao具体应该怎么做?
发布于 3281天前 作者 qq_6c45841c 5511 次浏览 复制 上一个帖子 下一个帖子
标签: spring dao

如题,我是菜鸟,谢谢~~

19 回复

类似这样, 其中springDaoRunner在https://github.com/nutzam/nutzmore/tree/master/nutz-integration-spring

<bean id="nutDao" class="org.nutz.impl.NutDao">
    <property name="dataSource" ref="dataSource"/>
	<property name="runner" ref="springDaoRunner"/>
</bean>
<bean id="springDaoRunner" class="org.nutz.integration.spring.SpringDaoRunner">
</bean>

非常感谢,哈哈~~

@wendal 我按这个配置后,保存的时候无法插入数据,没有错误,这是因为什么,

<bean id="springDaoRunner" class="org.nutz.integration.spring.SpringDaoRunner">

去掉这个就能保存成功

@chaokun 没有配置好spring的事务? 如果不适用spring的事务,就不需要SpringDaoRunner

NutDao 的类名写错了,应该这样

    <bean id="nutDao" class="org.nutz.dao.impl.NutDao">
        <property name="dataSource" ref="dataSource"/>
        <property name="runner" ref="springDaoRunner"/>
    </bean>

@wendal 话说什么叫 不适用spring的事务,在配置 dataSource 的时候, defaultAutoCommit 设置成 false 的话也遇到了这个问题

@ywjno spring的tx管理器

来自炫酷的 NutzCN

要用nutz的事务模板就不能加springdaorunner

加了springdaorunner的话,trans就不会生效,所有事务操作交给spring管理。

来自炫酷的 NutzCN

@wendal 那么前面的MVC替换成NutMVC呢?就是传统SSH只保留spring

@qq_c1bab051 spring ioc + nutz mvc + nutz dao ? 我不太相信有人这样用

@wendal 也就是说只提供了Struts MVC+nutz ioc +nutz dao和xx MVC+Spring ioc+nutz dao,两种形式?话说求大神,开发想struts标签那样的nutz标签啊。

每次都歪楼.

spring 项目中添加nutDao支持 对spring的版本有邀请吗?添加nutDao后启动报错

xml头部
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

2016-10-20 14:50:43,964 [localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader:331 - Context initialization failed
java.lang.RuntimeException: null
	at org.springframework.asm.MethodVisitor.visitParameter(Unknown Source) ~[spring-core-3.2.9.RELEASE.jar:na]
	at org.springframework.asm.ClassReader.b(Unknown Source) ~[spring-core-3.2.9.RELEASE.jar:na]
	at org.springframework.asm.ClassReader.accept(Unknown Source) ~[spring-core-3.2.9.RELEASE.jar:na]
	at org.springframework.asm.ClassReader.accept(Unknown Source) ~[spring-core-3.2.9.RELEASE.jar:na]
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:64) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:71) ~[spring-context-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:255) ~[spring-context-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:225) ~[spring-context-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630) ~[spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) ~[spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) ~[spring-web-3.2.9.RELEASE.jar:na]
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) ~[spring-web-3.2.9.RELEASE.jar:na]
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.9.RELEASE.jar:na]
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729) [catalina.jar:8.0.24]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167) [catalina.jar:8.0.24]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.24]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) [catalina.jar:8.0.24]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) [catalina.jar:8.0.24]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_20]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_20]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_20]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_20]

@sunhai1988 这肯定不是完整报错信息

这是完整的

十月 20, 2016 3:27:18 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:carloan1' did not find a matching property.
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version:        Apache Tomcat/8.0.24
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built:          Jul 1 2015 20:19:55 UTC
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number:         8.0.24.0
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name:               Windows 8.1
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version:            6.3
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture:          amd64
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home:             C:\Program Files\Java\jdk1.8.0_20\jre
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version:           1.8.0_20-b26
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor:            Oracle Corporation
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE:         D:\workspace\carloan\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME:         D:\apache-tomcat-8.0.24
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:10757
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=D:\workspace\carloan\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=D:\apache-tomcat-8.0.24
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=D:\workspace\carloan\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=D:\apache-tomcat-8.0.24\endorsed
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=UTF-8
十月 20, 2016 3:27:18 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: 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_20\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0_20\jre\bin;C:/Program Files/Java/jdk1.8.0_20/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_20/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_20/bin/../jre/lib/amd64;D:\mongodb\Server\3.2\bin;C:\Program Files\Java\jdk1.8.0_20\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;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\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\OpenVPN\bin;D:\Program Files\TortoiseSVN\bin;D:\Program Files\nodejs\;C:\Program Files\Git\bin;d:\eclipse-che-4.2.0\tools\jre\bin;C:\Users\admin\AppData\Roaming\npm;d:\Program Files (x86)\Nmap;C:\Users\admin\AppData\Local\Microsoft\WindowsApps;;D:\eclipsemar\eclipse;;.
十月 20, 2016 3:27:18 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-nio-8087"]
十月 20, 2016 3:27:18 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
十月 20, 2016 3:27:18 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-nio-8019"]
十月 20, 2016 3:27:18 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
十月 20, 2016 3:27:18 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 591 ms
十月 20, 2016 3:27:18 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
十月 20, 2016 3:27:18 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.0.24
十月 20, 2016 3:27:18 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [114] milliseconds.
十月 20, 2016 3:27:24 下午 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.
十月 20, 2016 3:27:24 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
15:27:24,414 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
15:27:24,415 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
15:27:24,415 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/D:/workspace/carloan/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/carloan1/WEB-INF/classes/logback.xml]
15:27:24,417 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
15:27:24,417 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/D:/workspace/carloan/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/carloan1/WEB-INF/lib/tess4j-3.2.1.jar!/logback.xml]
15:27:24,417 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/D:/workspace/carloan/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/carloan1/WEB-INF/classes/logback.xml]
15:27:24,576 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
15:27:24,581 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
15:27:24,603 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [stdout]
15:27:24,629 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@5:13 - no applicable action for [Encoding], current ElementPath  is [[configuration][appender][Encoding]]
15:27:24,681 |-WARN in ch.qos.logback.core.ConsoleAppender[stdout] - This appender no longer admits a layout as a sub-component, set an encoder instead.
15:27:24,681 |-WARN in ch.qos.logback.core.ConsoleAppender[stdout] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
15:27:24,681 |-WARN in ch.qos.logback.core.ConsoleAppender[stdout] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
15:27:24,681 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
15:27:24,684 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [logfile]
15:27:24,692 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@12:13 - no applicable action for [Encoding], current ElementPath  is [[configuration][appender][Encoding]]
15:27:24,705 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use gz compression
15:27:24,707 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern D:/apache-tomcat-8.0.24/logs/weixin.%d{yyyy-MM-dd}.log for the active file
15:27:24,711 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern 'D:/apache-tomcat-8.0.24/logs/weixin.%d{yyyy-MM-dd}.log.gz'.
15:27:24,711 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
15:27:24,712 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Thu Oct 20 15:26:45 CST 2016
15:27:24,715 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[logfile] - This appender no longer admits a layout as a sub-component, set an encoder instead.
15:27:24,715 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[logfile] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
15:27:24,715 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[logfile] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
15:27:24,719 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[logfile] - Active log file name: D:\apache-tomcat-8.0.24/logs/weixin.log
15:27:24,719 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[logfile] - File property is set to [D:\apache-tomcat-8.0.24/logs/weixin.log]
15:27:24,721 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.springframework level set to WARN
15:27:24,721 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.logicalcobwebs.proxool level set to WARN
15:27:24,721 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.hibernate level set to WARN
15:27:24,721 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.apache.struts2 level set to WARN
15:27:24,721 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - com.opensymphony.xwork2 level set to WARN
15:27:24,721 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.apache.activemq level set to WARN
15:27:24,721 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - ROOT level set to DEBUG
15:27:24,722 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [logfile] to Logger[ROOT]
15:27:24,722 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [stdout] to Logger[ROOT]
15:27:24,722 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
15:27:24,725 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@28ad9336 - Registering current configuration as safe fallback point

十月 20, 2016 3:27:24 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2016-10-20 15:27:26,524 [localhost-startStop-1] DEBUG org.apache.cxf.common.logging.LogUtils:140 - Using org.apache.cxf.common.logging.Slf4jLogger for logging.
2016-10-20 15:27:26,596 [localhost-startStop-1] DEBUG o.a.c.c.spring.AbstractBeanDefinitionParser:249 - Adding org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser.wireBus attribute CONSTRUCTOR to bean org.springframework.beans.factory.support.BeanDefinitionBuilder@4fac5a6d
2016-10-20 15:27:26,603 [localhost-startStop-1] DEBUG o.a.c.c.spring.AbstractBeanDefinitionParser:249 - Adding org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser.wireBus attribute CONSTRUCTOR to bean org.springframework.beans.factory.support.BeanDefinitionBuilder@634579f2
2016-10-20 15:27:29,354 [localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader:331 - Context initialization failed
java.lang.RuntimeException: null
	at org.springframework.asm.MethodVisitor.visitParameter(Unknown Source) ~[spring-core-3.2.9.RELEASE.jar:na]
	at org.springframework.asm.ClassReader.b(Unknown Source) ~[spring-core-3.2.9.RELEASE.jar:na]
	at org.springframework.asm.ClassReader.accept(Unknown Source) ~[spring-core-3.2.9.RELEASE.jar:na]
	at org.springframework.asm.ClassReader.accept(Unknown Source) ~[spring-core-3.2.9.RELEASE.jar:na]
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:64) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:71) ~[spring-context-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:255) ~[spring-context-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:225) ~[spring-context-3.2.9.RELEASE.jar:3.2.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630) ~[spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) ~[spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) ~[spring-web-3.2.9.RELEASE.jar:na]
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) ~[spring-web-3.2.9.RELEASE.jar:na]
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.9.RELEASE.jar:na]
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729) [catalina.jar:8.0.24]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167) [catalina.jar:8.0.24]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.24]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) [catalina.jar:8.0.24]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) [catalina.jar:8.0.24]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_20]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_20]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_20]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_20]
十月 20, 2016 3:27:29 下午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.RuntimeException
	at org.springframework.asm.MethodVisitor.visitParameter(Unknown Source)
	at org.springframework.asm.ClassReader.b(Unknown Source)
	at org.springframework.asm.ClassReader.accept(Unknown Source)
	at org.springframework.asm.ClassReader.accept(Unknown Source)
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:64)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
	at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
	at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:71)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:255)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:225)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	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)

十月 20, 2016 3:27:29 下午 org.apache.catalina.core.StandardContext startInternal
严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
十月 20, 2016 3:27:29 下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/carloan] startup failed due to previous errors
十月 20, 2016 3:27:29 下午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2016-10-20 15:27:29,371 [localhost-startStop-1] WARN  o.s.web.context.support.XmlWebApplicationContext:1052 - Exception thrown from ApplicationListener handling ContextClosedEvent
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Thu Oct 20 15:27:24 CST 2016]; root of context hierarchy
	at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:347) [spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334) [spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1049) [spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010) [spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:586) [spring-web-3.2.9.RELEASE.jar:na]
	at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143) [spring-web-3.2.9.RELEASE.jar:na]
	at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4776) [catalina.jar:8.0.24]
	at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5390) [catalina.jar:8.0.24]
	at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) [catalina.jar:8.0.24]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160) [catalina.jar:8.0.24]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) [catalina.jar:8.0.24]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) [catalina.jar:8.0.24]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_20]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_20]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_20]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_20]
2016-10-20 15:27:29,372 [localhost-startStop-1] WARN  o.s.web.context.support.XmlWebApplicationContext:1060 - Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Thu Oct 20 15:27:24 CST 2016]; root of context hierarchy
	at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360) [spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057) [spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010) [spring-context-3.2.9.RELEASE.jar:na]
	at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:586) [spring-web-3.2.9.RELEASE.jar:na]
	at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143) [spring-web-3.2.9.RELEASE.jar:na]
	at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4776) [catalina.jar:8.0.24]
	at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5390) [catalina.jar:8.0.24]
	at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) [catalina.jar:8.0.24]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160) [catalina.jar:8.0.24]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) [catalina.jar:8.0.24]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) [catalina.jar:8.0.24]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_20]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_20]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_20]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_20]
十月 20, 2016 3:27:29 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-nio-8087"]
十月 20, 2016 3:27:29 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-nio-8019"]
十月 20, 2016 3:27:29 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 11094 ms

pom.xml

  <!-- nutz  --> 
        <dependency>
    		<groupId>org.nutz</groupId>
    		<artifactId>nutz</artifactId>
    		<version>1.r.58</version>
		</dependency>
        <dependency>
             <groupId>org.nutz</groupId>
    		 <artifactId>nutz-integration-spring</artifactId>
             <version>1.r.58</version>
        </dependency>
        <!-- nutz -->

beans

   <bean id="nutDao" class="org.nutz.dao.impl.NutDao">
		<property name="dataSource" ref="dataSource" />
		<!-- 如果要使用Trans,移除springDaoRunner -->
		<property name="runner" ref="springDaoRunner" />
	</bean>
	<bean id="springDaoRunner" class="org.nutz.integration.spring.SpringDaoRunner">
	</bean>

这报错有点诡异,我试一下

看一下依赖,是不是引用了不正确的spring库

是我spring 3.2.9 的版本问题,wendal告诉我spring3.2.9有bug 然后我升级到 3.2.17 一切正常

谢谢了! @wendal

<spring.framework.version>3.2.17.RELEASE</spring.framework.version>
添加回复
请先登陆
回到顶部