会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132370个问题

老师,在这节视频里面运行spring-boot:run命令的时候报错,错误信息如下:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.074 s
[INFO] Finished at: 2019-05-27T21:26:31+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.10.RELEASE:run (default-cli) on project 20-spring-boot-springloader: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:1.5.10.RELEASE:run failed: Plugin org.springframework.boot:spring-boot-maven-plugin:1.5.10.RELEASE or one of its dependencies could not be resolved: Failed to collect dependencies at org.springframework.boot:spring-boot-maven-plugin:jar:1.5.10.RELEASE -> org.apache.maven:maven-archiver:jar:2.6 -> org.apache.maven:maven-artifact:jar:3.1.1: Failed to read artifact descriptor for org.apache.maven:maven-artifact:jar:3.1.1: Could not transfer artifact org.apache.maven:maven-artifact:pom:3.1.1 from/to nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public): RSA premaster secret error: SunTls12RsaPremasterSecret KeyGenerator not available -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:

我在百度上搜了一些方式,但是发现都没啥用,希望老师解答一下,感谢,附源代码一份

20-spring-boot-springloader.zip


JAVA 全系列/(旧的隐藏)第十一阶段:spring全家桶(Spring Boot)/Spring Boot 37457楼

package cn.sxt.Server;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

import cn.sxt.client.CloseUtil;

/**
 * 手写服务器服务器
 * @author Administrator
 *
 */
public class TextServer3 {
	public static void main(String[] args) {
		System.out.println("——————————————————————————服务器已经开启————————————————————————");
		String CRLF = "\r\n";//换行
		String BLANK = " ";//空格	
		
//		1\创建ServerSocket
		ServerSocket socket = null;
		//		2、监听客户端
		Socket client = null;
//		3、数据输入流
		InputStream is = null;
//		4、数据输出流
		BufferedWriter bw = null;
		try {
			socket = new ServerSocket(9999);
			client = socket.accept();
			
			is = client.getInputStream();
			String str = null;
			byte[] buf = new byte[10240];
			int len = is.read(buf);
			System.out.println(new String(buf, 0, len));
			/**对Web浏览器的请求作出相应 */
			/**
			 * http相应格式
			 * 1、http协议版本、状态代码、描述
			 * 2、响应头(Response Head)
			 * 3、响应正文(Response Content)
			 */
			StringBuilder sb = new StringBuilder();
			StringBuilder sbContent = new StringBuilder();
			sbContent.append("<http><head><title>响应结果</title></head>");
			sbContent.append("<body><t1>登录成功</t1></body></html>");
			
	//(1)拼接    	协议版本					状态代码Status Code					描述
			sb.append("HTTP/1.1").append(BLANK).append(200).append(BLANK).append("OK");
	//(2)响应头
			sb.append(CRLF);//换行
			sb.append("Content-Type: text/html;charset=utf-8");
			sb.append(CRLF);//换行
			sb.append("content-length:").append(sbContent.toString().getBytes().length).append(CRLF);
			
			sb.append(CRLF);//换行,代表响应头与正文部分之间的换行
			sb.append(sbContent);
//			通过流输出
			bw = new BufferedWriter(new OutputStreamWriter(client.getOutputStream(),"UTF-8"));
			bw.write(sb.toString());
			bw.flush();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
//			5、关闭	
			CloseUtil.closeAll(is, bw, client, socket);
		}
	}
}

按照课程里面的代码敲,显示结果是没有问题的。但是我修改了里面的一部分代码(如下所示):然后出现了问题。

image.png

服务器没有将全部代码返回:这是为什么?

image.png

JAVA 全系列/第二阶段:JAVA 基础深化和提高/手写服务器项目(旧) 37460楼
Python 全系列/第一阶段:Python入门/序列 37463楼
Python 全系列/第九阶段:Python_Django2 框架(隐藏)/Django视图层 37465楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/手写服务器项目(旧) 37467楼
JAVA 全系列/第一阶段:JAVA 快速入门/控制语句、方法、递归算法 37468楼
Python 全系列/第三阶段:Python 网络与并发编程/网络通信 37469楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/多线程和并发编程(旧) 37470楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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