Illegalargumentexception

Asked

Viewed 301 times

3

I’m developing a project and I’m having a very annoying little problem. It is a WEB system.

When I look for a client it fills in all the fields I need correct however, when I look for another client I get the error message below: The strange thing is that the fields are correct, string - string, float - float, etc...

java.lang.IllegalArgumentException: paciente.profissao  

I looked for several things about this including posts here from Sopt and could not come up with a solution.

Error shown in stracktrace:

Set 23, 2014 9:27:02 AM javax.faces.component.UIViewRoot broadcastEvents  
SEVERE: AbortProcessingException thrown when processing event of type 'javax.faces.event.ValueChangeEvent' during phase 'PROCESS_VALIDATIONS 3' for component with ID or Client ID of 'listbox1'  
Set 23, 2014 9:27:02 AM javax.faces.component.UIViewRoot broadcastEvents  
SEVERE: javax.faces.event.AbortProcessingException: /medico/prontuario.jsp(816,127) '#{medico$prontuario.listbox1_processValueChange}' java.lang.IllegalArgumentException: endereco_paciente.logradouro  
javax.faces.event.AbortProcessingException: /medico/prontuario.jsp(816,127) '#{medico$prontuario.listbox1_processValueChange}' java.lang.IllegalArgumentException: endereco_paciente.logradouro  
        at com.sun.webui.jsf.event.MethodExprValueChangeListener.processValueChange(MethodExprValueChangeListener.java:73)  
        at javax.faces.event.ValueChangeEvent.processListener(ValueChangeEvent.java:123)  
        at com.sun.webui.jsf.component.WebuiInput.broadcast(WebuiInput.java:209)  
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:416)  
        at sun.reflect.GeneratedMethodAccessor128.invoke(Unknown Source)  
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
        at java.lang.reflect.Method.invoke(Method.java:606)  
        at com.sun.faces.extensions.avatar.components.PartialTraversalViewRootHelper.broadcastEvents(PartialTraversalViewRootHelper.java:500)  
        at com.sun.faces.extensions.avatar.components.PartialTraversalViewRootHelper.processValidators(PartialTraversalViewRootHelper.java:267)  
        at com.sun.faces.extensions.avatar.components.PartialTraversalViewRootImpl.processValidators(PartialTraversalViewRootImpl.java:152)  
        at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)  
        at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)  
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)  
        at com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.execute(PartialTraversalLifecycle.java:94)  
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)  
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)  
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  
        at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:267)  
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)  
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)  
        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:724)  
Caused by: java.lang.IllegalArgumentException: endereco_paciente.logradouro  
        at com.sun.data.provider.impl.CachedRowSetDataProvider.getFieldKeyInternal(CachedRowSetDataProvider.java:555)  
        at com.sun.data.provider.impl.CachedRowSetDataProvider.getFieldKey(CachedRowSetDataProvider.java:513)  
        at com.sun.data.provider.impl.AbstractDataProvider.getValue(AbstractDataProvider.java:97)  
        at yagaonline.medico.prontuario.listbox1_processValueChange(prontuario.java:3660)  
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
        at java.lang.reflect.Method.invoke(Method.java:606)  
        at org.apache.el.parser.AstValue.invoke(AstValue.java:172)  
        at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)  
        at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)  
        at com.sun.webui.jsf.event.MethodExprValueChangeListener.processValueChange(MethodExprValueChangeListener.java:71)  
        ... 32 more  

