3 Replies Latest reply on Mar 21, 2008 1:04 AM by Martin Treiber

    Unknown @DataModel @Out name

    Martin Treiber Newbie

      Hello Guys


      I moved my project from the seam-gen console version to the New->Seam Web Project version (you know: Eclipse). Unfortunately this created some errors in my code. I was able to remove some of them, but this one is sticking around and I have no clue what the problem could be.


      It is about one EntityBean (Subject), one stateless session bean (SubjectAction) and its Interface (SubjectFacade). On SubjectAction Eclipse keeps displaying Unknown @DataModel/@Out name: subject in the first row. Obviously it is referencing to my DataModel Selection (changing the varibale's name changes the error message).


      @Name("subjManager")
      @Stateless
      public class SubjectAction implements SubjectFacade {
              
      @PersistenceContext
      EntityManager em;
              
      @In(required=false)
      @DataModelSelection
      private Subject subject;
      
      @Out(required=false)
      @DataModel(scope=ScopeType.PAGE)
      private List<Subject> subjList;
      
      @Factory("subjList")
      public void getSubjList(){
              subjList = em.createQuery("from Subject").getResultList();
      }
      ...
      



      But I don't understand why it has difficulties to find subject. First of all, it does not even have to know at compile time what it is (imho) and second, the EntityBean it is refering to is also called subject.


      @Entity
      @Name("subject")
      public class Subject implements Serializable {
              
      private static final long serialVersionUID = 9174483825465006993L;
      
      @Id @GeneratedValue
      private long id;
      ...
      



      I have no clue at all why this error occurs. Fact is that it is preventing me from using this component on my XHTML sheets (leads to the error Message that subjManager could not be created or similar):



             <rich:dataTable value="#{subjList}" var="subj" >
                      <f:facet name="header">
                      <rich:columnGroup>
                              <rich:column><h:outputText value="Jahr" /></rich:column>
                              <rich:column><h:outputText value="Klasse" /></rich:column>
                              <rich:column><h:outputText value="Name" /></rich:column>
                              <rich:column><h:outputText value="Lehrer" /></rich:column>
                              <rich:column><h:outputText value="Funktionen" /></rich:column>
                      </rich:columnGroup>
                      </f:facet>
                      
                      <rich:columnGroup>
                              <rich:column><h:outputText value="#{subj.year}" /></rich:column>
                              <rich:column><h:outputText value="#{subj.parallel}" /></rich:column>
                              <rich:column><h:outputText value="#{subj.name}" /></rich:column>
                              <rich:column><h:outputText value="#{subj.teacher}" /></rich:column>
                              <rich:column><s:link value="loeschen" action="#{subjManager.delete}" />&#160;&#160;<s:link value="bearbeiten" action="#{subjManager.edit}" /></rich:column>
                      </rich:columnGroup>
              </rich:dataTable>
      
      



      Please help me. You are my last hope. I don't want to change back to the console version.

        • 1. Re: Unknown @DataModel @Out name
          Martin Treiber Newbie

          I just recognised that the same class is causing an server error during deploying.



          14:03:38,297 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=Equador-ear.ear,jar=Equador-ejb.jar,name=SubjectAction,service=EJB3 with dependencies:
          14:03:38,297 INFO  [JmxKernelAbstraction]      persistence.units:ear=Equador-ear.ear,jar=Equador-ejb.jar,unitName=Equador
          14:03:38,319 INFO  [EJBContainer] STARTED EJB: de.unimannheim.swt.equador.action.SubjectAction ejbName: SubjectAction
          14:03:38,340 INFO  [EJBContainer] STOPPED EJB: de.unimannheim.swt.equador.action.SubjectAction ejbName: SubjectAction
          14:03:38,343 WARN  [ServiceController] Problem starting service jboss.j2ee:ear=Equador-ear.ear,jar=Equador-ejb.jar,name=SubjectAction,service=EJB3
          java.lang.NullPointerException
               at org.jboss.ejb.txtimer.DatabasePersistencePolicy.listTimerHandles(DatabasePersistencePolicy.java:165)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
               at $Proxy30.listTimerHandles(Unknown Source)
               at org.jboss.ejb.txtimer.EJBTimerServiceImpl.restoreTimers(EJBTimerServiceImpl.java:408)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          ...
          



          And as soon as I access the page where the session bean is supposed to be instantiated an InstantiationException is thrown and it says local not bound - which is wrong:


          import org.jboss.annotation.ejb.Local;
          
          
          @Local
          public interface SubjectFacade {
          


          • 2. Re: Unknown @DataModel @Out name
            Martin Treiber Newbie

            Hooray. I am not yet sure whether my problem is gone for ever, but all of a sudden it disapeared. Trying different combinations of comments and code I restarted the server several times, selected Clean in my server's context menu and when I went back to the code from the first post, the error message is gone ... Looks like a typical Windows problem solution: restart until the error is fixed (^_~)


            Anyways it seems like the problem from the second post is independent from the first problem.

            • 3. Re: Unknown @DataModel @Out name
              Martin Treiber Newbie

              I just want to finish my little monologue. I found out that my NullPointerException - DatabasePersistencePolicy problem had to do with the following line in my [ProjectName]-ds.xml file:


              <!DOCTYPE datasources PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN" "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">



              I deleted it, now it's working fine.


              The validation error, however came back all of a sudden, but it seems like it is not influencing the program in any way (which is not suprising for me, as I am still certain, that my code is right).