La función de búsqueda no funciona

I have a text Field where the user enter a world to search a JTable when the user click a button called btnSearch.

every time I try to perform a search nothing happen and an Exception is thrown (see error below) when debug it show that the error occur at the if statement condition. could you please explain what I should do to fix the problem

el error:

     Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError:com.mysql.jdbc.StringUtils.isEmptyOrWhitespaceOnly(Ljava/lang/String;)Z

The Code behind the search button:

    btnSearch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            String entry =txtSearchData.getText();
            if (StringUtils.isEmptyOrWhitespaceOnly(entry)){

            }else{
            }
            txtSearchData.setText(" ");
        }
    });

preguntado el 05 de mayo de 13 a las 12:05

1 Respuestas

The only explanation I can find is you are using 2 mysql jdbc jars:

  • one that has StringUtils.isEmptyOrWhitespaceOnly defined, and which is used when you compile your code;

  • another one that does not have StringUtils.isEmptyOrWhitespaceOnly defined, and which is used when you run your code.

You should use only one version, both for compiling and running. Check you project dependencies and make sure there is only one mysql jdbc driver.

contestado el 05 de mayo de 13 a las 13:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.