Set 23, 2014 9:27:02 AM javax.faces.component.UIViewRoot broadcastEvents  
SEVERE: AbortProcessingException thrown when processing event of type 'javax.faces.event.ValueChangeEvent' during phase 'PROCESS_VALIDATIONS 3' for component with ID or Client ID of 'listbox1'  
Set 23, 2014 9:27:02 AM javax.faces.component.UIViewRoot broadcastEvents  
SEVERE: javax.faces.event.AbortProcessingException: /medico/prontuario.jsp(816,127) '#{medico$prontuario.listbox1_processValueChange}' java.lang.IllegalArgumentException: paciente.indicado  
javax.faces.event.AbortProcessingException: /medico/prontuario.jsp(816,127) '#{medico$prontuario.listbox1_processValueChange}' java.lang.IllegalArgumentException: paciente.indicado  
        at com.sun.webui.jsf.event.MethodExprValueChangeListener.processValueChange(MethodExprValueChangeListener.java:73)  
        at javax.faces.event.ValueChangeEvent.processListener(ValueChangeEvent.java:123)  
        at com.sun.webui.jsf.component.WebuiInput.broadcast(WebuiInput.java:209)  
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:416)  
        at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:663)  
        at com.sun.faces.extensions.avatar.components.PartialTraversalViewRootImpl.processValidators(PartialTraversalViewRootImpl.java:153)  
        at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)  
        at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)  
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)  
        at com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.execute(PartialTraversalLifecycle.java:94)  
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)  
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)  
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  
        at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:267)  
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)  
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)  
        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:724)  
Caused by: java.lang.IllegalArgumentException: paciente.indicado  
        at com.sun.data.provider.impl.CachedRowSetDataProvider.getFieldKeyInternal(CachedRowSetDataProvider.java:555)  
        at com.sun.data.provider.impl.CachedRowSetDataProvider.getFieldKey(CachedRowSetDataProvider.java:513)  
        at com.sun.data.provider.impl.AbstractDataProvider.getValue(AbstractDataProvider.java:97)  
        at yagaonline.medico.prontuario.listbox1_processValueChange(prontuario.java:3658)  
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
        at java.lang.reflect.Method.invoke(Method.java:606)  
        at org.apache.el.parser.AstValue.invoke(AstValue.java:172)  
        at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)  
        at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)  
        at com.sun.webui.jsf.event.MethodExprValueChangeListener.processValueChange(MethodExprValueChangeListener.java:71)  
        ... 28 more  
This message was edited 2 times. Last update was at 23/09/2014 09:29:11

