[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1215) <s:convertEntity> / org.jboss.seam.ui.EntityConverter fails to return correct id when entity is wrapped Hibernate proxy (JavassistLazyInitializer)
by Kahli Burke (JIRA)
<s:convertEntity> / org.jboss.seam.ui.EntityConverter fails to return correct id when entity is wrapped Hibernate proxy (JavassistLazyInitializer)
--------------------------------------------------------------------------------------------------------------------------------------------------
Key: JBSEAM-1215
URL: http://jira.jboss.com/jira/browse/JBSEAM-1215
Project: JBoss Seam
Issue Type: Bug
Components: JSF
Affects Versions: 1.2.1.GA
Environment: JBoss Seam 1.2.1, JBoss 4.0.5GA, Hibernate 3.2.1, JSF RI 1.2, Facelets 1.1.12
Reporter: Kahli Burke
In certain circumstances the <s:entityConverter> handler org.jboss.seam.ui.EntityConverter will fail to return the correct id for the entity when getAsString() is called. I have seen this occur when one of my components called entityManager.clear(), and then on a subsequence page load a query was made. In this case, the actual object used in getIdFromEntity() was a proxied object. The object was proxied by Hibernate's JavassistLazyInitializer.
The getIdFromEntity() method looks for a field annotated with @Id, which this entity has (we are using field annotations as opposed to method annotations), and then attempts to get the id from the object using direct field access (through Reflections.get(field, entity)). Because the object is wrapped, this returns the default value for the class. In my case it returns 0 for the id since this entity uses a long for the id field.
If the getter method had been called instead, the correct non-zero value would have been returned. And usually, this works because the object is an actual instance of the entity class and has the correct value for the field.
My workaround for now is to create a subclass of EntityConverter (and using the very useful @Install precedence, thank you!) that calls the superclass' implementation and in cases where it looks like it might be incorrect, looks for a getter method and calls that instead. There is probably a better way to do it, but I'm not familiar with the Hibernate proxies or how to properly get at the underlying object.
@Override
protected Object getIdFromEntity(UIComponent cmp, FacesContext facesContext, Object entity, Class entityClass) {
Object id = super.getIdFromEntity(cmp, facesContext, entity, entityClass);
// If the id looks like it came out incorrect from the field access
if ((id instanceof Number && ((Number) id).longValue() == 0) || (id == null)) {
List<Field> fields = Reflections.getFields(entityClass, Id.class);
if (fields.size() == 1) {
Field field = fields.get(0);
Method getter = null;
try {
getter = Reflections.getGetterMethod(entityClass, field.getName());
}
catch (IllegalArgumentException e) {
if (log.isDebugEnabled())
log.debug("Id #0 looked incorrect, but unable to find getter method for field #1", id, field.getName());
return id;
}
if (getter != null) {
try {
id = Reflections.invoke(getter, entity);
}
catch (Exception e) {
log.error("Error invoking getter method #0, returning original id #1", e, getter.getName(), id);
}
}
}
}
return id;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 5 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1198) java.util.MissingResourceException: Can't find bundle for base name org.jboss.el.Messages, locale en_US
by jarkko Lietolahti (JIRA)
java.util.MissingResourceException: Can't find bundle for base name org.jboss.el.Messages, locale en_US
-------------------------------------------------------------------------------------------------------
Key: JBSEAM-1198
URL: http://jira.jboss.com/jira/browse/JBSEAM-1198
Project: JBoss Seam
Issue Type: Bug
Affects Versions: 1.2.1.GA
Reporter: jarkko Lietolahti
java.lang.ExceptionInInitializerError
at org.jboss.el.parser.AstPropertySuffix.getTarget(AstPropertySuffix.java:40)
at org.jboss.el.parser.AstValue.getTarget(AstValue.java:47)
at org.jboss.el.parser.AstValue.getType(AstValue.java:28)
at org.jboss.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:174)
at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:60)
at com.sun.facelets.el.LegacyValueBinding.getType(LegacyValueBinding.java:94)
at org.apache.myfaces.shared_impl.renderkit._SharedRendererUtils.findUIOutputConverter(_SharedRendererUtils.java:55)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.findUIOutputConverter(RendererUtils.java:316)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedUIOutputValue(RendererUtils.java:636)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.getConvertedValue(HtmlTextRendererBase.java:191)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:395)
at javax.faces.component.UIInput.validate(UIInput.java:349)
at javax.faces.component.UIInput.processValidators(UIInput.java:183)
at javax.faces.component.UIForm.processValidators(UIForm.java:70)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:146)
at org.apache.myfaces.lifecycle.LifecycleImpl.processValidations(LifecycleImpl.java:262)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
at org.apache.myfaces.portlet.MyFacesGenericPortlet.processAction(MyFacesGenericPortlet.java:220)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
at com.liferay.portlet.CachePortlet._invoke(CachePortlet.java:333)
at com.liferay.portlet.CachePortlet.processAction(CachePortlet.java:157)
at com.liferay.portal.action.LayoutAction._processPortletRequest(LayoutAction.java:269)
at com.liferay.portal.action.LayoutAction._processActionRequest(LayoutAction.java:290)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:113)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:156)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:479)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:877)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.liferay.filters.secure.SecureFilter.doFilter(SecureFilter.java:143)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:169)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.liferay.filters.strip.StripFilter.doFilter(StripFilter.java:94)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.liferay.filters.secure.SecureFilter.doFilter(SecureFilter.java:143)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.liferay.filters.compression.CompressionFilter.doFilter(CompressionFilter.java:115)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter.doFilter(LayoutCacheFilter.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.doFilter(AutoLoginFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:169)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.util.MissingResourceException: Can't find bundle for base name org.jboss.el.Messages, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1508)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1262)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:717)
at org.jboss.el.util.MessageFactory.<clinit>(MessageFactory.java:28)
... 92 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 5 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1205) NPE in JBoss EL
by Christian Bauer (JIRA)
NPE in JBoss EL
---------------
Key: JBSEAM-1205
URL: http://jira.jboss.com/jira/browse/JBSEAM-1205
Project: JBoss Seam
Issue Type: Bug
Components: Core
Reporter: Christian Bauer
17:03:16,230 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
at org.jboss.el.parser.AstFunction.getValue(AstFunction.java:78)
at org.jboss.el.parser.AstMult.getValue(AstMult.java:22)
at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at com.sun.facelets.el.ELText$ELTextVariable.writeText(ELText.java:184)
at com.sun.facelets.el.ELText$ELTextComposite.writeText(ELText.java:108)
at com.sun.facelets.compiler.TextInstruction.write(TextInstruction.java:45)
at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
at com.sun.facelets.compiler.UILeaf.encodeAll(UILeaf.java:149)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
Checkout the wiki example, login as "admin" with password "admin" and you get the exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 5 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1158) org.apache.commons.collections.UnboundedFifoBuffer on seam-gen app
by Christian Bauer (JIRA)
org.apache.commons.collections.UnboundedFifoBuffer on seam-gen app
------------------------------------------------------------------
Key: JBSEAM-1158
URL: http://jira.jboss.com/jira/browse/JBSEAM-1158
Project: JBoss Seam
Issue Type: Bug
Components: Examples
Reporter: Christian Bauer
Fresh install of JBoss 4.2.0 CR1, Seam CVS as of today. New WAR project with seam-gen and default settings for HSQL DB. Created 'new-entity', list page works and form entry page works. However, after clicking on "Save" on the form entry page for the entity, I get:
09:34:21,297 WARN [lifecycle] executePhase(APPLY_REQUEST_VALUES 2,com.sun.faces.context.FacesContextImpl@457692) threw exception
javax.faces.FacesException: org.apache.commons.collections.UnboundedFifoBuffer
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:109)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.ArrayStoreException: org.apache.commons.collections.UnboundedFifoBuffer
at org.ajax4jsf.framework.ajax.AjaxViewRoot.clearEvents(AjaxViewRoot.java:243)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.getEvents(AjaxViewRoot.java:223)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.getEventsQueue(AjaxViewRoot.java:215)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.queueEvent(AjaxViewRoot.java:134)
at javax.faces.component.UIComponentBase.queueEvent(UIComponentBase.java:962)
at javax.faces.component.UIComponentBase.queueEvent(UIComponentBase.java:962)
at javax.faces.component.UICommand.queueEvent(UICommand.java:405)
at com.sun.faces.renderkit.html_basic.ButtonRenderer.decode(ButtonRenderer.java:104)
at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:774)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:994)
at javax.faces.component.UIForm.processDecodes(UIForm.java:203)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:989)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:494)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.access$001(AjaxViewRoot.java:53)
at org.ajax4jsf.framework.ajax.AjaxViewRoot$1.invokeRoot(AjaxViewRoot.java:254)
at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:54)
at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.processDecodes(AjaxViewRoot.java:267)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:101)
... 38 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 5 months