java小白日常报错

java小白日常报错

CRM项目中使用逆向工程生成mappper.xml文件、pojo文件、和mapper文件时产生的错误*

作为一个java小白人,开始学习写博客,一个是为了为了记笔记,另一个是为了让更多小白解决错误,不喜勿喷

错误类型

启动tomcat后,出现下边错误:
Illegal access: this web application instance has been stopped already. Could not load .The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
然后就不停的弹出上边这一句
再去查看上边异常:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.powernode.setting.service.UserService com.powernode.setting.controller.UserController.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userServiceImpl’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.powernode.setting.mapper.TblUserMapper com.powernode.setting.service.impl.UserServiceImpl.tblUserMapper; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘tblUserMapper’ defined in file [D:\sh2020\four\class\spring-ssm\target\classes\com\powernode\setting\mapper\TblUserMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’: : Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [spring/spring-tx.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [D:\sh2020\four\class\spring-ssm\target\classes\mapper\TblUserMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘file [D:\sh2020\four\class\spring-ssm\target\classes\mapper\TblUserMapper.xml]’. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘com.powernode.pojo.TblUser’. Cause: java.lang.ClassNotFoundException: Cannot find class: com.powernode.pojo.TblUser; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [spring/spring-tx.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [D:\sh2020\four\class\spring-ssm\target\classes\mapper\TblUserMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘file [D:\sh2020\four\class\spring-ssm\target\classes\mapper\TblUserMapper.xml]’. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘com.powernode.pojo.TblUser’. Cause: java.lang.ClassNotFoundException: Cannot find class: com.powernode.pojo.TblUser
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory 1. g e t O b j e c t ( A b s t r a c t B e a n F a c t o r y . j a v a : 306 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t S i n g l e t o n B e a n R e g i s t r y . g e t S i n g l e t o n ( D e f a u l t S i n g l e t o n B e a n R e g i s t r y . j a v a : 230 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . d o G e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 302 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . g e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 197 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t L i s t a b l e B e a n F a c t o r y . p r e I n s t a n t i a t e S i n g l e t o n s ( D e f a u l t L i s t a b l e B e a n F a c t o r y . j a v a : 772 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . f i n i s h B e a n F a c t o r y I n i t i a l i z a t i o n ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 839 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . r e f r e s h ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 538 ) a t o r g . s p r i n g f r a m e w o r k . w e b . c o n t e x t . C o n t e x t L o a d e r . c o n f i g u r e A n d R e f r e s h W e b A p p l i c a t i o n C o n t e x t ( C o n t e x t L o a d e r . j a v a : 446 ) a t o r g . s p r i n g f r a m e w o r k . w e b . c o n t e x t . C o n t e x t L o a d e r . i n i t W e b A p p l i c a t i o n C o n t e x t ( C o n t e x t L o a d e r . j a v a : 328 ) a t o r g . s p r i n g f r a m e w o r k . w e b . c o n t e x t . C o n t e x t L o a d e r L i s t e n e r . c o n t e x t I n i t i a l i z e d ( C o n t e x t L o a d e r L i s t e n e r . j a v a : 107 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . S t a n d a r d C o n t e x t . l i s t e n e r S t a r t ( S t a n d a r d C o n t e x t . j a v a : 4939 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . S t a n d a r d C o n t e x t . s t a r t I n t e r n a l ( S t a n d a r d C o n t e x t . j a v a : 5434 ) a t o r g . a p a c h e . c a t a l i n a . u t i l . L i f e c y c l e B a s e . s t a r t ( L i f e c y c l e B a s e . j a v a : 150 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . C o n t a i n e r B a s e 1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase 1.getObject(AbstractBeanFactory.java:306)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)atorg.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.core.ContainerBaseStartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase S t a r t C h i l d . c a l l ( C o n t a i n e r B a s e . j a v a : 1549 ) a t j a v a . u t i l . c o n c u r r e n t . F u t u r e T a s k . r u n ( F u t u r e T a s k . j a v a : 266 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r . r u n W o r k e r ( T h r e a d P o o l E x e c u t o r . j a v a : 1142 ) a t j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor StartChild.call(ContainerBase.java:1549)atjava.util.concurrent.FutureTask.run(FutureTask.java:266)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)atjava.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.C
lassNotFoundException: Cannot find class: com.powernode.pojo.TblUser
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:200)
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)
at org.apache.ibatis.io.Resources.classForName(Resources.java:261)
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116)
… 69 more

主要是因为逆行工程插件生成文件路径和自己的文件不匹配,因为我是粘贴过来的,后来检查了pojo最上头的路径,mapper文件的路径,mapper.xml的路径,发现有一个***xml文件引用实体类路径***错了,而且xml文件中每一个sql语句都有配套路径,所以使用逆向工程生成,或者是自己手写的童鞋千万要注意!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值