Having trouble deploying simple web app in Jettyproblem using UserService of google appengineServlet Flow on a Request via Ajaxjetty Hello World Example not compilingdoes process still continue after client disconnectsGWT deploy on Jetty Server: java.lang.IllegalStateException: No such servlet: eventServiceImplhow to prevent servlet from being invoked directly through browserWatermarking dynamically created pdf's in google app engineI want to used lang to mark languages.In the process of authentication,This parameter is lostHow to run jasper report in servlet jsp mvcSending JWT Token in the body of response Java Spring

Should disabled buttons give feedback when clicked?

If your plane is out-of-control, why does military training instruct releasing the joystick to neutralize controls?

What do the horizontal lines in a P-V phase diagram mean?

SOLVED - GFCI - should my neutral and ground have continuity?

Is there any word for "disobedience to God"?

Why were Er and Onan punished if they were under 20?

How do Windows version numbers work?

Machine learning and operations research projects

Why was hardware diversification an asset for the IBM PC ecosystem?

Is Arc Length always irrational between two rational points?

Domain of definition of Laplace Operator on L^2

How were Martello towers supposed to work?

Do you know your 'KVZ's?

Did any of the founding fathers anticipate Lysander Spooner's criticism of the constitution?

How is angular momentum conserved for the orbiting body if the centripetal force disappears?

Why didn't Thanos kill all the Dwarves on Nidavellir?

Can fluent English speakers distinguish “steel”, “still” and “steal”?

How did the hit man miss?

Can I call 112 to check a police officer's identity in the Czech Republic?

Was I subtly told to resign?

Turning arguments into exponents

For a hashing function like MD5, how similar can two plaintext strings be and still generate the same hash?

Flatten array with OPENJSON: OPENJSON on a value that may not be an array? [ [1] ], vs [1]

Is Trump personally blocking people on Twitter?



Having trouble deploying simple web app in Jetty


problem using UserService of google appengineServlet Flow on a Request via Ajaxjetty Hello World Example not compilingdoes process still continue after client disconnectsGWT deploy on Jetty Server: java.lang.IllegalStateException: No such servlet: eventServiceImplhow to prevent servlet from being invoked directly through browserWatermarking dynamically created pdf's in google app engineI want to used lang to mark languages.In the process of authentication,This parameter is lostHow to run jasper report in servlet jsp mvcSending JWT Token in the body of response Java Spring






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am using Jetty to write a simple server.



SimpleServer.java:



public class SimpleServer 

public static void main(String[] args) throws Exception
Server server = new Server(8080);
server.setHandler(new ServerHandler());
server.start();
server.join();





ServerHandler.java:



public class ServerHandler extends AbstractHandler 

public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException

response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
response.getWriter().println("<h1>Hello World</h1>");




I use maven to package the files up into a war file and then throw them in the jetty/webapps directory. I have the war file named root.war, so that means the context is at localhost:8080/. But when I access it, I get the following error in the browser:



HTTP ERROR 503

Problem accessing /. Reason:

Service Unavailable



In the console, I get a java.lang.reflect.InvocationTargetException. This project works and runs in IntelliJ. It's only when I put it in the jetty/webapps folder that I get errors.










share|improve this question






















  • Post your web.xml

    – Akshay Mulgavkar
    Mar 26 at 3:57

















0















I am using Jetty to write a simple server.



SimpleServer.java:



public class SimpleServer 

public static void main(String[] args) throws Exception
Server server = new Server(8080);
server.setHandler(new ServerHandler());
server.start();
server.join();





ServerHandler.java:



public class ServerHandler extends AbstractHandler 

public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException

response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
response.getWriter().println("<h1>Hello World</h1>");




I use maven to package the files up into a war file and then throw them in the jetty/webapps directory. I have the war file named root.war, so that means the context is at localhost:8080/. But when I access it, I get the following error in the browser:



HTTP ERROR 503

Problem accessing /. Reason:

