cancel
Showing results for 
Search instead for 
Did you mean: 

Attempt to coerce a value of type NavigationBean

rrobles
Champ in-the-making
Champ in-the-making
Hi,
    I'm trying custom the Advanced Search, I want add 5 new panels and each one with custom properties, but finally I can't it because I have problems with NavigationBean.

These are the steps that I have followed
    1. I extended SearchProperties in my class CustomSearchProperties. I extended it because I need to show specific properties in each of my new panels through JSF.
      2. I extended AdvancedSearchDialog in my class CustomAdvancedSearchDialog. I extended it because, I needed it to add new panels.
      3. I write my own SearchContext (equal to original) because, from CustomAdvancedSearchContext I can't to access to the static class RangeProperties
      4. Then, I need change NavigationBean, because in the class CustomAdvancedSearch, it's necessary to store the search (my SearchContext),
          and NavigationBean only accept   the SearchContext from  org.alfresco.web.bean.search.SearchContext. I write my own NavigationBean and called CustomNavigationBean
      5. Later, I declarated the manage-bean in faces-config-custom.xml


      <managed-bean>
          <description>
             The bean that holds a state for the Advanced Search screen.
          </description>
          <managed-bean-name>CustomSearchProperties</managed-bean-name>
          <managed-bean-class>com.example.web.bean.search.CustomSearchProperties</managed-bean-class>
          <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>

    <managed-bean>
          <description>
             The bean that holds navigation state.
          </description>
          <managed-bean-name>CustomNavigationBean</managed-bean-name>
          <managed-bean-class>com.example.web.bean.search.CustomNavigationBean</managed-bean-class>
          <managed-bean-scope>session</managed-bean-scope>
          <managed-property>
             <property-name>nodeService</property-name>
             <value>#{NodeService}</value>
          </managed-property>
          <managed-property>
             <property-name>searchService</property-name>
             <value>#{SearchService}</value>
          </managed-property>
          <managed-property>
             <property-name>namespaceService</property-name>
             <value>#{NamespaceService}</value>
          </managed-property>
          <managed-property>
             <property-name>serverConfiguration</property-name>
             <value>#{fileServerConfiguration}</value>
          </managed-property>
          <managed-property>
             <property-name>ruleService</property-name>
             <value>#{RuleService}</value>
          </managed-property>
          <managed-property>
             <property-name>userPreferencesBean</property-name>
             <value>#{UserPreferencesBean}</value>
          </managed-property>
          <managed-property>
             <property-name>authenticationService</property-name>
             <value>#{AuthenticationService}</value>
          </managed-property>
          <managed-property>
             <property-name>permissionService</property-name>
             <value>#{PermissionService}</value>
          </managed-property>
       </managed-bean>
      

    <managed-bean>
          <description>
             The bean that holds a state for the Advanced Search screen.
          </description>
          <managed-bean-name>CustomAdvancedSearchDialog</managed-bean-name>
          <managed-bean-class>com.example.web.bean.search.CustomAdvancedSearchDialog</managed-bean-class>
          <managed-bean-scope>session</managed-bean-scope>
          <managed-property>
             <property-name>navigator</property-name>
             <value>#{CustomNavigationBean}</value>
          </managed-property>

         <managed-property>
             <property-name>nodeService</property-name>
             <value>#{NodeService}</value>
          </managed-property>
          <managed-property>
             <property-name>namespaceService</property-name>
             <value>#{NamespaceService}</value>
          </managed-property>
          <managed-property>
             <property-name>searchService</property-name>
             <value>#{SearchService}</value>
          </managed-property>
          <managed-property>
             <property-name>permissionService</property-name>
             <value>#{PermissionService}</value>
          </managed-property>
          <managed-property>
             <property-name>properties</property-name>
             <value>#{CustomSearchProperties}</value>
          </managed-property>
       </managed-bean>
       
    6. Finally, I customized the files:
              
      advanced-search.jsp: to show new panels.
                   browse.jsp: to access new CustomNavigationBean
But, I can't continue because I've got next error:


12:39:32,593 User:admin ERROR [shared_impl.util.ClassUtils] Cannot coerce com.example.web.search.CustomNavigationBean to org.alfresco.web.bean.NavigationBean
javax.servlet.jsp.el.ELException: Attempt to coerce a value of type "com.example.web.bean.search.CustomNavigationBean" to type "org.alfresco.web.bean.NavigationBean"
        at org.apache.commons.el.Logger.logError(Logger.java:481)
        at org.apache.commons.el.Logger.logError(Logger.java:498)
        at org.apache.commons.el.Logger.logError(Logger.java:566)
        at org.apache.commons.el.Coercions.coerceToObject(Coercions.java:799)
        at org.apache.commons.el.Coercions.coerce(Coercions.java:343)
        at org.apache.myfaces.shared_impl.util.ClassUtils.convertToType(ClassUtils.java:304)
        at org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(ManagedBeanBuilder.java:188)
        at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:55)
        at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:314)
        at org.springframework.web.jsf.DelegatingVariableResolver.resolveVariable(DelegatingVariableResolver.java:108)
        at org.alfresco.web.app.AlfrescoVariableResolver.resolveVariable(AlfrescoVariableResolver.java:94)
        at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:570)
        at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
        at org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:458)
        at org.apache.myfaces.el.MethodBindingImpl.resolveToBaseAndProperty(MethodBindingImpl.java:183)
        at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:117)
        at org.alfresco.web.ui.common.Utils.processActionMethod(Utils.java:794)
        at org.alfresco.web.ui.common.component.UIPanel.broadcast(UIPanel.java:312)
        at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
        at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
        at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
        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.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy165.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:74)
        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.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy165.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)
12:41:25,732 User:admin ERROR [shared_impl.util.ClassUtils] Cannot coerce es.citic.web.bean.search.CustomNavigationBean to org.alfresco.web.bean.NavigationBean

Which is the problem?
Is there another way to do it?
Thanks
1 REPLY 1

rrobles
Champ in-the-making
Champ in-the-making
I have the cause of my problem.
I didn't create the methods set and get for my new variable navigator of type CustomNavigationBean in my class CustomAdvancedSearchDialog.
In the super class BaseBeanDialog exists another variable navigator of type NavigationBean.

Anyway, Anyone knows if  Is there another way to do it?
Thanks
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.