Hi Guys! I need help figuring out how to correct my code. I'm trying to run a checksum for the first time and I keep running into errors. I hope to figure out how to fix these! The code: package com.snhu.sslserver;   import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;   import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException;   @SpringBootApplication public class SslServerApplication {   publicstaticvoidmain(String[]args){ SpringApplication.run(SslServerApplication.class,args); } }   @RestController class SslserverController {   @RequestMapping("/hash")

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Hi Guys! I need help figuring out how to correct my code. I'm trying to run a checksum for the first time and I keep running into errors. I hope to figure out how to fix these!

The code:

package com.snhu.sslserver;

 

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

 

import java.nio.charset.StandardCharsets;

import java.security.MessageDigest;

import java.security.NoSuchAlgorithmException;

 

@SpringBootApplication

public class SslServerApplication {

 

publicstaticvoidmain(String[]args){

SpringApplication.run(SslServerApplication.class,args);

}

}

 

@RestController

class SslserverController {

 

@RequestMapping("/hash")

publicStringgetHash()throwsNoSuchAlgorithmException{

Stringdata="Hello World, Check Sum!";

Stringname="KT";

String[]splitName=name.split(" ");

StringfirstName=splitName[0];

StringlastName=splitName[splitName.length-1];

name=firstName+" "+lastName;

 

MessageDigestmd=MessageDigest.getInstance("SHA-256");

byte[]sha256=md.digest(name.getBytes(StandardCharsets.UTF_8));

 

return"Data: "+data+"<br/><br/>"

+"Name: "+name+"<br/><br/>"

+"Name of cipher Algorithm Used: SHA-256<br/><br/>"

+"CheckSum value: "+bytesToHex(sha256);

}

 

privateStringbytesToHex(byte[]sha256){

StringBuilderchecksum=newStringBuilder();

 

for(byteb:sha256){

Stringhex=Integer.toHexString(0xff&b);

if(hex.length()==1)

checksum.append('0');

checksum.append(hex);

}

 

returnchecksum.toString();

}

}

 

