| Author |
DAO access issue on managed bean
|
Ebe Ibraheem
Greenhorn
Joined: Apr 14, 2009
Posts: 3
|
|
Hi there...
I have recently started a steep learning curve with JSF / ICEFaces. Im having issue when trying to access a DAO from my managed bean. Simply put my project has a simple faces-config.xml
The above managed bean is a in between class between DAO and view. This managed bean has an instance of the DAO.
The managed bean looks like :
The @PostConstruct init() method is just a lump pf logic to test my DAO access really. My understanding is that the PostConstruct is done before the view is rendered. So alas im initializing a List object so that i can pull it in on my view.
My view is :
Okey dokey so in the view my intention is to pull the above data that i got from my DAO and contruct a collapsible panel.
When i do this manually by just initializing my List object above "cPanelHeaders" and fill it up with "CollapsiblePanelHeaders"
objects all is fine and the view displays my goodies, but when i use a DAO to get the data to display i get a ClassCastException like so :
Caused by: com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection on managed bean collapsibleMB
at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:226)
at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:108)
at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:368)
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:222)
at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:86)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:86)
at com.sun.el.parser.AstValue.getValue(AstValue.java:127)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:206)
at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
at javax.faces.component.UIData.getValue(UIData.java:614)
at com.icesoft.faces.component.panelseries.UISeries.getValue(UISeries.java:572)
... 102 more
Caused by: com.sun.faces.spi.InjectionProviderException: com.sun.enterprise.InjectionException: Exception attempting invoke lifecycle method public void za.co.africanpulse.rms.frontend.managedbeans.CollapsiblePanelMB.init()
at com.sun.faces.vendor.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:134)
at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:220)
... 114 more
Caused by: com.sun.enterprise.InjectionException: Exception attempting invoke lifecycle method public void za.co.africanpulse.rms.frontend.managedbeans.CollapsiblePanelMB.init()
at com.sun.faces.vendor.GlassFishInjectionProvider.invokeLifecycleMethod(GlassFishInjectionProvider.java:298)
at com.sun.faces.vendor.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:211)
at com.sun.faces.vendor.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:132)
... 115 more
Caused by: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.faces.vendor.GlassFishInjectionProvider.invokeLifecycleMethod(GlassFishInjectionProvider.java:281)
... 117 more
Caused by: java.lang.reflect.InvocationTargetException
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 com.sun.faces.vendor.GlassFishInjectionProvider$1.run(GlassFishInjectionProvider.java:287)
... 119 more
Caused by: java.lang.ClassCastException: za.co.africanpulse.rms.frontend.domain.MenuHeaders cannot be cast to za.co.africanpulse.rms.frontend.domain.MenuHeaders
at za.co.africanpulse.rms.frontend.managedbeans.CollapsiblePanelMB.init(CollapsiblePanelMB.java:48)
... 124 more
Im guessing this is not an icefaces issue but JSF / Managed Bean issue, im doing something wrong when i access my DAO obvisouly, im just to tired to notice...
Ok so thats my story, may anyone take the time to help...
please help...
|
"Ok ill stop everything and work on your problem..."
|
 |
Ebe Ibraheem
Greenhorn
Joined: Apr 14, 2009
Posts: 3
|
|
Alrighty Ive found that everything works when I restart Glassfish...
but my only issue is that how would remedy an application server that i need to restart everytime i need to deploy my application... hmmm
im of the opinion that it might library issues(could be a bad mix of jars in my app and app server).
May anyone help in giving me a listing of jars required for a below comprised app :
icefaces 1.8.2
facelets
jsf1.2
toplink jpa provider
myfaces
spring security
in the meantime ill try myself...
many thanks
|
 |
Ebe Ibraheem
Greenhorn
Joined: Apr 14, 2009
Posts: 3
|
|
|
yey, after much hassle and scenic uphills. servlet version in web.xml has got to be 2.5 or above for annotation injection. and injected entitymanagers require container managed persistence.
|
 |
 |
|
|
subject: DAO access issue on managed bean
|
|
|