Service Unavailable



In the console, I get a java.lang.reflect.InvocationTargetException. This project works and runs in IntelliJ. It's only when I put it in the jetty/webapps folder that I get errors.










share|improve this question






















  • Post your web.xml

    – Akshay Mulgavkar
    Mar 26 at 3:57













0












0








0








I am using Jetty to write a simple server.



SimpleServer.java:



public class SimpleServer 

public static void main(String[] args) throws Exception
Server server = new Server(8080);
server.setHandler(new ServerHandler());
server.start();
server.join();





ServerHandler.java:



public class ServerHandler extends AbstractHandler 

public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException

response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
response.getWriter().println("<h1>Hello World</h1>");




I use maven to package the files up into a war file and then throw them in the jetty/webapps directory. I have the war file named root.war, so that means the context is at localhost:8080/. But when I access it, I get the following error in the browser:



HTTP ERROR 503

Problem accessing /. Reason:

Service Unavailable



In the console, I get a java.lang.reflect.InvocationTargetException. This project works and runs in IntelliJ. It's only when I put it in the jetty/webapps folder that I get errors.










share|improve this question














I am using Jetty to write a simple server.



SimpleServer.java:



public class SimpleServer 

public static void main(String[] args) throws Exception
Server server = new Server(8080);
server.setHandler(new ServerHandler());
server.start();
server.join();





ServerHandler.java:



public class ServerHandler extends AbstractHandler 

public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException

response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
response.getWriter().println("<h1>Hello World</h1>");




I use maven to package the files up into a war file and then throw them in the jetty/webapps directory. I have the war file named root.war, so that means the context is at localhost:8080/. But when I access it, I get the following error in the browser:



HTTP ERROR 503

Problem accessing /. Reason:

Service Unavailable



In the console, I get a java.lang.reflect.InvocationTargetException. This project works and runs in IntelliJ. It's only when I put it in the jetty/webapps folder that I get errors.







java jetty






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 3:55









Logan PhillipsLogan Phillips

3032 silver badges7 bronze badges




3032 silver badges7 bronze badges












  • Post your web.xml

    – Akshay Mulgavkar
    Mar 26 at 3:57

















  • Post your web.xml

    – Akshay Mulgavkar
    Mar 26 at 3:57
















Post your web.xml

– Akshay Mulgavkar
Mar 26 at 3:57





Post your web.xml

– Akshay Mulgavkar
Mar 26 at 3:57












1 Answer
1






active

oldest

votes


















1














Your example codebase is written using the Jetty Handler API.



A WAR file expects the Servlet API, not the Jetty Handler API.



If you want to continue using the Jetty Handler API, then you'll be staying with embedded-jetty and doing everything without a WAR file.



If you want a WAR file, then you'll have to not use the Jetty Handler API.



Migrate your code to using the Servlet API, and add a reference to it in your Web Descriptor (WEB-INF/web.xml). That will produce a proper WAR file that can be deployed.



public class ServerServlet extends HttpServlet 
public void doGet(HttpServletRequest request, HttpServletResponse response)

response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>Hello World</h1>");




Note: You can optionally, you can use the Servlet API Annotations instead of the WEB-INF/web.xml, but know that you'll want your $jetty.base instance directory configured to have the annotations module enabled.






share|improve this answer























  • Okay, this makes sense. I didn't pick this up when going through the eclipse documentation.

    – Logan Phillips
    Mar 26 at 20:55










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349617%2fhaving-trouble-deploying-simple-web-app-in-jetty%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Your example codebase is written using the Jetty Handler API.



A WAR file expects the Servlet API, not the Jetty Handler API.



If you want to continue using the Jetty Handler API, then you'll be staying with embedded-jetty and doing everything without a WAR file.



If you want a WAR file, then you'll have to not use the Jetty Handler API.



Migrate your code to using the Servlet API, and add a reference to it in your Web Descriptor (WEB-INF/web.xml). That will produce a proper WAR file that can be deployed.



