BUG搜集分类与解析
1.Mybatis框架
(1)报错信息:
Exception in thread “main” org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.itheima.dao.IUserDao.findAll
原因解析:
改为findAll即可正常执行。
(2)警告信息:
Sat Mar 13 11:26:10 CST 2021 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
原因解析:
原因是MySQL在高版本需要指明是否进行SSL连接。
在mysql连接字符串url中加入ssl=true或者false即可:
修改配置后执行,警告消失。
(3)
org.apache.ibatis.exceptions.PersistenceException:
Error building SqlSession.
Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 111; 对实体 “characterEncoding” 的引用必须以 ‘;’ 分隔符结尾。
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)
at com.itheima.test.MybastisCRUDTest.init(MybastisCRUDTest.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner 2. e v a l u a t e ( P a r e n t R u n n e r . j a v a : 268 ) a t o r g . j u n i t . r u n n e r s . P a r e n t R u n n e r . r u n ( P a r e n t R u n n e r . j a v a : 363 ) a t o r g . j u n i t . r u n n e r . J U n i t C o r e . r u n ( J U n i t C o r e . j a v a : 137 ) a t c o m . i n t e l l i j . j u n i t 4. J U n i t 4 I d e a T e s t R u n n e r . s t a r t R u n n e r W i t h A r g s ( J U n i t 4 I d e a T e s t R u n n e r . j a v a : 68 ) a t c o m . i n t e l l i j . r t . e x e c u t i o n . j u n i t . I d e a T e s t R u n n e r 2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner 2.evaluate(ParentRunner.java:268)atorg.junit.runners.ParentRunner.run(ParentRunner.java:363)atorg.junit.runner.JUnitCore.run(JUnitCore.java:137)atcom.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)atcom.intellij.rt.execution.junit.IdeaTestRunnerRepeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 111; 对实体 “characterEncoding” 的引用必须以 ‘;’ 分隔符结尾。
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:263)
at org.apache.ibatis.parsing.XPathParser.(XPathParser.java:127)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.(XMLConfigBuilder.java:81)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:77)
… 25 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 111; 对实体 “characterEncoding” 的引用必须以 ‘;’ 分隔符结尾。
原因解析:
mybatis中url的属性设置连接不能使用&符号
应该使用&;
改正后正常运行
(4)绑定错误
原因解析:
解决后正常运行
(5)
Error updating database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘useraddress’ in ‘class com.itheima.domain.User’
2.SSM+三层架构(项目)
2.1 前端登录
页面地址
3.Spring
(1)
原因;
修改一致后正常执行。
(2)
严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@4501b7af] to prepare test instance [com.cskaoyan.MyTest@2b662a77]
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.cskaoyan.MyTest’: Unsatisfied dependency expressed through field ‘userService’; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type ‘com.cskaoyan.service.UserService’ available: expected single matching bean but found 2: userServiceImpl,userServiceProxy
原因:
原本在service中就定义了一个userService,但此处用的是JDK重新生成一个新的userService代理,导致出现两个userService而冲突。
改正:
使用@Qualifier指定某个userService
(3)
严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@464bee09] to prepare test instance [com.cskaoyan.MyTest@5ddeb7cb]
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.cskaoyan.MyTest’: Unsatisfied dependency expressed through field ‘accountService’; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type ‘com.cskaoyan.service.AccountService’ available: expected single matching bean but found 2: accountServiceImpl,org.springframework.transaction.interceptor.TransactionProxyFactoryBean#0
(4)
警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘accountServiceImpl’: Unsatisfied dependency expressed through field ‘transactionTemplate’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘org.springframework.transaction.support.TransactionTemplate’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
四月 01, 2021 10:38:36 下午 com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl info
信息: {dataSource-0} closing …
四月 01, 2021 10:38:36 下午 org.springframework.test.context.TestContextManager prepareTestInstance
严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@3abbfa04] to prepare test instance [com.cskaoyan.MyTest@413d1baf]
java.lang.IllegalStateException: Failed to load ApplicationContext
解决方法:
在spring配置中注册该信息或者去掉该信息,则正常运行