JavaWeb java.lang.NoClassDefFoundError: sun/security/ssl/HelloExtension

Jua*_*gés 4 java netbeans servlets glassfish

I\'m getting an error when trying to use a JavaWeb project using Glassfish 5.0. Everytime it tries to bring data from my SQL Database it gives me this error.
\nStandardWrapperValve[ListadoPersonas]: Servlet.service() for servlet ListadoPersonas threw exception\njava.lang.NoClassDefFoundError: sun/security/ssl/HelloExtension

\n

Here is the servlet ListadoEstadosCiviles where I call the function which brings the data back from my database

\n
GestorPersonas g = new GestorPersonas();\nArrayList<EstadoCivil> lista = g.obtenerEstadosCiviles();\nfor (EstadoCivil estadoCivil : lista) {\n    out.println("<tr><td>" + estadoCivil.getId() + "</td><td>" + estadoCivil.getNombre() + "</td></tr>");\n}\n
Run Code Online (Sandbox Code Playgroud)\n

Here is GestorPersonas() constructor:

\n
 public GestorPersonas() {\n        try {\n            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");\n        } catch (ClassNotFoundException ex) {\n            Logger.getLogger(GestorPersonas.class.getName()).log(Level.SEVERE, null, ex);\n        }\n    }\n
Run Code Online (Sandbox Code Playgroud)\n

Here is obtenerEstadosCiviles() method

\n
public ArrayList<EstadoCivil> obtenerEstadosCiviles() {\n    ArrayList<EstadoCivil> lista = new ArrayList<>();\n    \n    try {\n        Connection conn = DriverManager.getConnection(CONN,USER,PASS);\n        Statement st = conn.createStatement();\n        ResultSet rs = st.executeQuery("select * from EstadosCiviles");\n        // Si el select devuelve una \xc3\xbanica fila, en lugar de while, se usa un if\n        while (rs.next()) {\n            int id = rs.getInt("id");\n            String nombre = rs.getString("nombre");\n            EstadoCivil ec = new EstadoCivil(id, nombre);\n            lista.add(ec);\n        }\n        \n        rs.close();\n        st.close();\n        conn.close();\n    } catch (SQLException ex) {\n        Logger.getLogger(GestorPersonas.class.getName()).log(Level.SEVERE, null, ex);\n    }\n    \n    return lista;\n}\n
Run Code Online (Sandbox Code Playgroud)\n

I have no problem connecting my java application to sql, I think the problem is with glassfish but i cant figure out why it is not working

\n

This is the servlet that is calling obtenerEstadosCiviles() function, I expect that table full with data

\n

What I expect:\n这是我的列表应该呈现的地方

\n

UPDATE

\n

I\'ve just checked my plugins and it appears that Java Web and EE it\xc2\xb4s activated but the "Active" symbol doesnt appears active. Could this be part of the problem?\nJava EE 插件

\n

小智 6

遇到了基本相同的问题,最终用这里的解决方案解决了它。

在 glassfish 文件夹中,转到glassfish5/glassfish/modules/endorsed/并使用 winrar 或您喜欢的解压程序打开grizzly-npn-bootstrap.jar文件。

删除sun文件夹并尝试再次运行您的程序。