public class ServerServlet extends HttpServlet 
public void doGet(HttpServletRequest request, HttpServletResponse response)

response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>Hello World</h1>");




Note: You can optionally, you can use the Servlet API Annotations instead of the WEB-INF/web.xml, but know that you'll want your $jetty.base instance directory configured to have the annotations module enabled.






share|improve this answer























  • Okay, this makes sense. I didn't pick this up when going through the eclipse documentation.

    – Logan Phillips
    Mar 26 at 20:55















1














Your example codebase is written using the Jetty Handler API.



A WAR file expects the Servlet API, not the Jetty Handler API.



If you want to continue using the Jetty Handler API, then you'll be staying with embedded-jetty and doing everything without a WAR file.



If you want a WAR file, then you'll have to not use the Jetty Handler API.



Migrate your code to using the Servlet API, and add a reference to it in your Web Descriptor (WEB-INF/web.xml). That will produce a proper WAR file that can be deployed.



public class ServerServlet extends HttpServlet 
public void doGet(HttpServletRequest request, HttpServletResponse response)

response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>Hello World</h1>");




Note: You can optionally, you can use the Servlet API Annotations instead of the WEB-INF/web.xml, but know that you'll want your $jetty.base instance directory configured to have the annotations module enabled.






share|improve this answer























  • Okay, this makes sense. I didn't pick this up when going through the eclipse documentation.

    – Logan Phillips
    Mar 26 at 20:55













1












1








1







Your example codebase is written using the Jetty Handler API.



A WAR file expects the Servlet API, not the Jetty Handler API.



If you want to continue using the Jetty Handler API, then you'll be staying with embedded-jetty and doing everything without a WAR file.



If you want a WAR file, then you'll have to not use the Jetty Handler API.



Migrate your code to using the Servlet API, and add a reference to it in your Web Descriptor (WEB-INF/web.xml). That will produce a proper WAR file that can be deployed.



public class ServerServlet extends HttpServlet 
public void doGet(HttpServletRequest request, HttpServletResponse response)

response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>Hello World</h1>");




Note: You can optionally, you can use the Servlet API Annotations instead of the WEB-INF/web.xml, but know that you'll want your $jetty.base instance directory configured to have the annotations module enabled.






share|improve this answer













Your example codebase is written using the Jetty Handler API.



A WAR file expects the Servlet API, not the Jetty Handler API.



If you want to continue using the Jetty Handler API, then you'll be staying with embedded-jetty and doing everything without a WAR file.



If you want a WAR file, then you'll have to not use the Jetty Handler API.



Migrate your code to using the Servlet API, and add a reference to it in your Web Descriptor (WEB-INF/web.xml). That will produce a proper WAR file that can be deployed.



public class ServerServlet extends HttpServlet 
public void doGet(HttpServletRequest request, HttpServletResponse response)

response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>Hello World</h1>");




Note: You can optionally, you can use the Servlet API Annotations instead of the WEB-INF/web.xml, but know that you'll want your $jetty.base instance directory configured to have the annotations module enabled.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 26 at 13:12









Joakim ErdfeltJoakim Erdfelt

34.4k4 gold badges62 silver badges98 bronze badges




34.4k4 gold badges62 silver badges98 bronze badges












  • Okay, this makes sense. I didn't pick this up when going through the eclipse documentation.

    – Logan Phillips
    Mar 26 at 20:55

















  • Okay, this makes sense. I didn't pick this up when going through the eclipse documentation.

    – Logan Phillips
    Mar 26 at 20:55
















Okay, this makes sense. I didn't pick this up when going through the eclipse documentation.

– Logan Phillips
Mar 26 at 20:55





Okay, this makes sense. I didn't pick this up when going through the eclipse documentation.

– Logan Phillips
Mar 26 at 20:55








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349617%2fhaving-trouble-deploying-simple-web-app-in-jetty%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript