我想在我的项目中加入orika。 我有BaseEntity&只有Id列的BaseEntityDAO类。 而那些由BaseAuditEntity&分别是BaseAuditEntityDTO类。这些类具有审计列,如created by,created_date,updated_by,updated_datetime。 然后,实际的Entity和DTO类继承的这些类依赖于是否获得审计列。
我有一个BaseServiceBean,它接受ParameterizedTypes并具有基本的CRUD实现。所以在这里我从orika文档中考虑了this例子。 所以我的问题是,当它实际映射数据时,我收到以下错误消息.....
javax.faces.el.EvaluationException: java.lang.VerifyError: Inconsistent args count operand in invokeinterface
异常详细信息:
地点:
ma / glasnost / orika / generated / Orika_UsersDTO_Users_Mapper25974687500962 $ 0.mapAtoB(Ljava / lang / Object; Ljava / lang / Object; Lma / glasnost / orika / MappingContext;)V @ 59:invokeinterface
原因:
字节码中存在错误
字节码:
0000000:2a2b 2c2d b700 0c2b c000 0e3a 042c c000
0000010:103a 0519 04b6 0016 c000 1801 a500 2d19
0000020:052a b400 1e03 32c0 0020 1904 b600 16c0
0000030:0018 2ab4 0024 0332 c000 26b9 002a 0400
0000040:c000 2cb6 0032 a700 0919 0501 b600 3219
0000050:04b6 0036 c000 3801 a500 2d19 052a b400
0000060:1e04 32c0 0020 1904 b600 36c0 0038 2ab4
0000070:0024 0432 c000 26b9 002a 0400 c000 38b6
0000080:003c a700 0919 0501 b600 3c19 0519 04b6
0000090:003f c000 18b6 0043 1905 1904 b600 46c0
00000a0:0018 b600 4919 0519 04b6 004c c000 18b6
00000b0:004f 1905 1904 b600 52c0 0018 b600 5519
00000c0:0519 04b6 005b c000 2cb6 0060 1905 1904
00000d0:b600 63c0 0018 b600 6619 0519 04b6 0069
00000e0:c000 18b6 006c 1905 1904 b600 6fc0 0018
00000f0:b600 7219 0519 04b6 0075 c000 18b6 0078
0000100:1905 1904 b600 7bc0 0018 b600 7e19 04b6
0000110:0081 c000 1801 a500 2d19 052a b400 1e03
0000120:32c0 0020 1904 b600 81c0 0018 2ab4 0024
0000130:0332 c000 26b9 002a 0400 c000 2cb6 0084
0000140:a700 0919 0501 b600 8419 04b6 0087 c000
0000150:3801 a500 2d19 052a b400 1e04 32c0 0020
0000160:1904 b600 87c0 0038 2ab4 0024 0432 c000
0000170:26b9 002a 0400 c000 38b6 008a a700 0919
0000180:0501 b600 8a19 0519 04b6 008d c000 18b6
0000190:0090 1905 1904 b600 93c0 0018 b600 962a
00001a0:b400 9a01 a500 112a b400 9a19 0419 052d
00001b0:b900 9d04 00b1
Stackmap表:
append_frame(@ 73,对象[#14],对象[#16])
same_frame(@ 79)
same_frame(@ 133)
same_frame(@ 139)
same_frame_extended(@ 323)
same_frame(@ 329)
same_frame(@ 383)
same_frame(@ 389)
same_frame(@ 437)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.logging.log4j.core.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:66)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:724)
引起:java.lang.VerifyError:invokeinterface中的args计数操作数不一致
例外细节:
地点:
ma / glasnost / orika / generated / Orika_UsersDTO_Users_Mapper25974687500962 $ 0.mapAtoB(Ljava / lang / Object; Ljava / lang / Object; Lma / glasnost / orika / MappingContext;)V @ 59:invokeinterface
原因:
字节码中存在错误
字节码:
0000000:2a2b 2c2d b700 0c2b c000 0e3a 042c c000
0000010:103a 0519 04b6 0016 c000 1801 a500 2d19
0000020:052a b400 1e03 32c0 0020 1904 b600 16c0
0000030:0018 2ab4 0024 0332 c000 26b9 002a 0400
0000040:c000 2cb6 0032 a700 0919 0501 b600 3219
0000050:04b6 0036 c000 3801 a500 2d19 052a b400
0000060:1e04 32c0 0020 1904 b600 36c0 0038 2ab4
0000070:0024 0432 c000 26b9 002a 0400 c000 38b6
0000080:003c a700 0919 0501 b600 3c19 0519 04b6
0000090:003f c000 18b6 0043 1905 1904 b600 46c0
00000a0:0018 b600 4919 0519 04b6 004c c000 18b6
00000b0:004f 1905 1904 b600 52c0 0018 b600 5519
00000c0:0519 04b6 005b c000 2cb6 0060 1905 1904
00000d0:b600 63c0 0018 b600 6619 0519 04b6 0069
00000e0:c000 18b6 006c 1905 1904 b600 6fc0 0018
00000f0:b600 7219 0519 04b6 0075 c000 18b6 0078
0000100:1905 1904 b600 7bc0 0018 b600 7e19 04b6
0000110:0081 c000 1801 a500 2d19 052a b400 1e03
0000120:32c0 0020 1904 b600 81c0 0018 2ab4 0024
0000130:0332 c000 26b9 002a 0400 c000 2cb6 0084
0000140:a700 0919 0501 b600 8419 04b6 0087 c000
0000150:3801 a500 2d19 052a b400 1e04 32c0 0020
0000160:1904 b600 87c0 0038 2ab4 0024 0432 c000
0000170:26b9 002a 0400 c000 38b6 008a a700 0919
0000180:0501 b600 8a19 0519 04b6 008d c000 18b6
0000190:0090 1905 1904 b600 93c0 0018 b600 962a
00001a0:b400 9a01 a500 112a b400 9a19 0419 052d
00001b0:b900 9d04 00b1
Stackmap表:
append_frame(@ 73,对象[#14],对象[#16])
same_frame(@ 79)
same_frame(@ 133)
same_frame(@ 139)
same_frame_extended(@ 323)
same_frame(@ 329)
same_frame(@ 383)
same_frame(@ 389)
same_frame(@ 437)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483)
at java.lang.Class.getConstructor0(Class.java:2793)
at java.lang.Class.newInstance(Class.java:345)
at ma.glasnost.orika.impl.generator.SourceCodeContext.getInstance(SourceCodeContext.java:264)
at ma.glasnost.orika.impl.generator.MapperGenerator.build(MapperGenerator.java:72)
at ma.glasnost.orika.impl.DefaultMapperFactory.buildMapper(DefaultMapperFactory.java:1190)
at ma.glasnost.orika.impl.DefaultMapperFactory.lookupMapper(DefaultMapperFactory.java:651)
at ma.glasnost.orika.impl.DefaultMapperFactory.lookupMapper(DefaultMapperFactory.java:609)
at ma.glasnost.orika.impl.MapperFacadeImpl.resolveMapper(MapperFacadeImpl.java:531)
at ma.glasnost.orika.impl.MapperFacadeImpl.resolveMappingStrategy(MapperFacadeImpl.java:206)
at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:694)
at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:675)
at za.co.insa.service.UsersServiceBean.getEntityDTO(UsersServiceBean.java:21)
at za.co.insa.service.UsersServiceBean.getEntityDTO(UsersServiceBean.java:15)
at za.co.insa.service.BaseServiceBean.findAll(BaseServiceBean.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy278.findAll(Unknown Source)
at za.co.insa.utils.LoginController.doLogin(LoginController.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.el.parser.AstValue.invoke(AstValue.java:275)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
... 68 more
我在从数据库获取实体后尝试从实体映射到DTO时收到此错误。
答案 0 :(得分:1)
我发现orika有一些依赖,我必须在pom.xml中添加它们。
<!-- Orika-->
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-core</artifactId>
<version>1.4.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.paranamer</groupId>
<artifactId>paranamer</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.googlecode.concurrentlinkedhashmap</groupId>
<artifactId>concurrentlinkedhashmap-lru</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.carrotsearch</groupId>
<artifactId>java-sizeof</artifactId>
<version>0.0.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
Abover提到的是家属。不知道哪一个确切地解决了问题并且不知道我们是否需要所有这些。
由于