Spring MVC Junit单元测试报错 [问题点数:100分,无满意结帖,结帖人wutian713]

Bbs1
本版专家分:0
结帖率 66.67%
Bbs1
本版专家分:6
Bbs1
本版专家分:8
Bbs1
本版专家分:0
Bbs6
本版专家分:6579
Bbs5
本版专家分:2461
Bbs1
本版专家分:0
Bbs1
本版专家分:0
Bbs1
本版专家分:30
Bbs1
本版专家分:0
spring配置事务,junit单元测试报错
junit<em>单元测试</em>内容如下rn[code=java]rnimport org.junit.Test;rnimport org.junit.runner.RunWith;rnimport org.springframework.test.context.ContextConfiguration;rnimport org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner;rnrn@RunWith(<em>Spring</em>JUnit4ClassRunner.class)rn@ContextConfiguration("classpath:applicationContext2.xml")rnpublic class TransactionTest rnrnrn @Testrn public void demo1()rnrn rn[/code]rnrnapplicationContext2.xml配置如下rn[code=text]rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn[/code]rnaccountService 和 accountDao应该没问题,就是向dao注入DataSource,向service注入daorn<em>报错</em>信息如下:rn[code=text]rn[<em>Spring</em>Transaction] 2017-06-28 16:02:15 Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@5204062d] to prepare test instance [com.mycom.spring.demo2.TransactionTest@4fcd19b3] rnjava.lang.IllegalStateException: Failed to load ApplicationContextrn at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)rn at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)rn at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)rn at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:313)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.createTest(<em>Spring</em>JUnit4ClassRunner.java:211)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner$1.runReflectiveCall(<em>Spring</em>JUnit4ClassRunner.java:288)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.methodBlock(<em>Spring</em>JUnit4ClassRunner.java:284)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.runChild(<em>Spring</em>JUnit4ClassRunner.java:231)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.runChild(<em>Spring</em>JUnit4ClassRunner.java:88)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)rn at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)rn at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:300)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.run(<em>Spring</em>JUnit4ClassRunner.java:174)rn at org.junit.runner.JUnitCore.run(JUnitCore.java:157)rn at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)rn at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)rn at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)rn at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)rnCaused by: java.lang.IllegalArgumentExceptionrn at org.springframework.asm.ClassReader.(Unknown Source)rn at org.springframework.asm.ClassReader.(Unknown Source)rn at org.springframework.asm.ClassReader.(Unknown Source)rn at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:52)rn at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)rn at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101)rn at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)rn at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:70)rn at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253)rn at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)rn at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)rn at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:106)rn at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:57)rn at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100)rn at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:248)rn at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)rn at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)rn ... 23 morern[/code]
spring+mybatis junit单元测试启动时报错
[code=java]package com.alipay.aqc.test;rnrnimport org.junit.Test;rnimport org.junit.runner.RunWith;rnimport org.springframework.beans.factory.annotation.Autowired;rnimport org.springframework.context.ApplicationContext;rnimport org.springframework.context.support.ClassPathXmlApplicationContext;rnimport org.springframework.test.context.ContextConfiguration;rnimport org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner;rnrnimport com.alipay.aqc.AQCBaseTestCase;rnimport com.alipay.aqc.common.util.ContextUtils;rnimport com.alipay.aqc.user.biz.TestUserManager;rnimport com.alipay.aqc.user.common.TestUser;rnrnrn@RunWith(<em>Spring</em>JUnit4ClassRunner.class) rn@ContextConfiguration(rn locations=rn rn "classpath:mybatismappers/*.xml",rn "classpath:applicationContext.xml",rn "classpath:springMvcConfig.xml",rn "classpath:velocity_tools.xml"rn rn ) rnrnpublic class BasicTest rn rn[/code]rnrn[code=java]public class TestUserManagerTest extends BasicTest rn @Resource //自动注入,默认按名称 rn private TestUserManager testUserManager; rn rn @Test //标明是测试方法 rn public void testSaveTestUser() rn System.out.println("****** test save testUser *****");rn TestUser tu=new TestUser(); rn tu.setName("james");rn tu.setAge(30);rn tu.setGender("男");rn tu.setTestUser_id(23000);rn tu.setEmail("lebron@qq.com");rn testUserManager.save(tu); rn Assert.assertNotNull(tu.getId()); rn rnrn[/code]rnrn配置文件在工程中的位置如下rn[img=https://img-bbs.csdn.net/upload/201506/09/1433841243_243960.jpg][/img]rnrn这几个文件夹也已经buildpathrn[img=https://img-bbs.csdn.net/upload/201506/09/1433841301_512195.jpg][/img]rnrnrn现在testSaveTestUser用junit运行的时候,启动<em>报错</em>rn严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@957e06] to prepare test instance [com.alipay.aqc.test.TestUserManagerTest@32502377]rnjava.lang.IllegalStateException: Failed to load ApplicationContextrn at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)rn at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)rn at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)rn at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.createTest(<em>Spring</em>JUnit4ClassRunner.java:211)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner$1.runReflectiveCall(<em>Spring</em>JUnit4ClassRunner.java:288)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.methodBlock(<em>Spring</em>JUnit4ClassRunner.java:290)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.runChild(<em>Spring</em>JUnit4ClassRunner.java:231)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)rn at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)rn at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:309)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.run(<em>Spring</em>JUnit4ClassRunner.java:174)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)rnCaused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file [C:\work\aqc-springmvc\aqc-user\target\classes\mybatismappers\Role.xml]; nested exception is java.net.ConnectException: Connection timed out: connectrn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:408)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)rn at org.springframework.test.context.support.AbstractGenericContextLoader.loadBeanDefinitions(AbstractGenericContextLoader.java:205)rn at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:100)rn at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)rn at org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)rn at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)rn at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)rn ... 24 morernCaused by: java.net.ConnectException: Connection timed out: connectrn at java.net.DualStackPlainSocketImpl.connect0(Native Method)rn at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)rn at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)rn at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)rn at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)rn at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)rn at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)rn at java.net.Socket.connect(Socket.java:589)rn at java.net.Socket.connect(Socket.java:538)rn at sun.net.NetworkClient.doConnect(NetworkClient.java:180)rn at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)rn at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)rn at sun.net.www.http.HttpClient.(HttpClient.java:211)rn at sun.net.www.http.HttpClient.New(HttpClient.java:308)rn at sun.net.www.http.HttpClient.New(HttpClient.java:326)rn at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1168)rn at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1104)rn at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:998)rn at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:932)rn at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1512)rn at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)rn at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)rn at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)rn at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)rn at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)rn at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)rn at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)rn at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)rn at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)rn at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)rn ... 36 morernrn求问大虾如何解决,是不是配置文件的位置有问题??急求...rn
Spring中使用SpringJunit单元测试
一般基本用法是先写一个<em>Spring</em><em>Junit</em>的<em>单元测试</em>基类,写<em>单元测试</em>类时继承该基类即可。 1.<em>Spring</em><em>Junit</em>基类 import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.j...
Spring - 5 Spring框架整合JUnit单元测试
在测试spring框架的时候,每个测试函数都要加载一遍配置文件这样很写起来繁琐,现在可以使用<em>Spring</em>框架整合JUnit<em>单元测试</em>来解决此问题。 首先需要先导入junit4环境,确保工程中有下图中的包 然后还需要导入spring-test 包 再到测试类中为类添加注解与注入用的成员变量 package demo; import javax.annotation.Resource...
Spring(五)----Spring框架整合JUnit单元测试
1. 为了简化了JUnit的测试,使用<em>Spring</em>框架也可以整合测试2. 具体步骤要求:必须先有JUnit的环境(即已经导入了JUnit4的开发环境)步骤一:在程序中引入spring-test.jar步骤二:在具体的测试类上添加注解@RunWith(<em>Spring</em>JUnit4ClassRunner.class) @ContextConfiguration(&quot;classpath:applicati...
spring项目Junit单元测试求解
小弟不才在做一个spring项目,进行JUnit<em>单元测试</em>时爆出以下异常消息,望求解rn[color=#FF0000]java.lang.NoclassDefFoundError:org/apache/commons/collections/curorableLinkedList[/color]rn希望大家多多指教rn
基于spring的junit单元测试
1,使用spring的测试套件:    在maven中加入        junit junit 4.9 test org.springframework spring-test
Freemarker 结合 Spring mvc 报错
[b]应该是配置文件的问题,看看这样配置对不对?[/b]rnrn[code=text]rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrn[/code]
Spring MVC之不报错的404错误
额,其实就是学习<em>MVC</em>期间发生了一个小插曲,我是完全按照设计规范来做的,而且配置文件也检查了好几遍程序就是一个hello程序很干净简洁……但是,就是运行之后显示404错误,在controller里打印的代码看不见说明根本就没进入controller,如果您也出现这样的问题别看控制台了,因为控制台并不能提供什么有效的信息,您可以看那一下problem那个模块,里面是不是报了跟jre或者jdk有关的错
Spring mvc 文件上传接口报错
Could not instantiate bean class [org.springframework.web.multipart.commons.CommonsMultipartFile]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframewor
跪求帮助 Spring mvc 报错
在使用spring2.5时,采用spring2.5的注解<em>MVC</em> 出现错误rn配置文件rnrnrn rn rn rnrn<em>报错</em>信息:rnorg.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate <em>Spring</em> NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/mvc]rnOffending resource: ServletContext resource [/WEB-INF/dispatcherContext.xml]rnrn解决了半天了,就不知道怎么回事,请帮忙,谢谢了
spring mvc报错,如何解决?
严重: Servlet.service() for servlet dispatcher threw exceptionrnrnorg.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException: No matching handler method found for servlet request: path '/login.xhtml', method 'GET', parameters map['op' -> array['valiCodeRedir']]
Spring框架整合Junit单元测试框架
<em>Spring</em>框架整合<em>Junit</em><em>单元测试</em>框架的必要: 正规的开发方式是将业务层和持久层称为服务器端,将web控制层 分离出来。 写服务器端的人和写前端WEB控制层的人最后要将代码进行整合。 那么写服务器端的人要对他自己写的业务层和持久层代码进行测试。就得用到<em>单元测试</em>框架。 如果不进行测试,服务器端代码有错误。前端和服务器进行整合,出现了错误。那么,写前端的人会认为是前端代码出现的错误 。实则
spring JPA集成Junit单元测试
又有一段时间没有来记录点滴了,最近忙上了物联网平台项目,物联网平台何其多,我们定位于一个追赶者,说实在的心里没有啥谱。 项目中用到了spring boot,spring data JPA等一些相对部门较新的技术,spring boot真是个好东西,将spring 大部分的组件进行了集成,提供开箱即用的功能,还有约定大于配置的原则,让小白很轻松的去将框架搭建起来,接触它时感觉喜欢上了它。 接下来讲
spring mvc环境部署报错
如下图,我部署spring mvc时报java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServet,当点击链接时就报404,请问这怎么解决?n![图片说明](https://img-ask.csdn.net/upload/201706/15/1497459159_140598.png)n![图片说明](https://img-ask.csdn.net/upload/201706/15/1497459332_743129.png)
Spring的MOVE进行Junit单元测试
<em>Spring</em>的MOVE进行<em>Junit</em><em>单元测试</em>,详细说明在: http://blog.csdn.net/xzknet/archive/2008/10/24/3135783.aspx
Spring框架整合JUnit单元测试
步骤: 1.必须先有JUnit的环境(默认会使用Eclipse导入<em>单元测试</em>的环境)!! 2…程序中引入spring-test.jar 3…具体测试类上添加注解 @RunWith注解:这个是指定使用的<em>单元测试</em>执行类,这里就指定的是<em>Spring</em>JUnit4ClassRunner.class; @ContextConfiguration注解:这个指定spring配置文件所在的路径,可以同时指定多个文件...
Spring --10.Spring框架整合JUnit单元测试
1、使用说明 为了简化JUnit测试、使用<em>Spring</em>框架也可以整合测试 2、导入依赖 pom.xml &amp;lt;dependencies&amp;gt; &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;g...
基于Spring的JUnit单元测试
基于<em>Spring</em>的JUnit4<em>单元测试</em>
Spring JUnit单元测试用例
项目整体结构创建JUnit Testcase在test/java包目录下新建JUnit Testcase类,如下所示: ApplyRequestSpeedV3Test.javapackage com.yirendai.borrowbase.node.applyrequest.yrd.fast3;import com.yirendai.borrowbase.api.ServiceResult; im
cfx SpringSpring MVC一起用报错
问题描述:rn 在做WebService的时候,用CFX技术和<em>Spring</em>进行整合,然后通过WebService的方法调用业务逻辑代码,[u][b]发现用<em>Spring</em>的依赖注入没有成功(失效)[/b][/u]。去调web.xml中有关WebService代码,程序运行成功。rnrnweb.xml文件如下rnrn[code=java]rnrnrn rn contextConfigLocationrn /WEB-INF/beanRefServer.xmlrn rn rn CXFServletrn rn org.apache.cxf.transport.servlet.CXFServletrn rn 0rn rn rn CXFServletrn /services/*rn rn rn rn rn org.springframework.web.context.ContextLoaderListenerrn rn rn rn Set Character Encodingrn rn org.springframework.web.filter.CharacterEncodingFilterrn rn rn encodingrn UTF-8rn rn rn forceEncodingrn truern rn rn rn Set Character Encodingrn /*rn rn rn rn spring3rn rn org.springframework.web.servlet.DispatcherServletrn rn 1rn rnrn rn spring3 rn /rn rn rn index.jsprn rnrn[/code]rnrnController代码rn[code=java]rn@Controllerrn@RequestMapping("/user")rnpublic class UserController rn rn private IUserService userServer;rn private IDeptService deptServer;rn rn public IDeptService getDeptService() rn return deptServer;rn rnrn public void setDeptService(IDeptService deptServer) rn this.deptServer = deptServer;rn rnrn public IUserService getUserService() rn return userServer;rn rnrn public void setUserService(IUserService userServer) rn this.userServer = userServer;rn rnrn @RequestMapping(value="/login",method=RequestMethod.POST)rn public String login(@RequestParam String name,@RequestParam String password,Model model,HttpServletRequest request) throws Exceptionrn TUser user1 = userServer.getUserByName(name);rn if(user1 == null) rn model.addAttribute("message", "用户不存在");rn return "login";rn else if(password == null || !password.equals(user1.getPassword()) )rn model.addAttribute("message", "密码错误");rn return "login";rn else rn request.getSession().setAttribute(Constants.USER_INFO_SESSION, user1);rn return "welcome";rn rn rn以下略...rn[/code]rnrn上面代码中 login()方法时,userServer为null,注入没有成功,请问为何rnrn
Junit单元测试Junit单元测试Junit单元测试
<em>Junit</em><em>单元测试</em><em>Junit</em><em>单元测试</em><em>Junit</em><em>单元测试</em><em>Junit</em><em>单元测试</em>
【解决】Junit单元测试中出现的报错
之前使用<em>Junit</em>遇到了下面的两个异常,并找到了解决方法。 java.lang.NoSuchMethodError <em>Junit</em>版本问题,在使用<em>Junit</em> 4.2 出现了以下的<em>报错</em>,换为JUnit 4.12问题解决Exception in thread "main" java.lang.NoSuchMethodError: org.junit.runner.Description.createSuit
spring boot 的junit单元测试报错。求大家~~帮忙看看。。。
[b]公司的一个项目采用了spring boot框架后。我做junit测试时<em>报错</em>。下面是代码,求解答~~。[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/96.gif][/img][/b]rnCourseTest.javarn[code=java]rn@RunWith(<em>Spring</em>JUnit4ClassRunner.class)rn@<em>Spring</em>BootTest(webEnvironment=WebEnvironment.RANDOM_PORT)rnpublic class CourseTest rn @Autowiredrn private CourseService courseService;rn @Testrn public void test()rn System.out.println("in.....");rn String orgMemberId = "b38610ec63a3480a83bd51c953fff4ca";rn List courseDtatList = null;rn courseDtatList = courseService.findContractListServiceImpl(orgMemberId);rn for(CourseData cd : courseDtatList)rn System.out.println(cd.getCoachName());rn rn rnrn[/code]rn在spring boot 1.4中<em>Spring</em>ApplicationConfiguration标记为过时了,所以官方就不建议这么使用了。我也是看到别人的博客:[url=http://412887952-qq-com.iteye.com/blog/2317832][/url]rn启动类代码:rnStartApplication.javarn[code=java]rn@<em>Spring</em>BootApplicationrn@ComponentScan(basePackages="com.wkllme")rn@EnableAutoConfiguration(exclude=DataSourceAutoConfiguration.class)rn@EnableAspectJAutoProxyrn@EnableConfigurationProperties(SystemProperty.class)rnpublic class StartApplication extends WebMvcConfigurerAdapter implements ApplicationListener rnrn @Resource(name="securityInterceptor")rn private HandlerInterceptor securityInterceptor;rn /**rn * 配置请求拦截器rn */rn @Overridern public void addInterceptors(InterceptorRegistry registry)rn rn registry.addInterceptor(securityInterceptor).addPathPatterns("/api/**").excludePathPatterns("/api/pay/**");rn rn @Overridern public void onApplicationEvent(ContextRefreshedEvent event)rn rn ApplicationContext context=event.getApplicationContext();rn if(context.getParent() != null )rn return;rn rn public static void main(String[] args)rn rn System.out.println("in----------");rn <em>Spring</em>Application.run(StartApplication.class, args);rn rnrn[/code]rn控制台错误信息:rn[code=java]rn14:43:46.806 [main] DEBUG org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner - <em>Spring</em>JUnit4ClassRunner constructor called with [class com.wkllme.test.BaseTest].rn14:43:46.835 [main] INFO org.springframework.test.context.TestContext - @ContextConfiguration not found for class [class com.wkllme.test.BaseTest]rn14:43:46.844 [main] INFO org.springframework.test.context.TestContextManager - @TestExecutionListeners is not present for class [class com.wkllme.test.BaseTest]: using defaults.rn14:43:46.869 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.wkllme.test.BaseTest]rn14:43:46.870 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.wkllme.test.BaseTest]rn14:43:46.883 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.wkllme.test.BaseTest]rn14:43:46.883 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.wkllme.test.BaseTest]rn14:43:46.884 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.wkllme.test.BaseTest]rn14:43:46.884 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.wkllme.test.BaseTest]rn14:43:46.885 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.wkllme.test.BaseTest]rn14:43:46.885 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.wkllme.test.BaseTest]rn14:43:46.886 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.wkllme.test.BaseTest]rn14:43:46.887 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.wkllme.test.BaseTest]rn14:43:46.891 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test context [[TestContext@6be46e8f testClass = BaseTest, testInstance = com.wkllme.test.BaseTest@3567135c, testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@327471b5 testClass = BaseTest, locations = '', classes = '', activeProfiles = '', contextLoader = 'null']]].rn14:43:46.893 [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@4157f54e] to prepare test instance [com.wkllme.test.BaseTest@3567135c]rn[color=#FF0000]java.lang.IllegalStateException: Failed to load ApplicationContext[/color]rn at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)rn at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)rn at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)rn at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.createTest(<em>Spring</em>JUnit4ClassRunner.java:211)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner$1.runReflectiveCall(<em>Spring</em>JUnit4ClassRunner.java:288)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.methodBlock(<em>Spring</em>JUnit4ClassRunner.java:290)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.runChild(<em>Spring</em>JUnit4ClassRunner.java:231)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)rn at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)rn at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:363)rn at org.springframework.test.context.junit4.<em>Spring</em>JUnit4ClassRunner.run(<em>Spring</em>JUnit4ClassRunner.java:174)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)rn[color=#FF0000]Caused by: java.lang.IllegalArgumentException: Can not load an ApplicationContext with a NULL 'contextLoader'. Consider annotating your test class with @ContextConfiguration.[/color]rn at org.springframework.util.Assert.notNull(Assert.java:115)rn at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:117)rn at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)rn ... 24 common frames omittedrn14:43:46.897 [main] DEBUG org.springframework.test.context.support.DirtiesContextTestExecutionListener - After test class: context [[TestContext@6be46e8f testClass = BaseTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@327471b5 testClass = BaseTest, locations = '', classes = '', activeProfiles = '', contextLoader = 'null']]], dirtiesContext [false].rn[/code]rn我还在pom.xml中配置了:rn[code=java]rnrn com.wkllme.wechat.controller.StartApplication rnrn[/code]rn求大家看一下。调了两天了 ~[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/9.gif][/img]rn我还换了另外的一种注解:rn@RunWith(<em>Spring</em>JUnit4ClassRunner.class)rn@ContextConfiguration(classes=StartApplication.class)rn@<em>Spring</em>BootTest(webEnvironment = <em>Spring</em>BootTest.WebEnvironment.RANDOM_PORT)rn还是错误(写不下了只是主要<em>报错</em>信息):rnjava.lang.IllegalStateException: Failed to load ApplicationContextrnCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.event.internalEventListenerProcessor': .......rnCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor' defined in class path resource [org/springframework/transaction/annotation/ProxyTransaction.........rnCaused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor]: Factory method 'transactionAdvisor' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: .........rnCaused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'transactionInt......
报错">spring mvc @RequestMapping("/flow_statistic.jspx")注解报错
各位大侠,本人之前使用spring mvc 的@RequestMapping,采用的是路径配置方式,例如:@RequestMapping("/hello"),一直没有问题。今天在查看其他人写的项目时,采用的是[b]@RequestMapping("/flow_statistic.jspx")[/b],我在spring 配置文件中自动扫描注解,如:rnrnrnrn在项目启动时,<em>报错</em>:如下:rnJava HotSpot(TM) Client VM warning: MaxNewSize (262144k) is equal to or greater than the entire heap (262144k). A new generation size of 262080k will be used.rn2014-7-23 0:41:35 org.apache.tomcat.util.digester.SetPropertiesRule beginrn警告: [SetPropertiesRule]Server/Service/Engine/Host/Context Setting property 'debug' to '0' did not find a matching property.rn2014-7-23 0:41:35 org.apache.catalina.core.AprLifecycleListener initrn信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\Java\jdk6\bin;E:\kaifa_gongju\tomcat-6.0.18\binrn2014-7-23 0:41:35 org.apache.coyote.http11.Http11Protocol initrn信息: Initializing Coyote HTTP/1.1 on http-80rn2014-7-23 0:41:35 org.apache.catalina.startup.Catalina loadrn信息: Initialization processed in 672 msrn2014-7-23 0:41:35 org.apache.catalina.core.StandardService startrn信息: Starting service Catalinarn2014-7-23 0:41:35 org.apache.catalina.core.StandardEngine startrn信息: Starting Servlet Engine: Apache Tomcat/6.0.18rn2014-7-23 0:41:38 org.apache.catalina.core.ApplicationContext logrn信息: Initializing <em>Spring</em> root WebApplicationContextrn2014-7-23 0:42:07 org.apache.catalina.core.ApplicationContext logrn信息: Initializing <em>Spring</em> FrameworkServlet 'JeeCmsAdmin'rn2014-7-23 0:42:17 org.apache.catalina.core.ApplicationContext logrn信息: Initializing <em>Spring</em> FrameworkServlet 'JeeCmsFront'rn00:42:20.140 ERROR org.springframework.web.servlet.DispatcherServlet - Context initialization failedrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0' defined in ServletContext resource [/WEB-INF/config/jeecms-servlet-front.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Cannot map handler 'siteFlowAct' to URL path [/flow_statistic.jspx]: There is already handler of type [class com.jeecms.cms.action.front.CmsSiteFlowAct] mapped.rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) ~[spring.beans-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) ~[spring.beans-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) ~[spring.beans-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring.beans-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) ~[spring.beans-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring.beans-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:398) ~[spring.beans-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1146) ~[spring.context-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:275) ~[spring.beans-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.DispatcherServlet.initHandlerMappings(DispatcherServlet.java:424) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:339) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:328) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:523) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:749) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51) ~[spring.context-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:97) ~[spring.context-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:68) ~[spring.context-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97) ~[spring.context-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303) ~[spring.context-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911) ~[spring.context-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428) ~[spring.context-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at javax.servlet.GenericServlet.init(GenericServlet.java:241) [javaee.jar:9.0]rn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1172) [catalina.jar:na]rn at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992) [catalina.jar:na]rn at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058) [catalina.jar:na]rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4371) [catalina.jar:na]rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) [catalina.jar:na]rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) [catalina.jar:na]rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) [catalina.jar:na]rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) [catalina.jar:na]rn at org.apache.catalina.core.StandardService.start(StandardService.java:516) [catalina.jar:na]rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) [catalina.jar:na]rn at org.apache.catalina.startup.Catalina.start(Catalina.java:578) [catalina.jar:na]rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_24]rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_24]rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_24]rn at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_24]rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) [bootstrap.jar:na]rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) [bootstrap.jar:na]rnCaused by: java.lang.IllegalStateException: Cannot map handler 'siteFlowAct' to URL path [/flow_statistic.jspx]: There is already handler of type [class com.jeecms.cms.action.front.CmsSiteFlowAct] mapped.rn at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:390) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:362) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping.detectHandlers(AbstractDetectingUrlHandlerMapping.java:82) ~[spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]rn at rn rn这种情况本人没有碰到过,百度了下,也没有找到答案。所以请大家帮我看看。谢谢!rn有意思的是去掉 自动扫描,就没问题了。rnrnrn不知道其中的原因。rn
spring mvc简单例子,启动服务器时报错
web.xml:rn[code=XML] rn <em>Spring</em> <em>MVC</em> Dispatcher Servletrn org.springframework.web.servlet.DispatcherServletrn rn contextConfigLocationrn rn /WEB-INF/annomvc.xmlrn rn rn 1rn rnrn rn <em>Spring</em> <em>MVC</em> Dispatcher Servletrn /*rn [/code]rnrnannomvc.xml:rn[code=XML]rnrnrn rnrn rnrn rn[/code]rnrnrncontroller:rn[code=Java]@Controllerrn@RequestMapping("/forum.do")rnpublic class BbtForumController rn rn //............rn[/code]rnrn错误;rn严重: Servlet /mvcspring threw load() exceptionrnjava.lang.ClassNotFoundException: org.apache.commons.logging.LogFactoryrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)rn at org.springframework.web.servlet.DispatcherServlet.(DispatcherServlet.java:206)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:513)rn at java.lang.Class.newInstance0(Class.java:355)rn at java.lang.Class.newInstance(Class.java:308)rn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116)rn at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)rn at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)rn at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)rn at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:516)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:583)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Spring MVC mybatis + maven 项目配置文件报错
[img=https://img-bbs.csdn.net/upload/201312/24/1387867430_621318.png][/img][img=https://img-bbs.csdn.net/upload/201312/24/1387867421_315198.png][/img]小弟小白, 看着网上的教程一步一步建完了项目结果配置文件<em>报错</em>了。。。求教啊。rnjunit测试也不通过。 教程上面都OK 我一步也没漏怎么就不行了馁。。。rn
spring mvc参数传递日期类型报错
解决办法 在controller里面加上@InitBinder public void initBinder(ServletRequestDataBinder  binder) { /** * 自动转换日期类型的字段格式 */        binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateF...
spring mvc ajax请求的时候报错
javax.servlet.ServletException: Could not resolve view with name ‘userList’ in servlet with name ‘springMvc’ 1.请求的方法上加上@ResponseBody注解即可
Spring MVC 注解接收json数据报错415
1.   <em>Spring</em> <em>MVC</em> 1.@RequestBody User user 注解接收json数据报415(POST请求) 解决办法:          springmvc-servlet.xml添加                                                        application/json;charset=UT
Spring mvc 集成支付宝报错 java.lang.ClassNotFoundException: com.alipay.api.internal.uti
在项目中,支付宝的sdk已经导入;编译的时候代码没有<em>报错</em>,但是在运行的时候就出错了。不知道是不是我在哪里没有配置好,求助大神帮帮忙啊。错误信息如下:rn严重: Servlet.service() for servlet [springmvc] in context with path [/mumu] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com/alipay/api/internal/util/AlipaySignature] with root causernjava.lang.ClassNotFoundException: com.alipay.api.internal.util.AlipaySignaturern at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1856)rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705)rn at com.mumu.service.OrderServiceImpl.orderAlipay(OrderServiceImpl.java:282)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)rn at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)rn at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)rn at com.sun.proxy.$Proxy29.orderAlipay(Unknown Source)rn at com.mumu.controller.alipay.AliPayController.orderAlipay(AliPayController.java:37)rn at com.mumu.controller.alipay.AliPayController$$FastClassBy<em>Spring</em>CGLIB$$753bf249.invoke()rn at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)rn at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)rn at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:58)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)rn at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)rn at com.mumu.controller.alipay.AliPayController$$EnhancerBy<em>Spring</em>CGLIB$$f4d0e6b0.orderAlipay()rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)rn at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)rn at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:111)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:806)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:729)rn at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)rn at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)rn at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)rn at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Unknown Source)
spring mvc @sessionattributes @ResponseBody 公用报错
[code="java"]rnrn@Controllerrn@RequestMapping("/user")rn@SessionAttributes(LoginConstants.CURRENT_USER)rnpublic class UserContorller rn private UserService userService;rn public UserService getUserService() rn return userService;rn rnrn @Autowiredrn public void setUserService(UserService userService) rn this.userService = userService;rn rnrn @ResponseBodyrn @RequestMapping( value="login" ,method=RequestMethod.GET)rn public String login(LoginForm loginForm,ModelMap modelMap)rn UserEntity userEntity = new UserEntity();rn userEntity.setName(loginForm.getName());rn userEntity.setPassword(loginForm.getPassword());rn userEntity = userService.login(userEntity);rn if(null != userEntity)//登录成功rn modelMap.addAttribute(LoginConstants.CURRENT_USER, userEntity);rn return "ok";rn else//登录失败 rn return "error";rn rn rnrn[/code]rnrn<em>报错</em>如下错误:rn[code="java"]rn 严重: Servlet.service() for servlet springmvc threw exceptionrnjava.lang.IllegalStateException: Cannot create a session after the response has been committedrn at org.apache.catalina.connector.Request.doGetSession(Request.java:2400)rn at org.apache.catalina.connector.Request.getSession(Request.java:2120)rn at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)rn[/code]
spring mvc返回空白页面!不报错
底下是整个项目的结构,用的maven搭建的,头次用很多东西不熟悉[img=https://img-bbs.csdn.net/upload/201406/12/1402506767_115036.jpg][/img]rn下边是spring mvc的配置rn[code=html]rnrn rn rn rn rn rn rn rnrnrn[/code]rnrn下边是控制层方法的代码rn[code=java]package xieguannan.store.user.action;rnrnimport javax.servlet.http.HttpServletRequest;rnrnimport org.springframework.beans.factory.annotation.Autowired;rnimport org.springframework.stereotype.Controller;rnimport org.springframework.web.bind.annotation.RequestMapping;rnimport org.springframework.web.bind.annotation.RequestMethod;rnimport org.springframework.web.servlet.ModelAndView;rnrnimport xieguannan.store.user.business.UserBusiness;rnimport xieguannan.store.user.entity.User;rnrn@Controllerrn@RequestMapping("/user")rnpublic class UserAction rn @Autowiredrn private UserBusiness userBusiness;rn @RequestMapping("/list")rn public String list(HttpServletRequest request)rn System.out.println("test");rn return "index";rn rn rn @RequestMapping("add")rn public ModelAndView add()rn System.out.println("add");rn return new ModelAndView("store/user/createUser");rn rn rn @RequestMapping(value="createUser",method=RequestMethod.POST)rn public String createUser(User user)rn userBusiness.createUser(user);rn return "index";rn rnrn[/code]rnrn现在问题是启动服务器以后,访问http://localhost:8080/mywebsite/user/list.do ,控制台会打印出test字符,说明已经进入相应的方法了,配置是没有问题的!但是问题就是每次什么错误都不报,返回页面就是空,什么都没有!这是为什么啊?研究半天还没找到问题,求大神指点。。配置文件里路径我都改了不知道多少次了,就是prefix那个属性后的。rn页面代码很简单.rn[code=html]rnrn Hello World!rnrnrn[/code]
Spring MVC 上传文件报错java.net.SocketException: Broken pipe
首先 我的windows本地是没问题的 跑到linux服务器上才出的问题rn我用的<em>Spring</em><em>MVC</em>rnspring-servlet.xml配置了rn[code=java]rnrnrnrnrn[/code]rn后台rn[code=java]rn@RequestMapping(value = "/uploadfile/add")rnpublic String add(HttpServletRequest request, UploadFileModel model,rn @RequestParam(value = "myfile") MultipartFile file rn // XXX业务处理rn}rn[/code]rn我试过1M 2M左右及以下的上传没问题的rn超过就不行了rn上面的add方法都进不去rn浏览器反应:rn卡了40秒左右 之后跳出连接被重置rn之后后台<em>报错</em>rn[code=java]rnDec 15, 2015 9:06:59 AM org.apache.jk.core.MsgContext actionrnWARNING: Unable to send headersrnjava.net.SocketException: Broken pipern at java.net.SocketOutputStream.socketWrite0(Native Method)rn at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)rn at java.net.SocketOutputStream.write(SocketOutputStream.java:159)rn at org.apache.jk.common.ChannelSocket.send(ChannelSocket.java:532)rn at org.apache.jk.common.JkInputStream.appendHead(JkInputStream.java:326)rn at org.apache.jk.core.MsgContext.action(MsgContext.java:266)rn at org.apache.coyote.Response.action(Response.java:183)rn at org.apache.coyote.Response.sendHeaders(Response.java:379)rn at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:305)rn at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:288)rn at org.apache.catalina.connector.Response.flushBuffer(Response.java:548)rn at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:344)rn at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:286)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)rn at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)rn at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)rn at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)rn at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)rn at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)rn at java.lang.Thread.run(Thread.java:744)rnrnDec 15, 2015 9:06:59 AM org.apache.jk.common.ChannelSocket processConnectionrnWARNING: processCallbacks status 2rn[/code]rn还有疑问的可以问我rn在线等
maven项目Spring MVC中使用@Autowired报错
这是controll代码[img=https://img-bbs.csdn.net/upload/201707/17/1500278029_496016.png][/img]rn这是service[img=https://img-bbs.csdn.net/upload/201707/17/1500278101_382487.png][/img]rnseviceimpl[img=https://img-bbs.csdn.net/upload/201707/17/1500278144_29374.png][/img]rnsping-mvc[img=https://img-bbs.csdn.net/upload/201707/17/1500278239_752525.png][/img]rn普通的访问项目就没问题,用控制层里Login/getLogin.do就<em>报错</em>rnServlet.service() for servlet [<em>Spring</em><em>MVC</em>] in context with path [/center] threw exception [Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private goss.service.UserService goss.controller.LoginController.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [goss.service.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)] with root causernorg.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [goss.service.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)
JUnit单元测试
添加<em>Junit</em>4包:项目右键--》properties--》libaries--》add libaries(<em>Junit</em>4) 使Java类生成相应的测试类:类右键--》new--》<em>Junit</em> Test Case--》选中需要选择的选项(方法级初始化资源/销毁资源,类级初始化资源/销毁资源)setUp/tearDown/setUpBeforeClass--》finish 运行测试类
junit单元测试
NULL 博文链接:https://wenzongliang.iteye.com/blog/1409585
Junit单元测试
<em>Junit</em><em>单元测试</em>(白盒测试中的一种): 1.黑盒测试(不需要写代码): 给输入值,看程序是否能够输出期望的值 2.白盒测试(需要写代码): 关注程序的具体执行流程 <em>Junit</em>使用步骤: 1.定义一个测试类(测试用例): 测试类名:被测试的类名+Test 包名:xxx.xxx.xx.test 2.定义测试方法: 不能使用static修饰 方...
jUnit单元测试
转载jUnit<em>单元测试</em>,感谢原著分享 从头学jUnit,简单介绍一些功能,和一些问题的解决办法 先介绍一些jUnit4.x的标签  Annotation Description @Test 声明测试方法 @Before 每个测试运行前执行,提供测试环境(比如读数据,实例初始化) @After 每个测试运行后执行,清空测试环境(删除临时数据等) @B...
spring mvc 加上tx:annotation-driven标签报错
[code=Java]rnorg.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext-aop.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/support/BeanDefinitionRegistry;Lorg/springframework/beans/factory/parsing/ComponentRegistrar;Ljava/lang/Object;Ljava/lang/Boolean;)Vrn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)rn at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)rn at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)rn at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)rn at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:509)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:427)rn at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:294)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:215)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:516)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:578)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)rnCaused by: java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/support/BeanDefinitionRegistry;Lorg/springframework/beans/factory/parsing/ComponentRegistrar;Ljava/lang/Object;Ljava/lang/Boolean;)Vrn at org.springframework.transaction.config.TxAnnotationDrivenExecutor$AopAutoProxyConfigurer.configureAutoProxyCreator(TxAnnotationDrivenExecutor.java:102)rn at org.springframework.transaction.config.TxAnnotationDrivenExecutor.doExecute(TxAnnotationDrivenExecutor.java:11)rn at org.springframework.transaction.config.TxAnnotationDrivenExecutor.doExecute(TxAnnotationDrivenExecutor.java:1)rn at org.springframework.context.config.AbstractSpecificationExecutor.execute(AbstractSpecificationExecutor.java:43)rn at org.springframework.context.config.AbstractFeatureSpecification.execute(AbstractFeatureSpecification.java:75)rn at org.springframework.context.config.AbstractSpecificationBeanDefinitionParser.parse(AbstractSpecificationBeanDefinitionParser.java:44)rn at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)rn at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1411)rn at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1401)rn at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:188)rn at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:144)rn at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:114)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)rn ... 37 morern2011-10-13 10:02:52 org.apache.catalina.core.StandardContext listenerStartrn[/code]rnrn我想使用<em>Spring</em>最新的全Annotation方式还有@Transactional,但无奈在配置文件里加上就<em>报错</em>了。rnrn配置文件如下:rn[code=Java]rnrnrnrnrn rnrnrn[/code]
MVCSpring MVC 学习笔记
一、<em>MVC</em> 1、Model 模型层,可以简单理解就是数据层,用于提供数据。在项目中,(简单理解)一般把数据访问和操作,比如将对象关系映射这样的代码作为Model层,也就是对数据库的操作这一些列的代码作为Model层。比如代码中我们会写DAO和DTO类型的代码,那这个DAO和DTO我们可以理解为是属于Model层的代码。 2、View 视图层,就是UI界面,用于跟用户进行交互。一般所有的JSP、Ht...
程序设计实践.rar下载
本书是Brian W. Kernighan和Rob Pike合著的最新力作。本书从排错、测试、性能、可移植性、设计、界面、风格和记法等方面,讨论了程序设计中实际的、又是非常深刻和具有广泛意义的思想、技术和方法,它的翻译出版将填补国内目前这方面书籍的空白。本书值得每个梦想并努力使自己成为优秀程序员的人参考,值得每个计算机专业的学生和计算机工作者阅读,也可作为程序设计高级课程的教材或参考书。 相关下载链接:[url=//download.csdn.net/download/sadhorse/1967041?utm_source=bbsseo]//download.csdn.net/download/sadhorse/1967041?utm_source=bbsseo[/url]
BB2开发帮助下载
BB2开发帮助 相关下载链接:[url=//download.csdn.net/download/wl784420835/4142014?utm_source=bbsseo]//download.csdn.net/download/wl784420835/4142014?utm_source=bbsseo[/url]
基于单片机控制的数码管驱动电路下载
基于单片机控制的数码管驱动电路 相关下载链接:[url=//download.csdn.net/download/owl12345/4798868?utm_source=bbsseo]//download.csdn.net/download/owl12345/4798868?utm_source=bbsseo[/url]
相关热词 c# 线程结束时执行 c# kb mb 图片 c# 替换第几位字符 c#项目决定成败 c# 与matlab c# xml缩进 c#传感器基础 c#操作wps c# md5使用方法 c# 引用父窗口的组件
我们是很有底线的