<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cmd &#8211; CodePills.com</title>
	<atom:link href="https://codepills.com/tag/cmd/feed/" rel="self" type="application/rss+xml" />
	<link>https://codepills.com</link>
	<description>Helping you make a better code</description>
	<lastBuildDate>Thu, 17 Jun 2021 12:31:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>3 ways how to kill Spring Boot application at port 8080 on Windows</title>
		<link>https://codepills.com/3-ways-how-to-kill-spring-boot-application-at-port-8080-on-windows/</link>
					<comments>https://codepills.com/3-ways-how-to-kill-spring-boot-application-at-port-8080-on-windows/#respond</comments>
		
		<dc:creator><![CDATA[Andrej Buday]]></dc:creator>
		<pubDate>Wed, 03 Feb 2021 17:47:12 +0000</pubDate>
				<category><![CDATA[Bug hunt]]></category>
		<category><![CDATA[cmd]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[IntelliJ Idea]]></category>
		<category><![CDATA[PID]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[process ID]]></category>
		<category><![CDATA[server container]]></category>
		<category><![CDATA[servlet]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring Boot]]></category>
		<category><![CDATA[Spring Boot application]]></category>
		<category><![CDATA[Spring development]]></category>
		<category><![CDATA[terminal]]></category>
		<guid isPermaLink="false">https://codepills.com/?p=1132</guid>

					<description><![CDATA[This article is a simple tutorial on how to kill your Spring Boot application which occupies port 8080 on Windows <a href="https://codepills.com/3-ways-how-to-kill-spring-boot-application-at-port-8080-on-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>This article tries to answer one of the most often occurred questions connected with Spring Boot development. When developing a web application with Spring Boot, you might hit an error announcing that port 8080 is occupied. In this article, we will see why and how to solve this error. However, be sure that tutorial can help you solve the occupancy of any other port.</p>
<p><span id="more-1132"></span></p>
<h2>Spring Boot application default port</h2>
<p>When you develop long enough with Spring Boot, you know the error very well. You work on your Spring Boot application, and you use a console for running the application. Or you use your favourite IDE runner for starting your application (my preferred IDE is IntelliJ IDEA). Your Spring Boot application in the running embedded in servlet container when suddenly you need to do something else. Instead of adequately terminating the embedded servlet container with your application, you detach from the servlet by a closing terminal window or switching to a different project in IDE. However, because you did not correctly terminate your IDE runner and did not correctly kill the terminal&#8217;s application process, the servlet with the application is still running. After that, you might, of course, start developing something else. Surprise, surprise, you cannot. Any Spring Boot application port, by default number 8080, is still occupied with the unterminated process of your Spring Boot servlet container. (In the tutorial, we assume you are using the Spring Boot application port on default port number 8080).</p>
<p>I guess you might be a little bit confused by all the wording describing the issue. Let&#8217;s take a look first at some terminology to understand the problem here fully:</p>
<h3>What is process?</h3>
<p>We are aware that readers of this blog are pretty skilled in computers. So, we will provide a brief description of what is computer process without going to further details.</p>
<p>Every time you start a program on your computer, it requires a certain amount of resource. Your Central Processor Unit, known as CPU, add to this program its process.</p>
<p>If you open task manager on your Windows, you will see a list of all process your CPU is trying to manage at once.</p>
<h3>What is process ID?</h3>
<p>The process ID, also known as PID, is the number assigned by the operating system to each new process.</p>
<h3>What is port number?</h3>
<p>A port number is how to identify individual processes for network message when they arrive on a server. In a real sense, a port number is the logical address of each application or process that helps identify the sender and receiver of processed messages. </p>
<p>You can imagine port numbers as doors in the hallway into which message flows through the networks. It leaves one door and enters another.</p>
<h3>What is Spring Boot server container?</h3>
<p>Spring Boot is a Spring project which makes Spring development fast. Without going too much into the Spring Boot project details, your Spring Boot application runs in a server container, better known as a servlet. This servlet runs in one computer process and lister on port 8080 for traffic.</p>
<h2>Restart computer</h2>
<p>One way how to solve this is to restart your computer. During the restart of Windows OS, start all the fresh, and port 8080 will be empty. But this is not the fastest and definitely not the right way for developers to solve this.</p>
<h2>Set different port number</h2>
<p>Another way is to solve this issue by assigning the Spring Boot application a different port number. When we set a different port number for the application, we will not kill the existing process with the application servlet container. However, we will create a new-different process for the servlet container, which will be listening on a different port. In this way, port 8080 will be still occupied, but we will at least be able to continue to develop.</p>
<p>Go to Spring Boot <code>application.properties</code> file and set different port number for <code>server.port</code> .</p>
<p>Despite this quick workaround, there is a much more mature way to solve this problem. I would like you to show a better way to kill a Spring Boot servlet container listening on port 8080.</p>
<h2>Kill the process listening at port 8080</h2>
<p>To kill the process listening at port 8080 in the Windows environment, we need only go through a few steps. First, check the image below to get the idea.</p>
<p><img fetchpriority="high" decoding="async" src="https://codepills.com/wp-content/uploads/2021/02/kill_process_at_port_8080_on_the_windows_10.png" alt="How to kill process listening at port_8080 on the Windows 10" width="623" height="198" class="size-full wp-image-1133" srcset="https://codepills.com/wp-content/uploads/2021/02/kill_process_at_port_8080_on_the_windows_10.png 623w, https://codepills.com/wp-content/uploads/2021/02/kill_process_at_port_8080_on_the_windows_10-300x95.png 300w" sizes="(max-width: 623px) 100vw, 623px" /></p>
<h3>Find the process occupying port 8080</h3>
<p>On the Windows, open your CMD terminal. With simple command <code>netstat  -ano  |  findstr  PORT_NUMBER</code>, where for PORT_NUMBER add port number 8080, and on command prompt output (hit enter), we will get the <b>process id</b> of process <strong>listening on port 8080</strong>.</p>
<h3>Kill the process with command prompt</h3>
<p>Now, all we need to do is just type the following command <code>taskkill  /F  /PID  PROCESS_ID</code> and replace PROCESS_ID by the <b>process id</b> we got from the previous command result.</p>
<p>If you have typed everything correctly, process listening on port 8080 should be terminated.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codepills.com/3-ways-how-to-kill-spring-boot-application-at-port-8080-on-windows/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to connect Azure Cosmos DB Emulator with Spring Boot app at Windows</title>
		<link>https://codepills.com/how-to-connect-azure-cosmos-db-emulator-with-spring-boot-app-at-windows/</link>
					<comments>https://codepills.com/how-to-connect-azure-cosmos-db-emulator-with-spring-boot-app-at-windows/#respond</comments>
		
		<dc:creator><![CDATA[Andrej Buday]]></dc:creator>
		<pubDate>Fri, 21 Feb 2020 13:58:46 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[cmd]]></category>
		<category><![CDATA[CosmosDB]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDK]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">https://codepills.com/?p=1060</guid>

					<description><![CDATA[In this article, we look at installing Azure Cosmos DB Emulator on your Windows machine and using the Azure Cosmos DB Emulator for local development of our Spring Boot application. <a href="https://codepills.com/how-to-connect-azure-cosmos-db-emulator-with-spring-boot-app-at-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>This article will look at how to install Azure Cosmos DB Emulator on your Windows machine and how to use the Azure Cosmos DB Emulator for the local development of our Spring Boot application.</p>
<p><span id="more-1060"></span></p>
<h2>How to install Azure CosmosDB Emulator</h2>
<p>First of all, we need to install Azure CosmosDB Emulator locally. Go to <a href="https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator#installation" title="How to install Cosmos DB" rel="nofollow noopener" target="_blank">https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator#installation</a>, download the windows installation package and install <strong>Azure Cosmos DB Emulator</strong>.</p>
<p>When installing Azure Cosmos DB Emulator passed successfully on your Windows machine, start the emulator (if it did not start automatically).</p>
<p>If it is already running you can find it minimized in the system hidden in the running application system and either click <strong>Open Data Explorer &#8230;</strong> or visit <a href="https://localhost:8081/_explorer/index.html" title="local address of Azure Cosmos DB Emulator" rel="nofollow noopener" target="_blank">https://localhost:8081/_explorer/index.html</a> page. You can now get finally into the Azure CosmosDB Emulator.</p>
<h2>Exporting security certificates</h2>
<p>Azure Cosmos DB Emulator uses a secure connection with your application. We need to extract and register your certificate for communication with the emulator.</p>
<p>Let’s type &#8220;Manage user certificates&#8221; into Windows Start console or open Windows Certificate Manager (running certlm.msc in the run prompt). Go to Personal->Certificates folder and export certificate with <strong>DocumentDbEmulatorCertificate</strong> name. The whole tutorial how to do it can be found at <a href="https://docs.microsoft.com/bs-latn-ba/azure/cosmos-db/local-emulator-export-ssl-certificates#how-to-export-the-azure-cosmos-db-ssl-certificate" title="How to export Azure Cosmos DB SSL certificate" rel="nofollow noopener" target="_blank">Microsoft Azure website</a> explaining how to export the Azure Cosmos DB SSL certificate.</p>
<p>You can name your file when exporting arbitrary. However, we will name it for our example <strong>documentdbemulatorcert.cer</strong>.</p>
<p>Now when I have extracted the SSL certificate, I need to upload it into the correct Java SDK location.</p>
<p>Check which version of Java do you use in your project. In IntelliJ idea you can use either keyword shortcut [ctrl] + [shift] + [alt] + [s] or go to File->Project Structure->SDKs and check which version your Spring Boot application uses or where SDK is located.</p>
<p>Copy certificate into the Java SDK directory. It should be copied into the <strong>%JAVA_HOME%/jre/lib/security</strong> location.</p>
<p>If you use OpenJDK, OpenJDK does not contain <strong>jre</strong> folder. Just copy it into <strong>%JAVA_HOME%/lib/security</strong> location.</p>
<h2>Registering certificate</h2>
<p>The nearly last thing we need to do is to register the certificate into the system.</p>
<p>We need to open the Windows Command prompt as an administrator and navigate at JDK&#8217;s folder at jdk\jre\lib\security.</p>
<p><strong>Hint</strong>: A little hint if you are more familiar with Linux based systems than Windows. If you open a folder in Windows, copy the path to the folder and place it into quotation marks in the command prompt. Executing the command changes the directory instantly.</p>
<p>Then, upon the folder, we need just to run the following command to register the certificate into the keystore on your system:</p>
<pre><code class="language-bash">keytool -keystore cacerts -importcert -alias documentdbemulator -file documentdbemulatorcert.cer</code></pre>
<p><strong>Hint</strong>: Keytool is a tool located in your Java installation, so you need to have jdk/bin on your PATH for this to work.</p>
<p>If you need a hint with registration, check this tutorial at <a href="https://docs.microsoft.com/en-us/azure/java/java-sdk-add-certificate-ca-store?view=azure-java-stable#to-add-a-root-certificate-to-the-cacerts-store" title="How to add a root certificate to the cacerts store" rel="nofollow noopener" target="_blank">Microsoft Azure website</a> where you learn how to add a root certificate to the certification authority certificates storage. However instead of <strong>bc2025.cer</strong> name in tutorial use name of your certificate.</p>
<p>Otherwise, when the prompt asks for a password, type your password. More likely you didn&#8217;t change it, so default password is <strong><i>changeit</i></strong>. Following, you get a question, if you trust this certificate. Answer it simply <strong>yes</strong>.</p>
<p>That is it. The certificate is registered, and Azure Cosmos DB Emulator should be now created securely and with ease.</p>
<h2>Using emulator with local Spring Boot app development</h2>
<p>And all we need to do now is just run the Spring Boot application. If you implemented a connection to Cosmos DB and registered connection properties to <code>application.properties</code> or <code>application.yml</code> you can successfully run the application.</p>
<pre><code class="language-yaml">azure:
   cosmosdb:
    uri: https://localhost:8081
    key: VERY_LONG_KEY
    database: YOUR_DB_NAME</code></pre>
<p>To fill up <code>application.yml</code> you will need to implement your own data:</p>
<p>You can find VERY_LONG_KEY in your Azure Cosmos DB Emulator Data Explorer under the <i>Quick start</i> tab.</p>
<p>And all we need to do now is just run the Spring Boot application. If you check now Data Explorer under <i>Explorer</i> tab, you can find now your database with all the defined structures.</p>
<h2>Troubleshooting</h2>
<p>In case you already successfully installed the Azure CosmosDB Emulator and you want to restart the database, you have an option to reset data. Data reset comes handy when you get an authentication issue over HTTPS with your Azure CosmosDB certificate on the application run.</p>
<p>Pick up &#8220;Reset data&#8221; from the Azure CosmosDB Emulator mini-panel dialogue window from your start button. Operation is not reversible; it will clean up all your caches and the internal state of the Azure CosmosDB Emulator database and reset the certificate.</p>
<p>Then it would be best if you continued extracting the certificate from the list of certificates according to the description in Exporting Security Certificates. However, before registering the certificate back to Java keytool, you need to remove the old alias on the certificate with a command like this:</p>
<pre><code class="language-bash">keytool -delete -alias documentdbemulator -keystore cacerts -storepass changeit</code></pre>
<p><strong>Notes</strong>: behind <code>-alias</code> you place the name of the certificate, <code>-keystore</code> is the name of a file containing the certificates and behind <code>-storepass</code> is your password (default is <i>changeit</i>).</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codepills.com/how-to-connect-azure-cosmos-db-emulator-with-spring-boot-app-at-windows/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
