1 2 Previous Next 15 Replies Latest reply on Dec 18, 2007 3:30 PM by james_hays

    Error selecting object

    laksu

      Hello there,
      I have a combo box:

       <h:selectOneMenu id="gorevli" value="#{istek.gorevli}">
       <s:selectItems value="#{isteklerAction.uzmanlar}" var="item"
       label="#{item.id}-#{item.ad}" noSelectionLabel="Lutfen Seciniz..."/>
       <s:convertEntity />
       </h:selectOneMenu>
      


      No exception but it messages: "Error selecting object". What can possibly be wrong? How could I debug?
      Best regards,
      Levent


        • 1. Re: Error selecting object
          christian.bauer

          Show code, stacktrace, etc.

          • 2. Re: Error selecting object
            laksu

            In a form I fill values for an Istek object and use the combobox as a lookup for its member "gorevli". I expect this mechanism to assign the selected "Uzman" object to the member "gorevli".
            No stacktrace, no exceptions.

            Here is the corresponding action bean IsteklerAction. I have removed a lot for clarity:

            @Stateful
            @Name("isteklerAction")
            @Scope(ScopeType.SESSION)
            public class IsteklerAction implements Serializable, IsteklerActionLocal {
            
             @PersistenceContext(type=PersistenceContextType.EXTENDED)
             private EntityManager entityManager;
            
             public IsteklerAction() {}
            
             @DataModel
             private List<Istek> isteklerList;
            
             @In(required=false) @Out(required=false)
             private Istek istek;
            
             @Factory("isteklerList")
             public void refreshIstekler(){
             System.out.println("refreshing istekler");
             isteklerList=entityManager.createQuery("from Istek i order by acilis").getResultList();
             }
            
             @Out
             private List<Uzman> uzmanlar;
            
             private void refreshUzmanlar(){
             uzmanlar=entityManager.createQuery("from Uzman u").getResultList();
             }
            
             public void refresh() {
             refreshIstekler();
             refreshUzmanlar();
             }
            
             public void save() {
            
             if (status=="N"){
             entityManager.persist(istek);
             } else {
             istek=entityManager.merge(istek);
             }
             status="V";
             refreshIstekler();
             }
            


            And the Istek class has a member named "gorevli" which is an "Uzman".

            @Name("istek")
            @Scope(ScopeType.PAGE)
            @Entity
            public class Istek implements Serializable {
             @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
             private Long id;
            
             @ManyToOne
             private Uzman gorevli;
            ...
            }


            Uzman extends Kullanici whis has the @Id field:

            @Entity
            @DiscriminatorValue(value="U")
            public class Uzman extends Kullanici {
            
             @OneToMany(mappedBy="gorevli")
             private java.util.List<Istek> gorevler;
            
             @ManyToMany(mappedBy="gorevliler")
             private Set<Proje> sorumluluklar;
            ...
            }
            
            ...
            
            @Entity
            @Name("kullanici")
            @Scope(ScopeType.CONVERSATION)
            @Role(name="login",scope=ScopeType.SESSION)
            @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
            @DiscriminatorColumn(name="turu",discriminatorType=DiscriminatorType.CHAR)
            @DiscriminatorValue(value="S")
            public class Kullanici implements java.io.Serializable {
             @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
             private Long id;
             private String ad;
             private String adSoyad;
             private String parola;
            }
            
            


            Best regards.
            Levent

            • 3. Re: Error selecting object
              christian.bauer

              You said you get a "message". Where and from what?

              • 4. Re: Error selecting object
                waynebagguley

                Try adding an "equals" method to either Uzman or Kullanici that tests against the "id" field.

                • 5. Re: Error selecting object
                  christian.bauer

                  That is, no matter what the problem is, not a good idea. Equality based on database identity does not work (longest discussion threads on Hibernate forum, etc).

                  • 6. Re: Error selecting object
                    waynebagguley

                    If it works at least it will help to track down the problem.

                    • 7. Re: Error selecting object
                      laksu

                      Ok, I went through creating equals and hashcode methods for the Kullanici and Uzman as well. IMHO I have doen a decent implementation with commns-lang hashcode and equals builders.
                      Yet the problem is still there.
                      With "message" I mean a JSF message that can be seen by <h:messages/>. And the message is "Error selecting object"

                      This message is from the source :

                      @Name("org.jboss.seam.ui.entityConverter")
                      @Scope(ScopeType.CONVERSATION)
                      @Install(precedence = BUILT_IN)
                      @Converter
                      @Intercept(NEVER)
                      public class EntityConverter implements
                       javax.faces.convert.Converter, Serializable
                      {
                      
                       private ValueBinding<EntityManager> entityManager;
                      
                       private Log log = Logging.getLog(EntityConverter.class);
                      
                       private String errorMessage = "Error selecting object";


                      • 8. Re: Error selecting object
                        pmuir

                        Please try with Seam from CVS, I have done a significant rebuild of the entity converter since Seam 1.2.1.GA

                        • 9. Re: Error selecting object
                          laksu

                          I have downloaded jboss-seam-CVS.20070503
                          and rearranged libraries etc. to use it instead of 1.2.1GA but I cannot seem to get past the following exception.


                          Exception during request processing: javax.el.ELException: Error Parsing: #{isteklerAction.selectIstek(i)}
                          
                          com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:140)
                          com.sun.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:157)
                          com.sun.el.lang.ExpressionBuilder.createMethodExpression(ExpressionBuilder.java:208)
                          com.sun.el.ExpressionFactoryImpl.createMethodExpression(ExpressionFactoryImpl.java:63)
                          org.jboss.seam.core.Expressions$2.createExpression(Expressions.java:95)
                          org.jboss.seam.core.Expressions$2.invoke(Expressions.java:99)
                          org.jboss.seam.core.Pages.callAction(Pages.java:499)
                          org.jboss.seam.core.Pages.enterPage(Pages.java:284)
                          org.jboss.seam.jsf.AbstractSeamPhaseListener.enterPage(AbstractSeamPhaseListener.java:276)
                          org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:214)
                          org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:56)
                          com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:214)
                          com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
                          javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                          org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
                          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
                          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
                          org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
                          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
                          org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
                          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
                          org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:126)
                          org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:248)
                          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
                          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
                          org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
                          org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
                          org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
                          org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
                          org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)


                          • 10. Re: Error selecting object
                            pmuir

                            Seam CVS uses jboss-el not el-ri. seam-gen should create you a correct application, or take a look at one the examples.

                            • 11. Re: Error selecting object
                              laksu

                              I have tried seam-gen. It does not produce a flawless project, I had to add some jars manually into the build.xml. and this is only the barebone application generated. (Shouls I submit an issue about it?)

                              Anyway, after all with the barebone application I am hitting the following:

                              17:19:01,406 INFO [Initialization] done initializing Seam
                              17:19:01,484 ERROR [STDERR] May 4, 2007 5:19:01 PM com.sun.faces.config.ConfigureListener contextInitialized
                              INFO: Initializing Sun's JavaServer Faces implementation (1.2_04-b10-p01) for context 'null'
                              17:19:01,891 ERROR [STDERR] java.lang.UnsupportedOperationException
                              17:19:01,906 ERROR [STDERR] at com.sun.faces.config.ConfigureListener$InitFacesContext.getViewRoot(ConfigureListener.java:1690)
                              17:19:01,906 ERROR [STDERR] at com.sun.faces.util.MessageFactory.getMessage(MessageFactory.java:113)
                              17:19:01,906 ERROR [STDERR] at com.sun.faces.util.MessageUtils.getExceptionMessageString(MessageUtils.java:277)
                              17:19:01,906 ERROR [STDERR] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:855)
                              17:19:01,922 ERROR [STDERR] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:502)
                              17:19:01,922 ERROR [STDERR] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:402)
                              17:19:01,922 ERROR [STDERR] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)
                              17:19:01,938 ERROR [STDERR] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
                              17:19:01,938 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
                              17:19:01,938 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
                              17:19:01,938 ERROR [STDERR] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
                              17:19:01,953 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              17:19:01,953 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                              17:19:01,953 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                              17:19:01,953 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
                              17:19:01,969 ERROR [STDERR] at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
                              17:19:01,969 ERROR [STDERR] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
                              17:19:01,969 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                              17:19:01,969 ERROR [STDERR] at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
                              17:19:01,984 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              17:19:01,984 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                              17:19:01,984 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                              17:19:02,000 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
                              17:19:02,000 ERROR [STDERR] at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
                              17:19:02,000 ERROR [STDERR] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
                              17:19:02,000 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                              17:19:02,016 ERROR [STDERR] at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
                              17:19:02,016 ERROR [STDERR] at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
                              17:19:02,031 ERROR [[/gop]] Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
                              javax.faces.FacesException: java.lang.UnsupportedOperationException
                               at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:408)
                               at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)
                               at org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
                               at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
                               at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
                               at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
                               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.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
                               at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
                               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                               at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
                               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.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
                               at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
                               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                               at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
                               at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
                               at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
                               at org.jboss.web.WebModule.startModule(WebModule.java:83)
                               at org.jboss.web.WebModule.startService(WebModule.java:61)
                               at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
                               at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
                              Caused by: java.lang.UnsupportedOperationException
                               at com.sun.faces.config.ConfigureListener$InitFacesContext.getViewRoot(ConfigureListener.java:1690)
                               at com.sun.faces.util.MessageFactory.getMessage(MessageFactory.java:113)
                               at com.sun.faces.util.MessageUtils.getExceptionMessageString(MessageUtils.java:277)
                               at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:855)
                               at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:502)
                               at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:402)
                               at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)
                               at org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
                               at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
                               at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
                               at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
                               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.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
                               at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
                               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                               at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
                               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.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
                               at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
                               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                               at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
                               at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
                              17:19:02,266 ERROR [StandardContext] Error listenerStart
                              17:19:02,266 ERROR [StandardContext] Context [/gop] startup failed due to previous errors


                              I think I should try something else

                              • 12. Re: Error selecting object
                                james_hays

                                I just moved my datasource from Oracle to MySql and am getting this issue now as well. The only change made to get this error was the change in a the datasource.

                                James

                                • 13. Re: Error selecting object
                                  james_hays

                                  Is there a solution to this issue for those of us that have to stay with 1.2.1GA for a while longer?

                                  • 14. Re: Error selecting object
                                    pmuir

                                    Post a new topic, piggy backing old topics is just confusing ;)

                                    1 2 Previous Next