File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes DAO access issue on managed bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "DAO access issue on managed bean" Watch "DAO access issue on managed bean" New topic

DAO access issue on managed bean

Ebe Ibraheem

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(
at com.sun.faces.mgbean.BeanManager.createAndPush(
at com.sun.faces.mgbean.BeanManager.create(
at com.sun.faces.el.ManagedBeanELResolver.getValue(
at javax.el.CompositeELResolver.getValue(
at com.sun.faces.el.FacesCompositeELResolver.getValue(
at com.sun.el.parser.AstIdentifier.getValue(
at com.sun.el.parser.AstValue.getValue(
at com.sun.el.ValueExpressionImpl.getValue(
at com.sun.facelets.el.TagValueExpression.getValue(
at javax.faces.component.UIData.getValue(
at com.icesoft.faces.component.panelseries.UISeries.getValue(
... 102 more
Caused by: com.sun.faces.spi.InjectionProviderException: com.sun.enterprise.InjectionException: Exception attempting invoke lifecycle method public void
at com.sun.faces.vendor.GlassFishInjectionProvider.invokePostConstruct(
at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(
... 114 more
Caused by: com.sun.enterprise.InjectionException: Exception attempting invoke lifecycle method public void
at com.sun.faces.vendor.GlassFishInjectionProvider.invokeLifecycleMethod(
at com.sun.faces.vendor.GlassFishInjectionProvider.invokePostConstruct(
at com.sun.faces.vendor.GlassFishInjectionProvider.invokePostConstruct(
... 115 more
Caused by: java.lang.reflect.InvocationTargetException
at Method)
at com.sun.faces.vendor.GlassFishInjectionProvider.invokeLifecycleMethod(
... 117 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.sun.faces.vendor.GlassFishInjectionProvider$
... 119 more
Caused by: java.lang.ClassCastException: cannot be cast to
... 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

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
toplink jpa provider
spring security

in the meantime ill try myself...
many thanks
Ebe Ibraheem

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.
I agree. Here's the link:
subject: DAO access issue on managed bean
It's not a secret anymore!