user6238728 user6238728 - 1 year ago 156
Java Question

MongoDB using Spark Java

When I run the code I'm getting the output as shown , how to fix this? thanks
Here I have used spark java

Intellij Idea
Should get Spark, Java, and MongoDB to work together

package com.mongodb;

import spark.Request;
import spark.Response;
import spark.Route;
import spark.Spark;

* Created by td on 10/20/2016.
public class HelloWorldSparkStyle {
public static void main (String[] args){
Spark.get("/" ,new Route() {
public Object handle(Request request, Response response) throws Exception {
return "Hellow World from Spark";

[Thread-0] INFO org.eclipse.jetty.util.log - Logging initialized @1089ms
[Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - == Spark has ignited ...
[Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - >> Listening on
[Thread-0] INFO org.eclipse.jetty.server.Server - jetty-9.3.6.v20151106
[Thread-0] ERROR spark.embeddedserver.jetty.EmbeddedJettyServer - ignite failed Address already in use: bind
at Method)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(
at org.eclipse.jetty.server.ServerConnector.doStart(
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
at org.eclipse.jetty.server.Server.doStart(
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
at spark.embeddedserver.jetty.EmbeddedJettyServer.ignite(
at spark.Service.lambda$init$0(

Process finished with exit code 100

Answer Source Address already in use: bind

means that the port you start your web server on (4567) is already used by another process. Kill this process or use another port (ex: 8090 etc).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download