unexpected exception parsing XML document from ...异常
2017年12月05日 20:26:58 守望dfdfdf 阅读数:2309更多
个人分类: Java知识
编辑
版权声明:本文为博主原创文章,转载请注明文章链接。 https://blog.csdn.net/xiaoanzi123/article/details/78724397
unexpected exception parsing XML document from .......异常
记录一下今天我碰到的这个异常,说实话不算什么大问题,要怪就怪自己经验浅薄、外加大意了吧。
我把controller里面的代码拷贝到一个新建的包下的新建类文件中,进行重构。忘记吧注解 @ controller 删除掉。
结果启动运行报上述异常。
我以为是我新建的这个类,框架找不到没法创建bean对象,就到配置文件去找配置路径去了。真是傻,配置文件里面也不会有具体到某一个类的配置啊,有也是到 包 一级别,后面用 * 来 配置,比如注册domain。 另外,这里是靠注解来进行管理的,我没有把新建包中的类文件中的@controller 去掉,导致解析出现异常。
这是我自己的想法记录吧,不知道对不对,因为我对spring原理目前一知半解,属于一瓶子不满半瓶子晃荡的水平,目前自己也在推进。如有错误真心希望不吝赐教。
=============================================================
异常null value was assigned to a property of primitive type setter of
2018年03月19日 19:43:29 守望dfdfdf 阅读数:65更多
个人分类: 工作 问题
编辑
版权声明:本文为博主原创文章,转载请注明文章链接。 https://blog.csdn.net/xiaoanzi123/article/details/79616317
数据库该字段为int类型,在使用hibernate创建对应的映射字段时也选用了int。出现此异常。因为数据库该字段
的值存在为 null的情况时,就出现问题了。
正确解决办法: bean的映射字段改int类型为包装类型Integer。
=============================================================
java.lang.NoClassDefFoundError: 2018/12/17 14:18
org/springframework/dao/support/ChainedPersistenceExceptionTranslator at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:164) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:145) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy132.getServiceOrderCountByStatus(Unknown Source) at cn.appliedata.operate.service.OperateService.getServiceOrderCountByStatus(OperateService.java:41) at cn.appliedata.operate.controller.OperateTaskController.getServiceOrderCountByStatus(OperateTaskController.java:103) at cn.appliedata.operate.controller.OperateTaskController$$FastClassBySpringCGLIB$$41dd6a37.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at cn.appliedata.log.Session2MDC.timeAround(Session2MDC.java:91) at sun.reflect.GeneratedMethodAccessor156.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) at cn.appliedata.operate.controller.OperateTaskController$$EnhancerBySpringCGLIB$$cb59bce7.getServiceOrderCountByStatus(<generated>) at sun.reflect.GeneratedMethodAccessor440.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:111) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167) at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.cloud.sleuth.instrument.web.TraceFilter.doFilter(TraceFilter.java:166) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)
生产上的错误,之前一直好好的,突然就这么个错。就是在进行数据库查询的时候,抛出的异常。
java.lang.NoClassDefFoundError: org/springframework/dao/support/ChainedPersistenceExceptionTranslator
查了一下,这个类 ChainedPersistenceExceptionTranslator到底出现在哪个jar里面:如图
网上查了下这个异常,基本上定位问题是jar冲突。到那时从目前搜索到的结构来看,不会有问题。因为别的springcloud项目模块都是和上图一样的配置。
有一种解决办法,就是直接在pom.xml指定对应的jar,pom文件中添加:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.3.16.RELEASE</version>
如下图
实际上也没有添加这个dependency,直接生产上重启服务器就没有问题了,可能上一次启动的有问题?静待观察、
=========================================================
hibernate Unknown column 'conten0_.nj_flag' in 'field list'
2018年01月05日 17:26:10 守望dfdfdf 阅读数:145 标签: hibernate 更多
个人分类: Java知识
编辑
版权声明:本文为博主原创文章,转载请注明文章链接。 https://blog.csdn.net/xiaoanzi123/article/details/78983535
使用hibernate查询数据,出现异常提示 Unknown column 'conten0_.nj_flag' in 'field list'。
说明字段映射上出现了问题。经过检查确认bean中的字段不但有与表字段映射的【@Column】,还有bean有表字段却没有的
字段【@Transient】,然后发现数据库对应表中无 NJ_FLAG 字段。问题就在此。经确认生产环境表中是有这个字段的,是开发环境的问题。
=============================================================================
cxf的webservice的Could not send Message个人问题记录
2017年04月24日 11:10:41 守望dfdfdf 阅读数:5842 标签: web servicecxfinterceptor 更多
个人分类: 工作 问题
编辑
版权声明:本文为博主原创文章,转载请注明文章链接。 https://blog.csdn.net/xiaoanzi123/article/details/70575405
cxf的webservice的Could not send Message
今日开发了cfx的webservice的三个接口,在使用soapui进行测试的时候,发现前两个
使用正常,能够正常返回数据,但是第三个,点击运行,右侧结果栏一片空白,没有任何
反应。调试证明已经取回了数据,只是没有返回来。
控制台 曾经出现如下提示:
Interceptor has thrown exception, unwinding now Could not send Message.
但是没有下文了,就这么一句话。没有具体的“at ... ”来说明具体在哪出的问题。
在网上搜索了一下这个提示,有这种问题的博客,但是对我不适用。比如这篇:
http://blog.csdn.net/rshw123456/article/details/8001677
它的异常如下:
警告: Interceptor for {http://10.98.100.150/SPSFORMES/}IOSpsForMes#{http://10.98.100.150/SPSFORMES/}SetBomNeed has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
at org.apache.cxf.endpoint.Client
。。。。。。
可见,它的异常内容很多。
既然三个接口只有一个不行,说明配置文件什么都没问题。
最简单的办法,重新部署,clean,等等,还不行,最后,重启myeclipse,问题解决。
具体原因我也不知道,可能是软件的问题吧。。。
但是这个问题
Interceptor has thrown exception, unwinding now Could not send Message.
值得注意。
==================================================================================
SSM框架---容器创建注入对象失败
2016年10月11日 23:38:15 守望dfdfdf 阅读数:2463 标签: 框架异常exception 更多
个人分类: 工作 问题
编辑
版权声明:本文为博主原创文章,转载请注明文章链接。 https://blog.csdn.net/xiaoanzi123/article/details/52793189
严重: Exception sending context initialized event to listener instance of class
org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name'bsxrServiceImpl':
Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field:
private com.bj.dao.BsxrDao com.bj.service.BsxrServiceImpl.dao; nested
exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [com.bj.dao.BsxrDao] 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)}
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'bsxrDao' defined in file [D:\workspace\.metadata\.plugins\org.eclipse.wst.server.
core\tmp0\wtpwebapps\port_1\WEB-INF\classes\com\bj\dao\BsxrDao.class]: Invocation
of init method failed; nested exception 。。。。。。。。
这个异常网上有很多说法,尝试多种办法都没有解决。
Error creating bean with name 'bsxrServiceImpl' 注解我是使用的@Autowired ,出现上述异常,困惑了将近一天;
@Autowired 后面加上 (required = false); 不再报 上述异常,但是有新异常
expected com.bj.dao.BsxrDao, but found com.bj.dao,看来是
BeanCreationException: Error creating bean with name 'bsxrServiceImpl': 这个异常把
expected com.bj.dao.BsxrDao, but found com.bj.dao异常给掩盖掉了。
@Autowired(required = false)会使expected com.bj.dao.BsxrDao, but found com.bj.dao异常显现出来,BeanCreationException: Error creating bean with name
'bsxrServiceImpl': 异常不再显示。
所以才发现根本原因,并不是spring的配置文件以及注解的错误。异常BeanCreationException: Error creating bean with name
'bsxrServiceImpl':把真是的报错原因expected com.bj.dao.BsxrDao, but found com.bj.dao给隐藏了。
异常expected com.bj.dao.BsxrDao, but found com.bj.dao就简单了,检查发现使用的mapper的动态代理,但是namespace应该写全限定性接口名,自己写错了,,更改后终于解决问题。
总结:
BeanCreationException: Error creating bean with name
'bsxrServiceImpl': 原因之一就是 mapper动态代理 mapper.xml namespace属性写错了。
感谢http://darkmasky.iteye.com/blog/1129828 博主给我的启发,非常感谢。
==================================================================================
关于ajax请求spring后台出现 Required String parameter ‘id’ is not present异常,
如果前端传入的是json数据那么后端使用
@RequestBody HashMap map
进行接收,然后再通过map.get(“id”)获取对应的数据
如果前端传入的是正常表单数据,那么后端使用
@RequestParam("id") String id或者
@RequestParam(value="id", required = false) String id接收参数
需要注意的是,如果请求类型为delete并且参数类型不是json的话,不能使用通过表单类型提交,参数需要跟到请求url后面,并且后台使用@PathVariable进行获取参数