i am trying to do a javaBeans component but it give me this error:
Exception in thread "main" java.lang.NullPointerException
    at probarcomponente.ProbarComponente.main(ProbarComponente.java:37)
Java Result: 1
The component:
public class Componente implements Serializable {
    private List<Persona> lista;
    public Componente() {
    }
    public class Personas {
        List<Persona> lista = new LinkedList<Persona>();
    }
    public List <Persona> Mostrar() {
        try {
            Connection conexion = DriverManager.getConnection("jdbc:mysql://192.168.100.128/mibase", "asis", "titanic24");
            java.sql.Statement comando = conexion.createStatement();
            String sql = "select * from dades_pers";
            ResultSet result = comando.executeQuery(sql);
            while (result.next()) {
                String nif = result.getString(1);
                String nom = result.getString(2);
                String cognoms = result.getString(3);
                String tel = result.getString(4);
            Personas p = new Personas();
            // Inserción en la lista 
            p.lista.add(new Persona(nif,nom,cognoms,tel)); 
            }  
        } catch (SQLException ex) {
            System.out.println("Error al mostrar datos");
            System.out.println(ex.getMessage());
        }
        return lista ;
    }
}
I have another class "Persona" with her attributes,constructor ,getters and setters.
public class Persona {
   private String nif ;
   private String nom;
   private String cognoms;
   private String telf;
    public Persona(String nif, String nom, String cognoms, String telf) {
        this.nif = nif;
        this.nom = nom;
        this.cognoms = cognoms;
        this.telf = telf;
    }
    public String getNif() {
        return nif;
    }
    public String getNom() {
        return nom;
    }
    public String getCognoms() {
        return cognoms;
    }
    public String getTelf() {
        return telf;
    }
    public void setNif(String nif) {
        this.nif = nif;
    }
    public void setNom(String nom) {
        this.nom = nom;
    }
    public void setCognoms(String cognoms) {
        this.cognoms = cognoms;
    }
    public void setTelf(String telf) {
        this.telf = telf;
    }
}
and finally i create another project to test the component:
public class ProbarComponente {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws SQLException {
        Componente comp = new Componente();
        List<Persona> lista = new LinkedList<Persona>();
        lista= comp.Mostrar();
        System.out.print("Tamaño de la lista es"+lista.size());
    }
}
Any help will be appreciated..
 
     
    