Can't set managed bean property Error

I am receiving the following error when trying to run a screen in my system and I have no idea why. All the posts I have seen on this don't seem to help. Can anyone help with this issue?

[5/14/07 15:51:04:796 EDT] 0000002e jsfE com.sun.faces.application.ApplicationImpl createAndMaybeStoreManagedBeans Can't set managed bean property: 'reportTypes'.

javax.faces.FacesException: Can't set managed bean property: 'reportTypes'.

at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:582)

at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:234)

at com.sun.faces.application.ApplicationImpl.createAndMaybeStoreManagedBeans(ApplicationImpl.java:899)

at com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:84)

at com.ibm.faces.databind.SelectItemsVarResolver.resolveVariable(SelectItemsVarResolver.java:40)

at com.highmark.qcr.client.report.ReportSelectionBB.selectedReportKey(ReportSelectionBB.java:198)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))

at java.lang.reflect.Method.invoke(Method.java(Compiled Code))

at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:127)

at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:73)

at javax.faces.component.UICommand.broadcast(UICommand.java:312)

at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:302)

at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:342)

at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:81)

at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:201)

at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1173)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)

at com.highmark.framework.web.UploadFilter.doFilter(UploadFilter.java:116)

at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)

at com.highmark.framework.web.TimeoutFilter.doFilter(TimeoutFilter.java:35)

at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)

at com.highmark.framework.web.FacelessJspFilter.doFilter(FacelessJspFilter.java:116)

at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:626)

at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)

at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1657)

at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)

at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:201)

at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:103)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)

at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)

My faces-config file is like this:

<managed-bean>

<description>Used to map the Report Code to a labelfor navigation to the appropriate report selection criteria page</description>

<managed-bean-name>reportTypes</managed-bean-name>

<managed-bean-class>java.util.TreeMap</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

<map-entries>

<value-class>java.lang.String</value-class>

<map-entry><key>10</key><value>Opportunity</value></map-entry>

<map-entry><key>20</key><value>Auditor</value></map-entry>

<map-entry><key>30</key><value>BusinessAnalyst</value></map-entry>

</map-entries>

</managed-bean>

<managed-bean>

<description>Managed bean used by the report criteria webpage</description>

<managed-bean-name>reportSelectionBB</managed-bean-name>

<managed-bean-class>com.highmark.qcr.client.report.ReportSelectionBB</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

</managed-bean>

<managed-bean>

<description>The handler beanfor the reportTypes</description>

<managed-bean-name>ReportTypeSelection</managed-bean-name>

<managed-bean-class>com.highmark.qcr.client.report.ReportTypeSelection</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

<managed-property>

<property-name>reportSelectionBB</property-name>

<value>#{reportSelectionBB}</value>

</managed-property>

<managed-property>

<property-name>reportTypes</property-name>

<value>#{reportTypes}</value>

</managed-property>

</managed-bean>

And my ReportTypeSelection object has the following:

private ReportSelectionBB report;

private Map reportTypes;

public ReportTypeSelection(){

}

publicvoid setReportSelectionBB(ReportSelectionBB report){

this.report = report;

}

publicvoid setReportTypes(Map r){

this.reportTypes = r;

}

public ReportSelectionBB getReportSelectionBB(){

return this.report;

}

public Map getReportTypes(){

return this.reportTypes;

}

[8146 byte] By [Bart69a] at [2007-11-15]
# 1

u r setting the managedbean wrong, try to set the Bean and use the list inside the bean.

<managed-bean>

<managed-bean-name>yourBean</managed-bean-name>

<managed-bean-class>

com.sun.java.bean.YourBean

</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

</managed-bean>

Srikanth

srikanthga at 2007-7-12 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 2
I'm not sure what you mean. Can you elaborate a bit on it? It seems what you have is pretty much how I defined my managed beans
Bart69a at 2007-7-12 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 3

Ignore it, srikanthg actually isn't aware of the managed facilities and does not know what he is talking about.

Well, this error message usually means that the object type of the given values does not fit in the object type of the specified property. With other words, the setter cannot be invoked.

You have declared the setter and getter to accept a type of the Map interface. To fix this problem I had to replace the "Map" declaration by "TreeMap" in the backing bean property and accessors. I have tested it here and I was able to reproduce the problem and the solution in JSF 1.1 (I haven't tried it in 1.2 yet, due to a lack of an running JSF 1.2 environment at this PC). Give it a try.

BalusCa at 2007-7-12 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 4
Well, I would like to try it, but we are using JSF 1.0 here and my company does not allow us to use 1.1 (or 1.2 for that matter). So, I'm kinda stuck. I should maybe mention, too, that I am using WAS 6.0 in RAD 6.0. Does that matter at all?
Bart69a at 2007-7-12 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 5

Also, I tried making the reportTypes member in the bean declared as type java.util.TreeMap and I am getting the same problem.

As an aside, isn't this very design flawed anyway? Should the map's values be hardcoded in faces-config like that? I'm guessing no. This was done by a previous developer and I will gladly refactor if this is not the correct approach.

Bart69a at 2007-7-12 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 6

> Also, I tried making the reportTypes member in the

> bean declared as type java.util.TreeMap and I am

> getting the same problem.

Nasty one. But why not upgrading to 1.1? Technically it is just backwards compatible. At my job we are using WSAD 5.1.1 with the JSF version upgraded to 1.1_02 and it works flawlessly.

> As an aside, isn't this very design flawed anyway?

> Should the map's values be hardcoded in faces-config

> like that? I'm guessing no. This was done by a

> previous developer and I will gladly refactor if

> this is not the correct approach.

You can consider to store the values in a database or using propertiesfiles. Or maybe even XML files.

BalusCa at 2007-7-12 > top of java,Enterprise & Remote Computing,Web Tier APIs...