org.springframework.boot.web.server.WebServerException:
(ServletWebServerApplicationContext.java:297)
~[spring-boot-2.2.4. RELEASE.j
at org.springframework.boot.web.embedded.tomcat.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh (ServletWebServerApplicationContext.java:163) ~[spring-boot-2.2.4. RELEASE.ja
at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:553) ~[spring-context-5.2.3. RELEASE.jar:5.2.3. RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh (ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.
at org.springframework.boot.SpringApplication.refresh (SpringApplication.java:747) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:397) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.run (SpringApplication.java:315) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4. RELEASE]
at org.springframework.boot. SpringApplication.run (SpringApplication.java:1226) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4.RELEASE]
at org.springframework.boot.SpringApplication.run (SpringApplication.java:1215) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4. RELEASE]
at com.snhu.sslserver.SslServer Application.main(SslServer Application.java:17) ~[classes/:na]
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector (StandardService.java:231) ~ [tomcat-embed-core-9.0.30.jar: 9.0.30]
at org.springframework.boot.web.embedded.tomcat. TomcatWebServer.addPreviouslyRemovedConnectors (TomcatWebServer.java:278) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4. RELEASE]
at org.springframework.boot.web.embedded. tomcat.TomcatWebServer.start (TomcatWebServer.java:197) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4.RELEASE]
... 10 common frames omitted
Unable to start embedded Tomcat server
TomcatWebServer.start (TomcatWebServer.java:215) ~[spring-boot-2.2.4. RELEASE.jar:2.2.4.RELEASE]
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector. Connector.startInternal (Connector.java:1008) [tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java:183) [tomcat-embed-core-9.0.30.jar: 9.0.30]
at org.apache.catalina.core.StandardService.addConnector (StandardService.java:227) ~ [tomcat-embed-core-9.0.30.jar:9.0.30]
12 common frames omitted
Caused by: java.lang.IllegalArgumentException: Failed to load keystore type [????] with path [file: /C:/Users/katel/eclipse-workspace/ssl-server_student/%3F%3F%3F%3F] due to [???? r
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext (AbstractJsseEndpoint.java:99) ~[tomcat-embed-core-9.0.30.jar: 9.0.30]
at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl (AbstractJsseEndpoint.java:71) ~ [tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.tomcat.util.net.NioEndpoint.bind (NioEndpoint.java:217) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup (AbstractEndpoint.java:1141) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.tomcat.util.net.AbstractEndpoint.start (AbstractEndpoint.java:1227) ~[tomcat-embed-core-9.0.30.jar: 9.0.30]
at org.apache.coyote.Abstract Protocol.start (Abstract Protocol.java:586) ~ [tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.connector. Connector.startInternal (Connector.java:1005) [tomcat-embed-core-9.0.30.jar:9.0.30]
14 common frames omitted
...
Caused by: java.io.IOException: Failed to load keystore type [????] with path [file: /C:/Users/katel/eclipse-workspace/ssl-server_student/%3F%3F%3F%3F] due to [???? not found]
at org.apache.tomcat.util.net.SSLUtilBase.getStore (SSLUtilBase.java:229) ~[tomcat-embed-core-9.0.30.jar: 9.0.30]
at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore (SSLHostConfigCertificate.java:206) [tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers (SSLUtilBase.java:283) [tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext (SSLUtilBase.java:247) ~[tomcat-embed-core-9.0.30.jar: 9.0.30]
org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext (AbstractJsseEndpoint.java:97) ~[tomcat-embed-core-9.0.30.jar: 9.0.30]
at
... 20 common frames omitted
51
Transcribed Image Text:org.springframework.boot.web.server.WebServerException: (ServletWebServerApplicationContext.java:297) ~[spring-boot-2.2.4. RELEASE.j at org.springframework.boot.web.embedded.tomcat. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh (ServletWebServerApplicationContext.java:163) ~[spring-boot-2.2.4. RELEASE.ja at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:553) ~[spring-context-5.2.3. RELEASE.jar:5.2.3. RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh (ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.4. RELEASE.jar: 2.2. at org.springframework.boot.SpringApplication.refresh (SpringApplication.java:747) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:397) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4.RELEASE] at org.springframework.boot.SpringApplication.run (SpringApplication.java:315) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4. RELEASE] at org.springframework.boot. SpringApplication.run (SpringApplication.java:1226) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4.RELEASE] at org.springframework.boot.SpringApplication.run (SpringApplication.java:1215) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4. RELEASE] at com.snhu.sslserver.SslServer Application.main(SslServer Application.java:17) ~[classes/:na] Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed at org.apache.catalina.core.StandardService.addConnector (StandardService.java:231) ~ [tomcat-embed-core-9.0.30.jar: 9.0.30] at org.springframework.boot.web.embedded.tomcat. TomcatWebServer.addPreviouslyRemovedConnectors (TomcatWebServer.java:278) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4. RELEASE] at org.springframework.boot.web.embedded. tomcat.TomcatWebServer.start (TomcatWebServer.java:197) ~[spring-boot-2.2.4. RELEASE.jar: 2.2.4.RELEASE] ... 10 common frames omitted Unable to start embedded Tomcat server TomcatWebServer.start (TomcatWebServer.java:215) ~[spring-boot-2.2.4. RELEASE.jar:2.2.4.RELEASE] Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed at org.apache.catalina.connector. Connector.startInternal (Connector.java:1008) [tomcat-embed-core-9.0.30.jar:9.0.30] at org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java:183) [tomcat-embed-core-9.0.30.jar: 9.0.30] at org.apache.catalina.core.StandardService.addConnector (StandardService.java:227) ~ [tomcat-embed-core-9.0.30.jar:9.0.30] 12 common frames omitted Caused by: java.lang.IllegalArgumentException: Failed to load keystore type [????] with path [file: /C:/Users/katel/eclipse-workspace/ssl-server_student/%3F%3F%3F%3F] due to [???? r at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext (AbstractJsseEndpoint.java:99) ~[tomcat-embed-core-9.0.30.jar: 9.0.30] at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl (AbstractJsseEndpoint.java:71) ~ [tomcat-embed-core-9.0.30.jar:9.0.30] at org.apache.tomcat.util.net.NioEndpoint.bind (NioEndpoint.java:217) ~[tomcat-embed-core-9.0.30.jar:9.0.30] at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup (AbstractEndpoint.java:1141) ~[tomcat-embed-core-9.0.30.jar:9.0.30] at org.apache.tomcat.util.net.AbstractEndpoint.start (AbstractEndpoint.java:1227) ~[tomcat-embed-core-9.0.30.jar: 9.0.30] at org.apache.coyote.Abstract Protocol.start (Abstract Protocol.java:586) ~ [tomcat-embed-core-9.0.30.jar:9.0.30] at org.apache.catalina.connector. Connector.startInternal (Connector.java:1005) [tomcat-embed-core-9.0.30.jar:9.0.30] 14 common frames omitted ... Caused by: java.io.IOException: Failed to load keystore type [????] with path [file: /C:/Users/katel/eclipse-workspace/ssl-server_student/%3F%3F%3F%3F] due to [???? not found] at org.apache.tomcat.util.net.SSLUtilBase.getStore (SSLUtilBase.java:229) ~[tomcat-embed-core-9.0.30.jar: 9.0.30] at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore (SSLHostConfigCertificate.java:206) [tomcat-embed-core-9.0.30.jar:9.0.30] at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers (SSLUtilBase.java:283) [tomcat-embed-core-9.0.30.jar:9.0.30] at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext (SSLUtilBase.java:247) ~[tomcat-embed-core-9.0.30.jar: 9.0.30] org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext (AbstractJsseEndpoint.java:97) ~[tomcat-embed-core-9.0.30.jar: 9.0.30] at ... 20 common frames omitted 51
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Windows
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education