- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个 Rest 服务(SpringBoot 应用程序),如果我向处理请求的 Rest Controller 方法添加 @Valid 注释,它会引发异常。
@RequestMapping(value="/api/something", method = RequestMethod.POST)
@ResponseStatus(code = HttpStatus.CREATED)
public Long doSomething(@Valid @RequestBody Data data) throws CustomException {
return service.save(data).getId();
}
此错误仅在运行时发生,此应用程序启动时没有任何问题。如果我删除 @Valid 注释,请求将通过,但 Bean 验证将被忽略。
这是我在日志文件中观察到的内容。
2018-11-27 12:23:04,577 DEBUG [Default Executor-thread-331] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor - Read [class com.acme.Data] as "application/json;charset=UTF-8" with [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@2d98d21d]
2018-11-27 12:23:04,578 DEBUG [Default Executor-thread-331] DEBUG org.springframework.core.annotation.AnnotationUtils - Failed to meta-introspect annotation class com.sun.proxy.$Proxy418: java.lang.NoSuchMethodException: javax.validation.Valid.value()
2018-11-27 12:23:04,580 DEBUG [Default Executor-thread-331] DEBUG org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver - Resolving exception from handler [public java.lang.Long com.acme.Controller.doSomething(com.acme.Data) throws com.acme.SomeException]: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/Persistence
Eclipse 控制台中显示错误
Application Exception StackTrace: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/Persistence
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1006)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1255)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:743)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:440)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:147)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:158)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:126)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:111)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:130)
at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66)
at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:105)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.boot.web.se
rvlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:995)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1124)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4962)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:314)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:995)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:279)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:957)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:357)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:316)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:499)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:433)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:313)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:284)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:165)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:74)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:501)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:571)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:926)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1015)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: javax/persistence/Persistence
at org.apache.bval.jsr.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:34)
at org.apache.bval.jsr.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:58)
at org.apache.bval.jsr.resolver.CachingTraversableResolver.isReachable(CachingTraversableResolver.java:81)
at org.apache.bval.jsr.ConstraintValidation.isReachable(ConstraintValidation.java:454)
at org.apache.bval.jsr.ConstraintValidation.validateGroupContext(ConstraintValidation.java:188)
at org.apache.bval.jsr.ConstraintValidation.validate(ConstraintValidation.java:145)
at org.apache.bval.util.ValidationHelper.validateProperty(ValidationHelper.java:236)
at org.apache.bval.jsr.ClassValidator.validateBean(ClassValidator.java:460)
at org.apache.bval.jsr.ClassValidator.validateBeanNet(ClassValidator.java:406)
at org.apache.bval.jsr.ClassValidator.validateBeanWithGroups(ClassValidator.java:152)
at org.apache.bval.jsr.ClassValidator.validate(ClassValidator.java:139)
at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:120)
at org.springframework.boot.autoconfigure.validation.ValidatorAdapter.validate(ValidatorAdapter.java:69)
at org.springframework.validation.DataBinder.validate(DataBinder.java:871)
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.validateIfApplicable(AbstractMessageConverterMethodArgumentResolver.java:260)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:136)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:124)
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:161)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:131)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
... 98 more
Caused by: java.lang.ClassNotFoundException: javax.persistence.Persistence cannot be found by com.ibm.ws.org.apache.bval.1.1.0_1.0.19.201712061531
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 122 more
这是我的依赖树
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ api-web-portal ---
[INFO] com.acme:my-web-portal:jar:1.0.0-beta-SNAPSHOT
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.5:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.9:compile
[INFO] | \- commons-codec:commons-codec:jar:1.11:compile
[INFO] +- org.apache.httpcomponents:httpmime:jar:4.5.5:compile
[INFO] +- org.apache.tika:tika-parsers:jar:1.2:compile
[INFO] | +- org.apache.tika:tika-core:jar:1.2:compile
[INFO] | +- org.gagravarr:vorbis-java-tika:jar:0.1:compile
[INFO] | | \- org.gagravarr:vorbis-java-core:jar:tests:0.1:test,provided
[INFO] | +- edu.ucar:netcdf:jar:4.2-min:compile
[INFO] | +- org.apache.james:apache-mime4j-core:jar:0.7.2:compile
[INFO] | +- org.apache.james:apache-mime4j-dom:jar:0.7.2:compile
[INFO] | +- org.apache.commons:commons-compress:jar:1.4.1:compile
[INFO] | | \- org.tukaani:xz:jar:1.0:compile
[INFO] | +- org.bouncycastle:bcmail-jdk15:jar:1.45:compile
[INFO] | +- org.bouncycastle:bcprov-jdk15:jar:1.45:compile
[INFO] | +- org.apache.poi:poi:jar:3.8:compile
[INFO] | +- org.apache.poi:poi-scratchpad:jar:3.8:compile
[INFO] | +- org.apache.poi:poi-ooxml:jar:3.8:compile
[INFO] | | +- org.apache.poi:poi-ooxml-schemas:jar:3.8:compile
[INFO] | | | \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] | | \- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
[INFO] | +- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:compile
[INFO] | +- asm:asm:jar:3.1:compile
[INFO] | +- com.googlecode.mp4parser:isoparser:jar:1.0-RC-1:compile
[INFO] | | \- org.aspectj:aspectjrt:jar:1.8.13:compile
[INFO] | +- com.drewnoakes:metadata-extractor:jar:2.4.0-beta-1:compile
[INFO] | +- de.l3s.boilerpipe:boilerpipe:jar:1.1.0:compile
[INFO] | +- rome:rome:jar:0.9:compile
[INFO] | +- org.gagravarr:vorbis-java-core:jar:0.1:compile
[INFO] | \- com.googlecode.juniversalchardet:juniversalchardet:jar:1.0.3:compile
[INFO] +- org.apache.pdfbox:pdfbox:jar:2.0.12:compile
[INFO] | +- org.apache.pdfbox:fontbox:jar:2.0.12:compile
[INFO] | \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- commons-io:commons-io:jar:2.6:compile
[INFO] +- org.springframework.boot:spring-boot-starter-activemq:jar:2.0.3.RELEASE:compile
[INFO] | +- org.springframework:spring-jms:jar:5.0.7.RELEASE:compile
[INFO] | | +- org.springframework:spring-beans:jar:5.0.7.RELEASE:compile
[INFO] | | +- org.springframework:spring-messaging:jar:5.0.7.RELEASE:compile
[INFO] | | \- org.springframework:spring-tx:jar:5.0.7.RELEASE:compile
[INFO] | \- javax.jms:javax.jms-api:jar:2.0.1:compile
[INFO] +- org.apache.activemq:activemq-broker:jar:5.15.4:compile
[INFO] | +- org.apache.activemq:activemq-client:jar:5.15.4:compile
[INFO] | | +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:compile
[INFO] | | +- org.fusesource.hawtbuf:hawtbuf:jar:1.11:compile
[INFO] | | \- org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:compile
[INFO] | +- org.apache.activemq:activemq-openwire-legacy:jar:5.15.4:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
[INFO] +- com.acme:persistence:jar:1.0.0-beta-SNAPSHOT:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.0.3.RELEASE:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.0.7.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.0.3.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:5.0.7.RELEASE:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.13:compile
[INFO] | +- com.oracle.jdbc:ojdbc7:jar:12.1.0.2:compile
[INFO] | +- com.zaxxer:HikariCP:jar:3.2.0:compile
[INFO] | +- org.springframework.data:spring-data-oracle:jar:1.2.1.RELEASE:compile
[INFO] | | +- org.springframework:spring-context:jar:5.0.7.RELEASE:compile
[INFO] | | \- org.springframework.retry:spring-retry:jar:1.2.2.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-core:jar:5.0.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-expression:jar:5.0.7.RELEASE:compile
[INFO] | +- org.mybatis.spring.boot:mybatis-spring-boot-starter:jar:1.3.2:compile
[INFO] | | +- org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:jar:1.3.2:compile
[INFO] | | +- org.mybatis:mybatis:jar:3.4.6:compile
[INFO] | | \- org.mybatis:mybatis-spring:jar:1.3.2:compile
[INFO] | \- gov.nh.dhhs.bridges:bridges-domain-model:jar:1.0.0-beta-SNAPSHOT:compile
[INFO] | \- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] +- com.acme:reference-info:jar:1.0.0-beta-SNAPSHOT:compile
[INFO] | +- com.acme:reference-spec:jar:1.0.0-beta-SNAPSHOT:compile
[INFO] | | \- com.acme:reference-model:jar:1.0.0-beta-SNAPSHOT:compile
[INFO] | +- org.ehcache:ehcache:jar:3.5.2:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.7:compile
[INFO] | +- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] | +- org.springframework:spring-webmvc:jar:5.0.7.RELEASE:compile
[INFO] | \- org.springframework.boot:spring-boot-starter-json:jar:2.0.3.RELEASE:compile
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.6:compile
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.6:compile
[INFO] | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.6:compile
[INFO] +- com.acme:configuration:jar:1.0.0-beta-SNAPSHOT:test
[INFO] | +- com.acme:configuration-api:jar:1.0.0-beta-SNAPSHOT:compile
[INFO] | \- org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.6.4:test
[INFO] +- com.acme:configuration-zookeeper-impl:jar:1.0.0-beta-SNAPSHOT:compile
[INFO] | \- com.acme:configurationmanager:jar:1.0.18-SNAPSHOT:compile
[INFO] | +- org.apache.zookeeper:zookeeper:jar:3.5.1-alpha:compile
[INFO] | | +- commons-cli:commons-cli:jar:1.2:compile
[INFO] | | +- io.netty:netty:jar:3.7.0.Final:compile
[INFO] | | \- net.java.dev.javacc:javacc:jar:5.0:compile
[INFO] | +- org.apache.curator:curator-client:jar:3.3.0:compile
[INFO] | +- org.apache.curator:curator-framework:jar:3.3.0:compile
[INFO] | +- org.apache.curator:curator-recipes:jar:3.3.0:compile
[INFO] | \- javax.ejb:javax.ejb-api:jar:3.2:compile
[INFO] | \- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] +- com.acme:common-services:jar:1.0.0-beta-SNAPSHOT:compile
[INFO] | +- com.acme:security-core:jar:1.0.0-beta-SNAPSHOT:compile
[INFO] | | +- org.springframework.security:spring-security-jwt:jar:1.0.9.RELEASE:compile
[INFO] | | | \- org.bouncycastle:bcpkix-jdk15on:jar:1.56:compile
[INFO] | | | \- org.bouncycastle:bcprov-jdk15on:jar:1.56:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-security:jar:2.0.3.RELEASE:compile
[INFO] | | | +- org.springframework.security:spring-security-config:jar:5.0.6.RELEASE:compile
[INFO] | | | \- org.springframework.security:spring-security-web:jar:5.0.6.RELEASE:compile
[INFO] | | \- org.springframework.security.oauth:spring-security-oauth2:jar:2.3.3.RELEASE:compile
[INFO] | | \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] | +- javax.cache:cache-api:jar:1.1.0:compile
[INFO] | +- org.springframework:spring-context-support:jar:5.0.7.RELEASE:compile
[INFO] | \- org.ehcache:ehcache-clustered:jar:3.5.2:compile
[INFO] +- com.acme:support-core:jar:1.0.0-beta-SNAPSHOT:test
[INFO] | \- org.springframework.data:spring-data-jdbc-core:jar:1.2.1.RELEASE:compile
[INFO] +- org.apache.logging.log4j:log4j-1.2-api:jar:2.10.0:compile
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
[INFO] | \- org.apache.logging.log4j:log4j-core:jar:2.10.0:compile
[INFO] +- org.springframework.boot:spring-boot-configuration-processor:jar:2.1.0.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.0.3.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.0.3.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.0.3.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.3:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] | +- org.assertj:assertj-core:jar:3.9.1:test
[INFO] | +- org.mockito:mockito-core:jar:2.15.0:test
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.7.11:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.7.11:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-core:jar:5.0.7.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.0.7.RELEASE:compile
[INFO] | +- org.springframework:spring-test:jar:5.0.7.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.5.1:test
[INFO] +- org.hamcrest:hamcrest-all:jar:1.3:test
[INFO] +- junit:junit:jar:4.12:test
[INFO] +- org.mockito:mockito-all:jar:1.10.19:test
[INFO] +- com.jayway.jsonpath:json-path-assert:jar:2.4.0:test
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.glassfish:javax.servlet:jar:3.0:provided
[INFO] +- commons-dbcp:commons-dbcp:jar:1.4:test
[INFO] | \- commons-pool:commons-pool:jar:1.6:test
[INFO] +- joda-time:joda-time:jar:2.10:compile
[INFO] +- com.google.guava:guava:jar:25.1-jre:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] | +- org.checkerframework:checker-qual:jar:2.0.0:compile
[INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
[INFO] | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.0.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.0.3.RELEASE:compile
[INFO] | | \- org.springframework.boot:spring-boot-actuator:jar:2.0.3.RELEASE:compile
[INFO] | \- io.micrometer:micrometer-core:jar:1.0.5:compile
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.10:compile
[INFO] | \- org.latencyutils:LatencyUtils:jar:2.0.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.0.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.0.3.RELEASE:compile
[INFO] | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.19:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-log4j2:jar:2.0.3.RELEASE:compile
[INFO] | +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.10.0:compile
[INFO] | +- org.apache.logging.log4j:log4j-jul:jar:2.10.0:compile
[INFO] | \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.0.3.RELEASE:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.10.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] | \- org.springframework:spring-web:jar:5.0.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.3.RELEASE:compile
[INFO] \- io.swagger:swagger-annotations:jar:1.5.21:compile
这是我的配置类
@Configuration
public class AppConfig implements WebMvcConfigurer {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
resolvers.add(new ClientResolver());
resolvers.add(new ProductResolver());
resolvers.add(new KeyValueResolver());
}
@Override
public void addFormatters(FormatterRegistry registry) {
// add default converters and formatters ...
ApplicationConversionService.configure(registry);
registry.removeConvertible(String.class, Enum.class);
}
@Bean
@Primary
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
return builder.build();
}
}
我检查了与此类似的错误,通常他们建议检查库validation-api是否在类路径中并且是正确的版本(我正在使用javax.validation:validation-api:jar:2.0.1.Final:compile)
我在 Debug模式下启动了服务器,并在 Controller 类中设置了一个断点return service.save(data).getId();
,请求甚至没有到达该点,将 Json 绑定(bind)到 Data 对象时请求失败。
最佳答案
添加缺少的依赖项javax.persistence-api到 build.gradle
:
compile "javax.persistence:javax.persistence-api:2.2"
或者当你使用 Maven 时:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
关于java - 在 RestController 中绑定(bind) JSON 请求时获取 java.lang.NoSuchMethodException : javax.validation.Valid.value() 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53508960/
对于我的程序,目标是使用一堆接口(interface)并创建一个程序来进行测试并允许用户进行测试。我遇到的具体问题是 IQuestionFactory 接口(interface),它有助于在 Test
我刚刚读到有关反射的内容并决定尝试一下,但我似乎遇到了一个错误,我找不到原因。 我在一个类中得到了以下代码: String hashType = "md5"; Method method = Dige
我正在尝试使用反射来加载一个类的实例。当我尝试这样做时,我没有得到这样的方法异常。我已经检查并检查并重新检查。该构造函数显然确实存在。有人有什么想法吗?我之前在另一个代码基本相同的项目中成功使用过它,
这是连接两个关系的作业, import org.apache.hadoop.mapred.*; import org.apache.hadoop.conf.*; import org.apache.h
我正在尝试反序列化包含方法的 XML 文件。 片段看起来像: XMLDecoder decoder = new XMLDecoder(os); deSerializedObject = de
在我的 POM 中,我添加了依赖项 String 4.2.9.RELEASE、Spring boot 1.5.1.RELEASE 和 FasterXML/jackson 2.8.6,并出现以下错误:
在我的代码中有一个方法应该调用对象的方法doSomething。首先,不知道对象的类是否具有公共(public)方法。到目前为止,我使用了以下代码: try { Method method = c
我有以下具有静态方法的类,该方法采用 Class 类型的参数并生成一个 FunctionDescriptor。 public class NoInputFunctionDescriptorFactor
我正在使用 glassfish 3.1.2.2 服务器和 idea Ultimate Edition 11(在 Ubuntu 12.04 上)。当我部署我的耳朵项目时,有一个异常(exception)
所以我有一个定义了 2 个公共(public)方法的类。当我调用 getDeclaredMethods 时,然后循环结果,打印名称,两者都正确显示。所以不仅该方法存在,而且反射调用也找到了它。 但是当
每当使用 URLClassLoader 动态加载类时,当尝试执行使用自定义数据类型作为参数的方法时,我都会收到 NoSuchMethodException 异常。它查找具有标准类型(如 String
我正在尝试根据类和参数创建类的实例。用于创建此类的方法如下所示: @SuppressWarnings("unchecked") public Plugin instantiatePlugin(
我正在构建一个 JavaFx 应用程序,我想创建一个接收 GridPane 和 Node[] 以及添加到 Pane 中的项目数量的方法。但是,当我调用该方法时,我收到 NoSuchMethodExce
我有一个类如下: public class StreamEventSuccess { private final T event; public StreamEventSuccess(
我们正在开发一个动态类加载器项目,并尝试通过 URLClassLoader 调用动态加载类中的方法。它在 Eclipse 中运行时工作得很好,因此调用和动态加载的类被捆绑到两个不同的 jar 中,然后
我正在使用 Taylor 近似在 Java 中编写正弦函数的递归定义,但在运行代码时得到了 noSuchMethodException。这是我到目前为止所拥有的: public static void
我有一个 Android 应用程序。我正在使用反射来调用 CookieManager 的方法。 我在做什么: if (Build.VERSION.SDK_INT >= 21) { Method
我正在尝试编写一个表单,有一次有 2 个单选按钮询问此人的性别。我想要求至少按下一个按钮,否则他们就会 toast 。它们出现在 activity_main 中:
给出的类奖: public class Award { /* * */ // fields of the class Award() {
我在执行时得到一个NoSuchMethodException: operacionDTO.getClass().getMethod("setPrioridad").invoke(operacionDT
我是一名优秀的程序员,十分优秀!