1 2 Previous Next 18 Replies Latest reply on Apr 23, 2007 4:37 PM by Tony Herstell

    Seam saying Datamodel saying row is Unavailable... WHY???

    Tony Herstell Master

      Given:

       @DataModel("displayableCategoryDatamodel")
       private LinkedHashSet<DisplayableCategory> displayableCategorySet;
      
       @DataModelSelection("displayableCategoryDatamodel")
       private DisplayableCategory selectedDisplayableCategory;
      
       @DataModel("keywordsDatamodel")
       private LinkedHashSet<Keyword> keywordsSet;
      
       @DataModelSelection("keywordsDatamodel")
       private Keyword selectedKeyword;
      



      The first time a member is added to keywordsSet and a page is displayed using the Datamodel then I get this:

      Caused by: javax.ejb.EJBException: java.lang.IllegalArgumentException: row is unavailable
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
       at $Proxy113.isAdTypeComplete(Unknown Source)
       at sun.reflect.GeneratedMethodAccessor216.invoke(Unknown Source)
       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:20)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
       at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
       at org.javassist.tmp.java.lang.Object_$$_javassist_7.isAdTypeComplete(Object_$$_javassist_7.java)
       ... 51 more
      



      The initial set is created using:
       // Create the default set of Keywords.
       keywordsSet = new LinkedHashSet<Keyword>();
      


      a member is added using

       public void addKeyword() {
       Keyword newKeyword = new Keyword();
       newKeyword.setKeyword(getNewKeyword());
       keywordsSet.add(newKeyword);
       }
      


      Keyword is:
      @Entity // Defines this as an Entity that is a class mapped to the Datastore.
      @Name("keyword") // Name used within SEAM for an instance of this class.
      @Role(name="keywordSearchCriteria", scope=SESSION) // Another named instance of this class (used in the session scope).
      public class Keyword implements Serializable {
      
       private Long id;
       private Integer version; // Hiberante Docs: EJB3 sais Timestamp actually but recommend Integer
       private String keyword;
       private Administration administration;
      
       public Keyword() {
       }
      
       @Id
       @GeneratedValue
       public Long getId() {
       return id;
       }
      
       public void setId(Long id) {
       this.id = id;
       }
      
       @Version
       @Column(name="version4OptLock")
       public Integer getVersion() {
       return version;
       }
      
       public void setVersion(Integer version) {
       this.version = version;
       }
      
       @NotNull(message="required")
       @Length(max = 30)
       public String getKeyword() {
       return keyword;
       }
      
       public void setKeyword(String keyword) {
       this.keyword = keyword;
       }
      
       @Embedded
       public Administration getAdministration() {
       return administration;
       }
      
       public void setAdministration (Administration administration) {
       this.administration = administration;
       }
      
       @Override
       public String toString() {
       return getKeywordAsText(this);
       }
      
       public static String getKeywordAsText(Keyword keyword) {
       StringBuffer infoToReturn = new StringBuffer("Keyword");
       infoToReturn.append(" (Id => " + keyword.getId());
       infoToReturn.append(", Version => " + keyword.getVersion());
       infoToReturn.append(", Keyword => " + keyword.getKeyword());
       if (keyword.getAdministration() != null) {
       infoToReturn.append(", Administration --> " + keyword.getAdministration());
       }
       infoToReturn.append(")");
       return infoToReturn.toString();
       }
      
      


        • 1. Re: Seam saying Datamodel saying row is Unavailable... WHY??
          Tony Herstell Master

           

          Caused by: java.lang.IllegalArgumentException: row is unavailable
           at org.jboss.seam.jsf.SetDataModel.getRowData(SetDataModel.java:56)
           at org.jboss.seam.databinding.DataModelBinder.getSelection(DataModelBinder.java:69)
           at org.jboss.seam.databinding.DataModelBinder.getSelection(DataModelBinder.java:19)
           at org.jboss.seam.Component.injectDataModelSelection(Component.java:1274)
           at org.jboss.seam.Component.injectDataModelSelections(Component.java:1254)
           at org.jboss.seam.Component.inject(Component.java:1196)
           at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
           at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:37)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
           at org.jboss.seam.interceptors.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:63)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
           at org.jboss.seam.interceptors.ConversationalInterceptor.aroundInvoke(ConversationalInterceptor.java:89)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
           at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
           at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
           at sun.reflect.GeneratedMethodAccessor156.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
           at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
          


          • 2. Re: Seam saying Datamodel saying row is Unavailable... WHY??
            Tony Herstell Master

            This blows up when the first row is attempted to be added.

            • 3. Re: Seam saying Datamodel saying row is Unavailable... WHY??
              Tony Herstell Master

              On the basis that JSF+Seam is rather weired in places I did this

               // Create the default set of Keywords (empty).
               keywordsSet =null; // = new LinkedHashSet<Keyword>();
              
              
              and this
              
              
               public void addKeyword() {
               Keyword newKeyword = new Keyword();
               newKeyword.setKeyword(getNewKeyword());
               if (keywordsSet == null) {
               keywordsSet = new LinkedHashSet<Keyword>();
               }
               keywordsSet.add(newKeyword);
               }
              
              
              
              And then it worked!
              
              Is this a BUG for JIRA or just annother odditity with JSF?
              
              
              


              • 4. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                Tony Herstell Master

                The plot thickens..

                I now get only one element displayed in the data table and this error:

                19:31:37,859 ERROR [HtmlTableRendererBase] Row is not available. Rowindex = 1
                


                 public void addKeyword() {
                 Keyword newKeyword = new Keyword();
                 newKeyword.setKeyword(getNewKeyword());
                 if (keywordsSet == null) {
                 keywordsSet = new LinkedHashSet<Keyword>();
                 }
                 keywordsSet.add(newKeyword);
                 for (Keyword eachKeyword : keywordsSet) {
                 log.info(eachKeyword + " " + eachKeyword.hashCode());
                 }
                 }
                


                gives:
                19:32:31,609 INFO [AdvertisingCampaignControllerImpl] Keyword (Id => null, Version => null, Keyword => a) 97
                19:32:31,609 INFO [AdvertisingCampaignControllerImpl] Keyword (Id => null, Version => null, Keyword => b) 98
                19:32:31,609 INFO [AdvertisingCampaignControllerImpl] Keyword (Id => null, Version => null, Keyword => c) 99
                19:32:31,609 INFO [AdvertisingCampaignControllerImpl] Keyword (Id => null, Version => null, Keyword => d) 100
                19:32:31,859 ERROR [HtmlTableRendererBase] Row is not available. Rowindex = 1
                


                • 5. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                  Tony Herstell Master

                  Ok, I got it working by adding PAGE to the Models (No I have no idea why I needed to !)

                   @DataModel(value="displayableCategoryDatamodel", scope=ScopeType.PAGE)
                   private LinkedHashSet<DisplayableCategory> displayableCategorySet;
                  
                   @DataModelSelection(value="displayableCategoryDatamodel")
                   private DisplayableCategory selectedDisplayableCategory;
                  
                   @DataModel(value="keywordsDatamodel", scope=ScopeType.PAGE)
                   private LinkedHashSet<Keyword> keywordsSet;
                  
                   @DataModelSelection(value="keywordsDatamodel")
                   private Keyword selectedKeyword;
                  


                  anyhow,

                  So.. now I have this

                  
                   <h:dataTable var="eachKeyword" value="#{keywordsDatamodel}" rendered="#{keywordsDatamodel.rowCount>0}">
                  
                   <h:column>
                   <f:facet name="header">
                   <h:outputText value="#{messages.keyword}" />
                   </f:facet>
                   <h:outputText value="#{eachKeyword.keyword}" />
                   </h:column>
                  
                   <h:column>
                   <s:button value="#{messages.button_delete}"
                   action="#{advertisingCampaignController.deleteKeyword(eachKeyword)}"/>
                   </h:column>
                   </h:dataTable>
                  
                  


                  Why am I getting null in the routine for deleteKeyword(eachKeyword)??? for eachKeyword?


                  • 6. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                    Pete Muir Master

                    On your original problem - it's hard to suggest a solution based on the info available (not your fault, you've supplied everything available) without using a debugger - it could be due to having two datamodels in the same bean - have you tried with just one? Otherwise, get your debugger out and track down why you are getting that exception (and specifically on which datamodel it is occurring).

                    On your second problem - I'm not sure, perhaps try using page parameters instead? Sorry, not very helpful, but I'm no expert on the el enhancement stuff :(

                    • 7. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                      Tony Herstell Master

                      I have been fiddling a lot with teh debugger...
                      Its a lot of code to go through and I am under a massive amount of pressure on tim (Like YOUR time is not valuable!).
                      If someone knows what to look for I can supply some SVN credentials.

                      • 8. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                        Pete Muir Master

                        Put a breakpoint on line 1247 of Component.java; what is the value of the name parameter when it blows up (it will probably run this method more than once, I need the last one before it blows up)

                        • 9. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                          Tony Herstell Master

                          I will do that when I get back home tonight
                          I am at my OTHER full time job today.
                          I wore the mouse button out last time I debugged through trying to step through the code... It seems to call certain routines a LOT of times.

                          • 10. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                            Sander Mak Newbie

                            About your second problem: s:button does not submit the form. I also found out the hard way that objects passed using enhanced EL are not set then either. Try using a h:commandButton, which does submit the form.

                            • 11. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                              Sander Mak Newbie

                              About your second problem: s:button does not submit the form. I also found out the hard way that objects passed using enhanced EL are not set then either. Try using a h:commandButton, which does submit the form.

                              • 12. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                                Tony Herstell Master

                                SAmmy you ARE the man.
                                Thats another one for the doco!! or FAQ.
                                Instant fix on the button vs commandbutton.

                                • 13. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                                  Christian Bauer Master

                                  The fact that s:button/s:link don't submit a form is in the docs, twice AFAIK.

                                  • 14. Re: Seam saying Datamodel saying row is Unavailable... WHY??
                                    Tony Herstell Master

                                    ok, but for us mortals...

                                    eachDisplayableCategory does not get submitted when you click s:button refine...

                                    <h:column rendered="#{eachDisplayableCategory.displayed}">
                                     <s:fragment rendered="#{!eachDisplayableCategory.refined}">
                                     <s:fragment rendered="#{eachDisplayableCategory.parenting}">
                                     <s:button value="#{messages.button_refine}"
                                     action="#{advertisingCampaignController.refineCategory(eachDisplayableCategory)}" />
                                     </s:fragment>
                                     </s:fragment>
                                     <s:fragment rendered="#{eachDisplayableCategory.refined}">
                                     <h:commandButton value="#{messages.button_collapse}"
                                     action="#{advertisingCampaignController.collapseCategory(eachDisplayableCategory)}" />
                                     </s:fragment>
                                     </h:column>
                                    


                                    you have to have a h:commandButton
                                    <h:column rendered="#{eachDisplayableCategory.displayed}">
                                     <s:fragment rendered="#{!eachDisplayableCategory.refined}">
                                     <s:fragment rendered="#{eachDisplayableCategory.parenting}">
                                     <h:commandButton value="#{messages.button_refine}"
                                     action="#{advertisingCampaignController.refineCategory(eachDisplayableCategory)}" />
                                     </s:fragment>
                                     </s:fragment>
                                     <s:fragment rendered="#{eachDisplayableCategory.refined}">
                                     <h:commandButton value="#{messages.button_collapse}"
                                     action="#{advertisingCampaignController.collapseCategory(eachDisplayableCategory)}" />
                                     </s:fragment>
                                     </h:column>
                                    


                                    To me.. being a noobie, I don't really know when form is submiited or not.. s:button seems to avoid the validation... just a bit confusing...

                                    You experts know these things...

                                    1 2 Previous Next