会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133541个问题
WEB前端全系列/第一阶段:HTML5+CSS3模块/商城官网项目 5611楼
Python 全系列/第一阶段:Python入门/编程基本概念 5612楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/IO流技术 5613楼
JAVA 全系列/第五阶段:网页编程和设计/JavaScript语言 5614楼
JAVA 全系列/第七阶段:项目管理与SSM框架/SpringMVC旧 5616楼

屏幕截图 2023-03-27 170034.png

Python 全系列/第一阶段:Python入门/函数和内存分析 5617楼

Mon Mar 27 16:22:15 GMT+08:00 2023 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure


The last packet successfully received from the server was 1,405 milliseconds ago.  The last packet sent successfully to the server was 1,405 milliseconds ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)

at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)

at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:201)

at com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4869)

at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1656)

at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1217)

at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2189)

at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2220)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2015)

at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:768)

at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)

at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:385)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:323)

at java.sql.DriverManager.getConnection(DriverManager.java:664)

at java.sql.DriverManager.getConnection(DriverManager.java:247)

at com.itbaizhan.jdbcTest.main(jdbcTest.java:15)

Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171)

at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:106)

at sun.security.ssl.TransportContext.kickstart(TransportContext.java:238)

at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:410)

at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:389)

at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:186)

... 18 more

老师我的代码和课的一样可是运行结果是上面这些为什么啊


JAVA 全系列/第四阶段:数据库与AI协同技术实战/JDBC技术 5619楼

老师,直接在A的run方法里创建B的线程对象实现包装,在A类中联合,和课堂讲的区别在哪里呢

class A implements Runnable{
    @Override
    public void run() {
        Thread t3 =new Thread(new B());
        t3.start();
        for(int i=0;i<10;i++){
            if(i==5){
                try {
                    t3.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println(Thread.currentThread().getName()+":  A"+i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
class B implements Runnable{

    @Override
    public void run() {
        for(int i=0;i<20;i++){
            System.out.println(Thread.currentThread().getName()+"  B"+i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

public class TestJoinThread {
    public static void main(String[] args) {
        Thread t1 = new Thread(new A());
        t1.start();

        for(int i=0;i<10;i++){
            System.out.println(Thread.currentThread().getName()+"      "+i);
            //当主线程迭代因子为2时,并入A线程
            if(i==2){
                try {
                    t1.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}


JAVA 全系列/第二阶段:JAVA 基础深化和提高/多线程技术 5620楼
JAVA 全系列/第七阶段:项目管理与SSM框架/Spring旧 5622楼
Python 全系列/第一阶段:Python入门/编程基本概念 5623楼
Python 全系列/第二阶段:Python 深入与提高/(旧)坦克大战 5624楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637