JavaWeb java.lang.NoClassDefFoundError:sun/security/ssl/HelloExtension [英] JavaWeb java.lang.NoClassDefFoundError: sun/security/ssl/HelloExtension

查看:212
本文介绍了JavaWeb java.lang.NoClassDefFoundError:sun/security/ssl/HelloExtension的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试通过Glassfish 5.0使用JavaWeb项目时出现错误.每当它尝试从我的SQL数据库中获取数据时,都会出现此错误.
StandardWrapperValve [ListadoPersonas]:Servlet ListadoPersonas的Servlet.service()抛出异常java.lang.NoClassDefFoundError:sun/security/ssl/HelloExtension

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.
StandardWrapperValve[ListadoPersonas]: Servlet.service() for servlet ListadoPersonas threw exception java.lang.NoClassDefFoundError: sun/security/ssl/HelloExtension

这是servlet ListadoEstadosCiviles ,在这里我调用该函数来从数据库中获取数据

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

GestorPersonas g = new GestorPersonas();
ArrayList<EstadoCivil> lista = g.obtenerEstadosCiviles();
for (EstadoCivil estadoCivil : lista) {
    out.println("<tr><td>" + estadoCivil.getId() + "</td><td>" + estadoCivil.getNombre() + "</td></tr>");
}

这里是 GestorPersonas()构造函数:

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

这是 obtenerEstadosCiviles()方法

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

我将我的Java应用程序连接到sql没问题,我认为问题出在Glassfish,但我无法弄清为什么它不起作用

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

这是正在调用 obtenerEstadosCiviles()函数的servlet,我希望该表充满数据

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

我期望的是:

我刚刚检查了我的插件,似乎Java Web和EE已被激活,但"Active"却被激活了.符号未显示为活动状态.这可能是问题的一部分吗?

I've just checked my plugins and it appears that Java Web and EE it´s activated but the "Active" symbol doesnt appears active. Could this be part of the problem?

推荐答案

存在基本相同的问题,最终使用

Had basically the same problem, eventually solved it with this solution here.

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

In your glassfish folder go to glassfish5/glassfish/modules/endorsed/ and open the grizzly-npn-bootstrap.jar file with winrar or your preferred unzipper.

删除 sun 文件夹,然后尝试再次运行程序.

Delete the sun folder and try running your program again.

这篇关于JavaWeb java.lang.NoClassDefFoundError:sun/security/ssl/HelloExtension的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