3 Replies Latest reply on Jun 10, 2009 1:12 PM by Nikos Paraskevopoulos

    Error after adding field to entity

    Tigran Harutyunyan Newbie
      Hi. I am new in JBoss seam. I need help.

      I created seam project, created tables, than with 'seam generate' created this beans, xhtml and etc. Thank I made some changes, it worked properly. I added a field
      private Integer status;
      added getter and setter to one of my entities and now the page can't be loaded, I get this error
      javax.el.ELException: /WorkbookEdit.xhtml @87,62 value "#{workbookHome.workplaces}": Error reading 'workplaces' on type com.webbfontaine.workbook.action.WorkbookHome_$$_javassist_seam_4
      stack trace is

      javax.faces.FacesException: javax.el.ELException: /WorkbookEdit.xhtml @87,62 value="#{workbookHome.workplaces}": Error reading 'workplaces' on type com.webbfontaine.workbook.action.WorkbookHome_$$_javassist_seam_4
              at javax.faces.component.UIData.getValue(UIData.java:612)
              at org.ajax4jsf.component.UIDataAdaptor.getValue(UIDataAdaptor.java:1644)
              at org.ajax4jsf.component.SequenceDataAdaptor.getDataModel(SequenceDataAdaptor.java:65)
              at org.ajax4jsf.component.SequenceDataAdaptor.createDataModel(SequenceDataAdaptor.java:59)
              at org.richfaces.component.UIDataTable.createDataModel(UIDataTable.java:125)
              at org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:621)
              at org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:339)
              at org.richfaces.renderkit.AbstractTableRenderer.encodeTableStructure(AbstractTableRenderer.java:124)
              at org.richfaces.renderkit.html.DataTableRenderer.doEncodeBegin(DataTableRenderer.java:206)
              at org.richfaces.renderkit.html.DataTableRenderer.doEncodeBegin(DataTableRenderer.java:194)
              at org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:101)
              at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
              at javax.faces.component.UIData.encodeBegin(UIData.java:962)
              at org.ajax4jsf.component.UIDataAdaptor.encodeBegin(UIDataAdaptor.java:1220)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
              at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
              at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
              at org.richfaces.renderkit.TabRendererBase.encodeChildren(TabRendererBase.java:113)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
              at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
              at org.richfaces.renderkit.html.TabPanelRenderer.doEncodeChildren(TabPanelRenderer.java:285)
              at org.richfaces.renderkit.html.TabPanelRenderer.doEncodeChildren(TabPanelRenderer.java:280)
              at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
              at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
              at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
              at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
              at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              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(ApplicationFilterChain.java:206)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
              at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
              at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.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(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:235)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.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(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.el.ELException: /WorkbookEdit.xhtml @87,62 value="#{workbookHome.workplaces}": Error reading 'workplaces' on type com.webbfontaine.workbook.action.WorkbookHome_$$_javassist_seam_4
              at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
              at javax.faces.component.UIData.getValue(UIData.java:609)
              ... 82 more
      Caused by: org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.webbfontaine.workbook.model.Workplace.status
              at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:109)
              at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:360)
              at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:221)
              at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3594)
              at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:152)
              at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
              at org.hibernate.loader.Loader.doQuery(Loader.java:752)
              at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
              at org.hibernate.loader.Loader.loadCollection(Loader.java:2015)
              at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59)
              at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
              at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
              at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1743)
              at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:366)
              at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
              at org.hibernate.collection.PersistentSet.toArray(PersistentSet.java:194)
              at java.util.ArrayList.<init>(ArrayList.java:131)
              at com.webbfontaine.workbook.action.WorkbookHome.getWorkplaces(WorkbookHome.java:56)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
              at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97)
              at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
              at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
              at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
              at com.webbfontaine.workbook.action.WorkbookHome_$$_javassist_seam_4.getWorkplaces(WorkbookHome_$$_javassist_seam_4.java)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
              at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
              at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
              at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
              at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
              at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
              at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
              ... 83 more
      Caused by: java.lang.IllegalArgumentException
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:66)
              ... 130 more
        • 1. Re: Error after adding field to entity
          Leo van den berg Master

          I know it is sometimes hard to find the real error in the tons of lines, but this error is the most important one:



          Caused by: org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.webbfontaine.workbook.model.Workplace.status




          It basically sys that you're reding the form field which must be transformed from Object to the proimitive, normally that works, but not when you have a null valuie, that can't be squeesed into a primitive. Do one of the following thing:


          - Change the primitive type in your model to the Object version.Because you state that you have an Integer, but the error says that you're using a primitive, probably cause by AutoBoxing whitin the set/get methods (have you defined an return or set value of type int ??).
          - Add validation, which should make it impossible to put a null value,
          - Lead the value to an action bean and check there for null,
          - et.


          Check the setters/getters first I suspect that the error is there...


          Success !


          Leo

          • 2. Re: Error after adding field to entity
            Tigran Harutyunyan Newbie

            Thanks for your response, I found the solution, I changed the type to Integer, but I added annotation @Transient because the bean property is not mapped to the table's column.  

            • 3. Re: Error after adding field to entity
              Nikos Paraskevopoulos Novice

              ...or update the database table so that the new column contains a default, non-null value