即使模型类中没有验证约束,我也会收到此错误(所有成员变量均已正确设置,但我在创建对象时仍然遇到此异常)。如何调试此错误?
javax.el.ELException: org.hibernate.validator.InvalidStateException: valida
tion failed for: com.mycompany.model.User
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.jav
a:339)
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.jav
a:280)
at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.jav
a:59)
at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:
65)
at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.ja
va:276)
at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
at org.jboss.seam.navigation.Pages.callAction(Pages.java:703)
at org.jboss.seam.navigation.Pages.preRender(Pages.java:331)
at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseList
ener.java:561)
at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPh
aseListener.java:472)
at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhas
eListener.java:148)
at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListen
er.java:118)
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:
139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applica
tionFilterChain.java:206)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamF
ilter.java:83)
at org.jboss.seam.web.RewriteFilter.doFilter(RewriteFilter.java:63)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamF
ilter.java:69)
at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:4
0)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamF
ilter.java:69)
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java
:90)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamF
ilter.java:69)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java
:64)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamF
ilter.java:69)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:4
5)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamF
ilter.java:69)
at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEnc
odingFilter.java:42)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamF
ilter.java:69)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java
:206)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290
)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(Ba
seFilter.java:388)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:5
6)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamF
ilter.java:69)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamF
ilter.java:69)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applica
tionFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHea
derFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applica
tionFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWra
pperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardCon
textValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Se
curityAssociationValve.java:190)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authe
nticatorBase.java:433)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContex
tValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.
process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.
invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostVa
lve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportVa
lve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(Ca
chedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngi
neValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapte
r.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor
.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.
process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.ja
va:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.hibernate.validator.InvalidStateException: validation failed
for: com.mycompany.model.User at org.hibernate.validator.event.ValidateEventListener.validate(Val
idateEventListener.java:148)
at org.hibernate.validator.event.ValidateEventListener.onPreInsert(
ValidateEventListener.java:172)
at org.hibernate.action.EntityIdentityInsertAction.preInsert(Entity
IdentityInsertAction.java:142)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityId
entityInsertAction.java:65)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrR
eplicate(AbstractSaveEventListener.java:321)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(Ab
stractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGenera
tedId(AbstractSaveEventListener.java:130)
at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGenerat
edId(EJB3PersistEventListener.java:49)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTran
sient(DefaultPersistEventListener.java:154)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(De
faultPersistEventListener.java:110)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(De
faultPersistEventListener.java:61)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:645)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:619)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:623)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEnti
tyManagerImpl.java:220)
at sun.reflect.GeneratedMethodAccessor454.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod
AccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke
(EntityManagerInvocationHandler.java:46)
at $Proxy550.persist(Unknown Source)
at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)
at com.mycompany.action.UserHome.persist(
每个InvalidStateException
都有一个数组InvalidValue
。每个InvalidValue
显示了您要保留的bean的哪个属性被侵犯。正如@Arthur正确指出的那样,违反Java持久性注释的结果也以InvalidStateException
s
结尾。
要调试你的问题,我会暂时赶InvalidStateException
在com.mycompany.action.UserHome.persist
并打印出每个InvalidValue
如下:
} catch (InvalidStateException e) {
for (InvalidValue invalidValue : e.getInvalidValues()) {
log.info("Instance of bean class: " + invalidValue.getBeanClass().getSimpleName() +
" has an invalid property: " + invalidValue.getPropertyName() +
" with message: " + invalidValue.getMessage()));
}
}
问题内容: 好吧,我试图理解并阅读可能导致它的原因,但我却无法理解: 我的代码中有这个地方: 事实是,当它尝试调用某些方法时,它将引发而不是其他预期的异常(特别是)抛出 。我实际上知道调用了什么方法,所以我直接转到该方法代码,并为应该抛出的行添加了一个块 ,它实际上按预期抛出。然而,当它上升时,以某种方式更改了上面的代码并没有 按预期进行。 是什么原因导致这种行为的?我该如何检查? 问题答案: 通
为什么我在下面的代码段中的X轴上有一个溢出? 在我的网格容器上应用时,就会产生溢出。 null null https://codepen.io/anon/pen/wdjexz?editors=1100
应用程序可以持久化用户,以后可以修改。最近无法修改用户,引发了异常。用户实体被持久化,没有错误或验证。有人知道是什么导致了这种行为,或者我如何找到更多细节吗?
问题内容: 遇到一个错误地使用 而不是 在其代码中的人,它没有显示为编译错误。 是因为 是相同的 ? 问题答案: 没有编译错误,因为它是有效的(尽管相当无用) 一元运算符 ,其使用方式与以下方式相同: Java语言规范中的相关部分是Unary Plus运算符+(第15.15.3节) 。它指定调用一元运算会导致操作数的一元数值提升(第5.6.1节)。这意味着: * 如果操作数是编译时类型的,,,或,
我正在玩rxjava,发现如果在活动被销毁之前没有完成订阅,则存在内存泄漏的风险,因为“可观察对象保留对上下文的引用”。如果订阅没有取消订阅,则此类情况的演示之一如下所示。已销毁(来源:https://github.com/dlew/android-subscription-leaks/blob/master/app/src/main/java/net/danlew/rxsubscriptions
我在Ubuntu 14.04上安装了redis,而且我似乎几乎每周都有完成RDB快照的问题。Redis版本是3.0.4 64位。 3838:M 24 Feb 09:46:28.826*后台保存成功终止 3838:M 24 Feb 09:47:29.088*在60秒内更改100000次。拯救 3838:M 24 Feb 09:47:29.230*后台保存由pid 17281启动 17281:信号处理