My code.

        try {
        getSessionBean1().getPesqcodpacienteRowSet1().setObject(1, listbox1.getSelected());
        pacienteDataProvider1.refresh();
        //  info("listbox");
        Integer paciente = (Integer) pacienteDataProvider1.getValue("paciente.codigo");
        String nome_paciente = (String) pacienteDataProvider1.getValue("paciente.nome");
        //guarda o código do paciente selecionado na seção
        FacesContext fc = FacesContext.getCurrentInstance();
        HttpSession session = (HttpSession) fc.getExternalContext().getSession(false);
        session.setAttribute("cod_paciente", paciente);
          info("paciente" + paciente);
        stmens.setText("teste código ok!");
        nome.setText(nome_paciente);
        tabSet1.setVisible(true);

        //busca e carrega os dados do paciente para todas as tabelas de dados
        getSessionBean1().getAlterapacienteRowSet1().setObject(1, paciente);
        pacienteDataProvider2.refresh();

        getSessionBean1().getPesqendereco_pacienteRowSet1().setObject(1, paciente);
        endereco_pacienteDataProvider.refresh();

        getSessionBean1().getPesqtelefone_pacienteRowSet1().setObject(1, paciente);
        telefone_pacienteDataProvider.refresh();

        getSessionBean1().getAnamneseRowSet().setObject(1, paciente);
        anamneseDataProvider.refresh();

        getSessionBean1().getHistorico_atestadoRowSet().setObject(1, paciente);
        historico_atestadoDataProvider.refresh();

        getSessionBean1().getPesqbioimpedanciometriaRowSet1().setObject(1, paciente);
        pesqbioimpedanciometriaDataProvider1.refresh();


        getSessionBean1().getPesqhistorico_consultaRowSet1().setObject(1, paciente);
        pesqhistorico_consultaDataProvider1.refresh();

        getSessionBean1().getPesqhistorico_dietaRowSet1().setObject(1, paciente);
        pesqhistorico_dietaDataProvider1.refresh();


        getSessionBean1().getPesqhistorico_examesRowSet1().setObject(1, paciente);
        pesqhistorico_examesDataProvider1.refresh();


        getSessionBean1().getFotosantesRowSet1().setObject(1, paciente);
        fotosantesDataProvider1.refresh();

        getSessionBean1().getFotosdepoisRowSet1().setObject(1, paciente);
        fotosdepoisDataProvider1.refresh();

        getSessionBean1().getLista_historico_procedimentosRowSet1().setObject(1, paciente);
        lista_historico_procedimentosDataProvider1.refresh();

        Integer validaresult2 = telefone_pacienteDataProvider.getRowCount();
        //      info("result deo tel "+validaresult2);
        listbox1.setVisible(false);
        if (validaresult2 == 1) {
            addtel.setVisible(true);
            DDD1.setVisible(true);
            tel1.setVisible(true);
            stxddd.setVisible(true);
            stxnum.setVisible(true);
            stxtipo.setVisible(true);
            tipotel1.setVisible(true);
            DDD2.setVisible(true);
            tel2.setVisible(true);
            stxddd1.setVisible(true);
            stxnum1.setVisible(true);
            stxtipo1.setVisible(true);
            tipotel2.setVisible(true);
            btn_tel.setVisible(true);
        }
        if (validaresult2 == 3) {
            addtel.setVisible(false);
            DDD1.setVisible(false);
            tel1.setVisible(false);
            stxddd.setVisible(false);
            stxnum.setVisible(false);
            stxtipo.setVisible(false);
            tipotel1.setVisible(false);
            DDD2.setVisible(false);
            tel2.setVisible(false);
            stxddd1.setVisible(false);
            stxnum1.setVisible(false);
            stxtipo1.setVisible(false);
            tipotel2.setVisible(false);
            btn_tel.setVisible(false);
        }
        if (validaresult2 == 2) {
            addtel.setVisible(true);
            DDD1.setVisible(true);
            tel1.setVisible(true);
            stxddd.setVisible(true);
            stxnum.setVisible(true);
            stxtipo.setVisible(true);
            tipotel1.setVisible(true);
            btn_tel.setVisible(true);
            DDD2.setVisible(false);
            tel2.setVisible(false);
            stxddd.setVisible(false);
            stxnum.setVisible(false);
            stxtipo.setVisible(false);
            tipotel2.setVisible(false);


        }

        String cpf1 = (String) pacienteDataProvider2.getValue("paciente.cpf");

        String nome1 = (String) pacienteDataProvider2.getValue("paciente.nome");
        info("nome " + nome1);

        String profissao1 = (String) pacienteDataProvider2.getValue("paciente.profissao");
        info("profissao " + profissao1);

        String email1 = (String) pacienteDataProvider2.getValue("paciente.email");
        info(email1);
        String indicado1 = (String) pacienteDataProvider2.getValue("paciente.indicado");
        info(indicado1);
        String rua = (String) pacienteDataProvider2.getValue("endereco_paciente.logradouro");
        info(rua);
        String bairro1 = (String) pacienteDataProvider2.getValue("endereco_paciente.bairro");
        info(bairro1);

        String cidade1 = (String) pacienteDataProvider2.getValue("endereco_paciente.cidade");
        info(cidade1);
        String cep1 = (String) pacienteDataProvider2.getValue("endereco_paciente.cep");
        info(cep1);

        String complemento1 = (String) pacienteDataProvider2.getValue("endereco_paciente.complemento");
        info(complemento1);
        Float num1 = (Float) pacienteDataProvider2.getValue("endereco_paciente.numero");
        info("" + num1);
        String observacoes1 = (String) pacienteDataProvider2.getValue("paciente.observacoes");
        info(observacoes1);
        Date datanasc = (Date) pacienteDataProvider2.getValue("paciente.nascimento");
        info("" + datanasc);
        String sexo1 = (String) pacienteDataProvider2.getValue("paciente.sexo");
        info(sexo1);
        String civil = (String) pacienteDataProvider2.getValue("paciente.estado_civil");
        info(civil);
        String indica = (String) pacienteDataProvider2.getValue("paciente.tipo_indicado");
        info(indica);
        cpf.setText(cpf1);
        nome2.setText(nome1);
        profissao.setText(profissao1);
        email.setText(email1);
        indicado.setText(indicado1);
        // indica2.setText(indica);
        lougradouro.setText(rua);
        bairro.setText(bairro1);
        cidade.setText(cidade1);
        complement.setText(complemento1);
        numero.setText(num1);
        data_nasc.setText(datanasc);
        observacoes.setText(observacoes1);

        cep.setText(cep1);

        txtsexo.setText(sexo1);
        txtestado.setText(civil);




    } catch (SQLException ex) {
        error("erro no list" + ex);
    }
  • Edit the question and add that part of the code

  • What part of the code? I’m sorry I’m a bit new in this formatted Sopt

  • No problem and Welcome :), I also don’t know much about the web, but that part where you say "when I look for another client" try to publish that part of the code

  • I added the code :)

  • pufff can’t help you...

  • The absence of your answer would implicitly indicate that you cannot help @jsantos1991.

  • I can’t help either, but whenever I have some mysterious mistake I always follow the motto: "the mistake is always in something that me I wrote"... in your stack trace, the only code that is not from Java itself is the at yagaonline.medico.prontuario.listbox1_processValueChange(prontuario.java:3658), then I’d start looking around.

  • @Eugeniomichetti, endereco_paciente.logradouro? From what I can see, it must be between lines 810 to 820 prontuario.jsp.

  • @Coldhack you’re absolutely right but since I asked for code because I wanted to try to help, I wanted the other user to know that at least I tried and did not ask to ask, and besides (I think) gives an UP the question and so can be seen by someone else who knows how to answer... Yet you’re right it’s an unnecessary comment...

  • @jsantos1991 this "UP" only occurs when the question or one of the answers is edited, not when someone comments... :( Furthermore, I find valid your reasons.

  • @mgibsonbr yes I noticed that, I was wrong...

  • @Coldhack follows the part where I take the street. String street = (String) patientDataProvider2.getValue("address_patient.street");

  • You were supposed to edit your question and put the code portion of the page (I believe you are using jsf/jsp). On the other hand, the method pacienteDataProvider2.getValue receives as argument a String or a logradouro?

  • Yes this same use jsf/jsp. It receives a patio, in the database the patio field is varchar(50). Usually when I first search the customer happens no problem, but if I fetch another customer I get this error, the 2 clients have the "same" data.

  • I have observed that this exception arises in several lines in your code, that is, in various parts you execute methods that are receiving illegal or inappropriate arguments. Why use String rua = (String) pacienteDataProvider2.getValue("endereco_paciente.logradouro"); instead of String rua = (String) pacienteDataProvider2.getValue(endereco_paciente.logradouro);. If logradouro in the database is a varchar(50) then, I believe, this to be mapped as an object of the type String, right?

  • But in case I take the " " does not recognize, I believe it is because I do not have getters & setters methods. This project is from the company where I work, as they started so I had to continue so.

  • 2

    PROBLEM SOLVED, my listbox was with 2 shares in onChange, where it ended up generating information conflict. Thank you all for your attention. Note: you have to put something related to "solved" ?

  • It would be interesting if you put that comment there as a response, it seems silly but can help other people.

Show 13 more comments

1 answer

1

Reply from the Author of the Post:

PROBLEM SOLVED, my listbox was with 2 shares in onChange, where ended up generating information conflict

  • 1

    Ascension, in these cases where we just copy and paste an author’s comment, the label is to mark the answer as "wiki", so you do not receive points (or lose), and that are not really yours, when voting on the answer. I don’t know if you can still [Dit] and do this or have to signal to moderators.

  • 1

    And there in the question should not have pasted the solution, I reversed its edition. The correct is to publish this same answer.

  • My fault, @brasofilo, that part I didn’t know about tagging. I didn’t have time to read the Stackoverflow terms of use. And, quiet, about the edition!

  • Well, in this case, I mean Netik :) And no problem because I don’t think this is written in [help], it’s more of a [meta] thing. Greetings!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.