IllegalArgumentException参数值[Long]不匹配类型[java.lang.String]

时间:2014-07-02 18:10:03

标签: jsf primefaces javabeans illegalargumentexception

我有以下问题:

我有一个maven项目,我将一些参数从素数面发送到Bean

有一个字段ConsultoresLong中的通讯Long变量发送Bean值,然后我将该值转换为String在别处处理。

                        <h:outputText value="Consultores: *" />  
                        <p:selectOneMenu id="menuConsultores" value="#{analisisEmbudoConsultorBean.consultorS}" effect="fold" >  
                             <f:selectItems value="#{analisisEmbudoConsultorBean.consultores}" var="consultor" 
                                            itemLabel="#{consultor.nombre}" itemValue="#{consultor.idConsultorComercial}"/>   
                        </p:selectOneMenu>

这是analisisEmbudoBean

private String consultorSelected;
private Long consultorS;
private Long consultorEvaluar;
private List<ConsultorComercial> consultores;

private Boolean encontrado=false;

/***
 * variables para mis indicadores
 */
private PieChartModel pieRepetidos;
private PieChartModel pieCantidadRepetidos;
private PieChartModel pieReferidos;
private PieChartModel pieCantidadReferidos;
private String embudo;
private String embudoSimple;
private CartesianChartModel barEmbudo;  
private CartesianChartModel barVentas;

private Date fechaCreacionDesde;    
private Date fechaCreacionHasta;

private String monedaSelected;

@PostConstruct
public void initMehtod(){ 
    UserBean userBean    = (UserBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("loginBean");
    usuarioCreador       = userBean.getUser();
    nombreUsuarioCreador = usuarioCreador.getFirstName()+" "+usuarioCreador.getLastName();
    unidadesNegocio=crmCoreSvc.findAllUnidadesNegocio();
    monedaSelected=crmCoreSvc.findMonedaDefault().getIdMoneda().toString();
}

@SuppressWarnings("deprecation")
private void cleanDate(Date date){
    date.setHours(0);
    date.setMinutes(0);
    date.setSeconds(0);
}

@SuppressWarnings("deprecation")
private void cleanDateFin(Date date){
    date.setHours(23);
    date.setMinutes(59);
    date.setSeconds(59);
}

public void handleConsultores(){
    encontrado=false;
    if (unidadNegocioSelected!=null&&unidadNegocioSelected.length()>0){
        consultores=crmCoreSvc.findConsultoresComercialesByUnidadNegocio(Long.valueOf(unidadNegocioSelected));
    }else{
        consultores=null;
    }
}

public void buscarReporte(ActionEvent eve){
    encontrado=false;
    consultorSelected= consultorS.toString();
    if (unidadNegocioSelected!=null&&unidadNegocioSelected.length()>0){
        if (consultorSelected!=null&&consultorSelected.length()>0){
            cleanDate(fechaCreacionDesde);  
            cleanDateFin(fechaCreacionHasta);

                ResumenConsultorDto resumen = crmCoreSvc.findResumenByConsultorAndFiltros(Long.valueOf(consultorSelected),fechaCreacionDesde,fechaCreacionHasta,Long.valueOf(monedaSelected)); //further code

这是错误:

2/07/2014 08:57:59 AM com.sun.faces.context.AjaxExceptionHandlerImpl log
GRAVE: JSF1073: se ha interceptado javax.faces.event.AbortProcessingException du
rante el procesamiento de INVOKE_APPLICATION 5 : UIComponent-ClientId=formMain:j
_idt211, Mensaje=/admin/analisisConsultor.xhtml @56,112 actionListener="#{analis
isEmbudoConsultorBean.buscarReporte}": java.lang.IllegalArgumentException: Param
eter value [6] was not matching type [java.lang.String]
2/07/2014 08:57:59 AM com.sun.faces.context.AjaxExceptionHandlerImpl log
GRAVE: /admin/analisisConsultor.xhtml @56,112 actionListener="#{analisisEmbudoCo
nsultorBean.buscarReporte}": java.lang.IllegalArgumentException: Parameter value
[6] was not matching type [java.lang.String]
javax.faces.event.AbortProcessingException: /admin/analisisConsultor.xhtml @56,1
12 actionListener="#{analisisEmbudoConsultorBean.buscarReporte}": java.lang.Ille
galArgumentException: Parameter value [6] was not matching type [java.lang.Strin
g]
    at javax.faces.event.MethodExpressionActionListener.processAction(Method
ExpressionActionListener.java:182)
    at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
    at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:
772)
    at javax.faces.component.UICommand.broadcast(UICommand.java:300)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)

    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1
267)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicat
ionPhase.java:82)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
    at com.isscloud.web.filter.CharacterEncodingFilter.doFilter(CharacterEnc
odingFilter.java:23)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilt
er.java:79)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:311)
    at org.springframework.security.web.access.intercept.FilterSecurityInter
ceptor.invoke(FilterSecurityInterceptor.java:116)
    at org.springframework.security.web.access.intercept.FilterSecurityInter
ceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.access.ExceptionTranslationFilter.do
Filter(ExceptionTranslationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.session.SessionManagementFilter.doFi
lter(SessionManagementFilter.java:101)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.authentication.AnonymousAuthenticati
onFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwar
eRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter
.doFilter(RequestCacheAwareFilter.java:45)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
 doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.authentication.AbstractAuthenticatio
 nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
 doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.authentication.logout.LogoutFilter.d
 oFilter(LogoutFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
 doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.context.SecurityContextPersistenceFi
 lter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
 doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChai
 nProxy.java:173)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(D
 elegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(Delegat
 ingFilterProxy.java:259)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
 icationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
 ilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
 alve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
 alve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
 torBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
 ava:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
 ava:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
 563)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
 ve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
 a:403)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
 :301)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
 ss(Http11Protocol.java:162)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoin
 t.java:309)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
 utor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
 .java:908)
    at java.lang.Thread.run(Thread.java:662)
 Caused by: java.lang.IllegalArgumentException: Parameter value [6] was not match
 ing type [java.lang.String]
    at org.hibernate.ejb.AbstractQueryImpl.registerParameterBinding(Abstract
 QueryImpl.java:360)
    at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:364)
    at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:72)
    at com.isscloud.crm.svc.CrmCoreSvcImpl.findResumenByConsultorAndFiltros(
 CrmCoreSvcImpl.java:640)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
 java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
 sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
 on(AopUtils.java:318)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
 inpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
 ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor.in
 voke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
 ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
 cAopProxy.java:202)
    at $Proxy126.findResumenByConsultorAndFiltros(Unknown Source)
    at com.isscloud.crm.web.jsf.AnalisisEmbudoConsultorBean.buscarReporte(An
 alisisEmbudoConsultorBean.java:113)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
 java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
 sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:2
 78)
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpress
 ion.java:98)
    at javax.faces.event.MethodExpressionActionListener.processAction(Method
 ExpressionActionListener.java:148)
    ... 56 more

我没有看到代码中的任何错误。特别是因为我在Bean中向Long变量发送了Long值,而且我几乎尝试了所有内容。

0 个答案:

没有答案