Loading...
a_dimitrov avatar a_dimitrov 20 Точки

Ексепшън от ModelMapper

На някой да му е хвърлял ексепшън от модел мапъра. Възможно ли е да го прави, защото имам байндинг и вю модели в един пакидж. По странното е, че припознава и други сетъри o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.modelmapper.ConfigurationException: ModelMapper configuration errors: 1) The destination property bg.infologica.iso.models.equipmentModels.EquipmentViewModel.setWarrantyId() matches multiple source property hierarchies: bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getFirmId() bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getWarrantyNum() bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getWarranty_id()
Тагове:
0
Module: Java Web
vancho avatar vancho 430 Точки

По-скоро изглежда, че не можа да ти мапне dto <-> entity. Дай малко по-детайлен stacktrace.

0
a_dimitrov avatar a_dimitrov 20 Точки

2017-03-14 15:09:56.496 ERROR 6280 --- [nio-8080-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.modelmapper.ConfigurationException: ModelMapper configuration errors:

1) The destination property bg.infologica.iso.models.equipmentModels.EquipmentViewModel.setWarrantyId() matches multiple source property hierarchies:

    bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getFirmId()
    bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getWarrantyNum()
    bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getWarranty_id()

2) The destination property bg.infologica.iso.models.equipmentModels.EquipmentViewModel.setEquipmentTypeId() matches multiple source property hierarchies:

    bg.infologica.iso.entities.equipment.Equipment.getEquipmentTypeId()/bg.infologica.iso.entities.equipment.EquipmentType.getEquipmentTypeId()
    bg.infologica.iso.entities.equipment.Equipment.getEquipmentTypeId()/bg.infologica.iso.entities.equipment.EquipmentType.getEquipmentTypeName()

2 errors] with root cause

org.modelmapper.ConfigurationException: ModelMapper configuration errors:

1) The destination property bg.infologica.iso.models.equipmentModels.EquipmentViewModel.setWarrantyId() matches multiple source property hierarchies:

    bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getFirmId()
    bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getWarrantyNum()
    bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getWarranty_id()

2) The destination property bg.infologica.iso.models.equipmentModels.EquipmentViewModel.setEquipmentTypeId() matches multiple source property hierarchies:

    bg.infologica.iso.entities.equipment.Equipment.getEquipmentTypeId()/bg.infologica.iso.entities.equipment.EquipmentType.getEquipmentTypeId()
    bg.infologica.iso.entities.equipment.Equipment.getEquipmentTypeId()/bg.infologica.iso.entities.equipment.EquipmentType.getEquipmentTypeName()

2 errors
    at org.modelmapper.internal.Errors.throwConfigurationExceptionIfErrorsExist(Errors.java:241) ~[modelmapper-0.7.5.jar:na]
    at org.modelmapper.internal.ImplicitMappingBuilder.matchDestination(ImplicitMappingBuilder.java:149) ~[modelmapper-0.7.5.jar:na]
    at org.modelmapper.internal.ImplicitMappingBuilder.build(ImplicitMappingBuilder.java:82) ~[modelmapper-0.7.5.jar:na]
    at org.modelmapper.internal.TypeMapStore.getOrCreate(TypeMapStore.java:105) ~[modelmapper-0.7.5.jar:na]
    at org.modelmapper.internal.TypeMapStore.getOrCreate(TypeMapStore.java:79) ~[modelmapper-0.7.5.jar:na]
    at org.modelmapper.internal.MappingEngineImpl.map(MappingEngineImpl.java:99) ~[modelmapper-0.7.5.jar:na]
    at org.modelmapper.internal.MappingEngineImpl.map(MappingEngineImpl.java:60) ~[modelmapper-0.7.5.jar:na]
    at org.modelmapper.ModelMapper.mapInternal(ModelMapper.java:497) ~[modelmapper-0.7.5.jar:na]
    at org.modelmapper.ModelMapper.map(ModelMapper.java:340) ~[modelmapper-0.7.5.jar:na]
    at bg.infologica.iso.service.EquipmentServiceImpl.getAllEquipments(EquipmentServiceImpl.java:42) ~[classes/:na]
    at bg.infologica.iso.service.EquipmentServiceImpl$$FastClassBySpringCGLIB$$641761bd.invoke(<generated>) ~[classes/:na]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721) ~[spring-aop-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) ~[spring-aop-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at bg.infologica.iso.service.EquipmentServiceImpl$$EnhancerBySpringCGLIB$$26764548.getAllEquipments(<generated>) ~[classes/:na]
    at bg.infologica.iso.controllers.EquipmentController.getAllEquipments(EquipmentController.java:27) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.11.jar:8.5.11]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

0
vancho avatar vancho 430 Точки

Огледай там където ти се мапва, защото определено не може да ти го мапне тук (firmId, warrantyNum и warranty_id):

 

    bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getFirmId()
    bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getWarrantyNum()
    bg.infologica.iso.entities.equipment.Equipment.getWarrantyId()/bg.infologica.iso.entities.warranty.Warranty.getWarranty_id()

0
14/03/2017 15:50:58
a_dimitrov avatar a_dimitrov 20 Точки

Благодаря, :-) гугълвам все ще му излезе отнякъде грешката

0
vancho avatar vancho 430 Точки

Незнам какво ще гугълваш, нещо не ти е наред в полетата на entity-то или dto-то. Пробвай тези три полета да ги мапнеш ръчно или дай брейкпоинт там за да видиш какво става.

 

0
14/03/2017 15:59:20
a_dimitrov avatar a_dimitrov 20 Точки

Дежа Вю , беше ми неправилна връзката в ентитито и мапваше неправилни пропъртита , данке за помощта

0
14/03/2017 16:26:26
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.