会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132488个问题
Python 全系列/第二十四阶段:人工智能基础_深度学习理论和实战(旧)/Tensorflow入门与安装 29551楼

image.png

Maven_Demo.rar

第一个页面跳转都进不去,麻烦老师看一下什么地方出的问题

JAVA 全系列/第八阶段:Linux入门到实战/Maven 29556楼

java.lang.IllegalStateException: Failed to execute ApplicationRunner

at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:773) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:318) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

at com.wh.item.CommomItemApplication.main(CommomItemApplication.java:21) [classes/:na]

Caused by: java.lang.IllegalStateException: There is no normal TM.

at com.codingapi.txlcn.tc.txmsg.TMSearcher.search(TMSearcher.java:86) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.tc.txmsg.AutoTMClusterEngine.prepareToResearchTMCluster(AutoTMClusterEngine.java:83) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.tc.txmsg.AutoTMClusterEngine.onConnectFail(AutoTMClusterEngine.java:69) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.tc.txmsg.TCSideRpcInitCallBack.lambda$connectFail$3(TCSideRpcInitCallBack.java:107) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at java.util.ArrayList.forEach(ArrayList.java:1257) ~[na:1.8.0_191]

at com.codingapi.txlcn.tc.txmsg.TCSideRpcInitCallBack.connectFail(TCSideRpcInitCallBack.java:107) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.txmsg.netty.impl.NettyRpcClientInitializer.connect(NettyRpcClientInitializer.java:125) ~[txlcn-txmsg-netty-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.txmsg.netty.impl.NettyRpcClientInitializer.init(NettyRpcClientInitializer.java:85) ~[txlcn-txmsg-netty-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.tc.txmsg.TCRpcServer.init(TCRpcServer.java:58) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.common.runner.TxLcnApplicationRunner.run(TxLcnApplicationRunner.java:54) ~[txlcn-common-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:770) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

... 5 common frames omitted


JAVA 全系列/(旧的隐藏)第十五阶段:百战商城项目(Spring Cloud最新架构)/百战商城项目 29557楼
Python 全系列/第二阶段:Python 深入与提高/文件处理 29558楼
Python 全系列/第一阶段:Python入门/面向对象 29560楼
Python 全系列/第二十三阶段:人工智能基础_机器学习理论与实战/多项式回归、过拟合、模型正则化 29561楼

package com;

//接收客户端发送消息的线程类

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

class ChatReceive extends Thread{
    private Socket socket;
    public ChatReceive(Socket socket){
        this.socket = socket;
    }
    @Override
    public void run() {
        super.run();
    }

    //实现接收客户端发送的消息
    private void receiveMsg(){
        BufferedReader nb = null;
        try {
            nb = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
            while (true){
                String msg = nb.readLine();
                synchronized ("abc"){
                    //把读取到的数据写入公共数据区
                    CharRoomServer.buf="["+this.socket.getInetAddress()+"]"+msg;
                    //唤醒发送消息的线程对象
                    "abc".notifyAll();
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            if (nb!=null){
                try {
                    nb.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (this.socket!=null){
                try {
                    this.socket.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

//xiang客户端发送消息的线程类

class ChatSend extends Thread{
    private Socket socket;
    public ChatSend(Socket socket){
        this.socket = socket;
    }
    @Override
    public void run() {
        sendMsg();
    }


    //将公共数据区的消息发送给客户端

    private void sendMsg(){
        PrintWriter pw = null;
        try {
            pw = new PrintWriter(this.socket.getOutputStream());
            while (true){
                synchronized ("abc"){
                    //让发送消息的线程处于等待状态
                    "abc".wait();
                    //将公共数据区的消息发送给客户端
                    pw.println(CharRoomServer.buf);
                    pw.flush();
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            if (pw!=null){
                pw.close();
            }
            if (this.socket!=null){
                try {
                    this.socket.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

public class CharRoomServer {
    //定义公共数据区
    public static String buf;
    public static void main(String[] args)  {
        System.out.println("Chat Server Version 1.0");
        System.out.println("Listen at 8888");
        ServerSocket serverSocket = null;
        try {
            while (true){
                Socket socket = serverSocket.accept();
                System.out.println("连接到:"+socket.getInetAddress());
                new ChatReceive(socket).start();
                new ChatSend(socket).start();
            }
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            if (serverSocket!=null){
                try {
                    serverSocket.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

"C:\Program Files\Java\jdk-15.0.1\bin\java.exe" -Didea.launcher.port=51224 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\Administrator\IdeaProjects\socketDemo\out\production\socketDemo;C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMainV2 com.CharRoomServer

Chat Server Version 1.0

Listen at 8888

java.lang.NullPointerException: Cannot invoke "java.net.ServerSocket.accept()" because "serverSocket" is null

at com.CharRoomServer.main(CharRoomServer.java:111)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:564)

at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)


Process finished with exit code 0





找不到解决方法来

JAVA 全系列/第二阶段:JAVA 基础深化和提高/网络编程(旧) 29562楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/IO流技术 29564楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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