1 Reply Latest reply on Jan 19, 2011 7:59 AM by Earnest Dyke

    Can't get EntityManager sometimes!

    Bilal Wahla Newbie

      Hi,


      For some reason EntityManager is perhaps unable to initialise sometimes and is able to other times e.g. the interface loads data into a table which of course requires pulling data out of the database and on click of a row in that table I try to re-render items in a drop-down where label of each being one of object's field. The data seems to be there when I debug but it just doesn't show up throwing up following exception (part of the stacktrace). Help/Guidance would be much appreciated.


      Thanks




      10:18:15,921 INFO  [STDOUT] 10:18:15,921 INFO  [AuthenticatorService] authenticate
      10:18:19,155 INFO  [STDOUT] 10:18:19,155 INFO  [ServiceLocator] Locating ServiceDataAccessAPI
      10:18:19,295 WARN  [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, Intercept
      orRegistry should be used via the bean container
      10:18:19,295 WARN  [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, Intercept
      orRegistry should be used via the bean container
      10:18:19,626 INFO  [STDOUT] Hibernate:
          select
              service0_.service_id as service1_40_,
              service0_.description as descript2_40_,
              service0_.longname as longname40_,
              service0_.shortname as shortname40_
          from
              service service0_
      10:18:20,417 INFO  [STDOUT] 10:18:20,417 INFO  [ServiceArgumentsBean] ServiceArguments: createInstance
      10:18:23,231 INFO  [STDOUT] Hibernate:
          select
              servicearg0_.argument_type_id as argument1_52_,
              servicearg0_.service_id as service2_52_
          from
              service_arguments servicearg0_
          where
              servicearg0_.service_id=?
      10:18:23,241 INFO  [STDOUT] Hibernate:
          select
              argumentty0_.argument_type_id as argument1_30_0_,
              argumentty0_.description as descript2_30_0_,
              argumentty0_.longname as longname30_0_,
              argumentty0_.shortname as shortname30_0_
          from
              argument_type argumentty0_
          where
              argumentty0_.argument_type_id=?
      10:18:23,251 INFO  [STDOUT] Hibernate:
          select
              argumentty0_.argument_type_id as argument1_30_0_,
              argumentty0_.description as descript2_30_0_,
              argumentty0_.longname as longname30_0_,
              argumentty0_.shortname as shortname30_0_
          from
              argument_type argumentty0_
          where
              argumentty0_.argument_type_id=?
      10:18:23,261 INFO  [STDOUT] Hibernate:
          select
              argumentty0_.argument_type_id as argument1_30_0_,
              argumentty0_.description as descript2_30_0_,
              argumentty0_.longname as longname30_0_,
              argumentty0_.shortname as shortname30_0_
          from
              argument_type argumentty0_
          where
              argumentty0_.argument_type_id=?
      10:18:23,331 INFO  [STDOUT] 10:18:23,321 ERROR [viewhandler] Error Rendering View[/serviceList.xhtml]
      java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrapperDataSource cannot be cast to javax.persistence.EntityMan
      agerFactory
              at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersiste
      nceContext.java:241)
              at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:78)
              at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:107)
              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.util.Reflections.invokeAndWrap(Reflections.java:144)
              at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
              at org.jboss.seam.Component.unwrap(Component.java:2275)
              at org.jboss.seam.Component.getInstance(Component.java:2041)
              at org.jboss.seam.Component.getInstance(Component.java:1983)
              at org.jboss.seam.Component.getInstance(Component.java:1977)
              at org.jboss.seam.Component.getInstance(Component.java:1972)
              at org.jboss.seam.framework.Controller.getComponentInstance(Controller.java:272)
              at org.jboss.seam.framework.PersistenceController.getPersistenceContext(PersistenceController.java:20)
              at org.jboss.seam.ui.JpaEntityLoader.createIdentifier(JpaEntityLoader.java:29)
              at org.jboss.seam.ui.AbstractEntityLoader.put(AbstractEntityLoader.java:46)
              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 org.jboss.seam.ui.JpaEntityLoader_$$_javassist_seam_7.put(JpaEntityLoader_$$_javassist_seam_7.java)
              at org.jboss.seam.ui.EntityConverter.getAsString(EntityConverter.java:65)
              at org.jboss.seam.ui.converter.PrioritizableConverter.getAsString(PrioritizableConverter.java:67)
              at org.jboss.seam.ui.converter.ConverterChain.getAsString(ConverterChain.java:126)
              at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getFormattedValue(HtmlBasicRenderer.java:448)
              at com.sun.faces.renderkit.html_basic.MenuRenderer.renderOption(MenuRenderer.java:480)
              at com.sun.faces.renderkit.html_basic.MenuRenderer.renderOptions(MenuRenderer.java:772)
              at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:832)
              at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:280)
              at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861)
              at org.jboss.seam.ui.util.cdk.RendererBase.renderChild(RendererBase.java:190)
              at org.jboss.seam.ui.util.cdk.RendererBase.renderChildren(RendererBase.java:166)
              at org.jboss.seam.ui.renderkit.ValidateAllRendererBase.doEncodeChildren(ValidateAllRendererBase.java:33)
              at org.jboss.seam.ui.util.cdk.RendererBase.encodeChildren(RendererBase.java:92)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:234)
              at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:239)
              at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:180)
              at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:127)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at org.jboss.seam.ui.util.cdk.RendererBase.renderChild(RendererBase.java:186)
              at org.jboss.seam.ui.util.cdk.RendererBase.renderChildren(RendererBase.java:166)
              at org.jboss.seam.ui.renderkit.DecorateRendererBase.doEncodeChildren(DecorateRendererBase.java:152)
              at org.jboss.seam.ui.util.cdk.RendererBase.encodeChildren(RendererBase.java:92)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at org.jboss.seam.ui.util.cdk.RendererBase.renderChild(RendererBase.java:186)
              at org.jboss.seam.ui.util.cdk.RendererBase.renderChildren(RendererBase.java:166)
              at org.jboss.seam.ui.renderkit.DecorateRendererBase.doEncodeChildren(DecorateRendererBase.java:152)
              at org.jboss.seam.ui.util.cdk.RendererBase.encodeChildren(RendererBase.java:92)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
              at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
              at org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:78)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
              at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
              at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:279)
              at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
              at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:220)
              at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:215)
              at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
              at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:166)
              at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:83)
              at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:157)
              at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:83)
              at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:157)
              at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:83)
              at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:157)
              at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:123)
              at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:677)
              at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:548)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
              at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
              at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:87)