How to fix the “No message available” error when using servlets









up vote
-1
down vote

favorite












I just want to catch some values from my form using servlets but i got this error :



There was an unexpected error (type=Not Found, status=404).
No message available


Here is my Servlet :



@WebServlet("/catcher")
public class catchServlet extends HttpServlet

protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
String cityName = request.getParameter("cityName");
String countryCode = request.getParameter("countryCode");

System.out.println("cityName: " + cityName);
System.out.println("password: " + countryCode);

PrintWriter printWriter = response.getWriter();
printWriter.print("City Infos are :nName : " + cityName + " and country code is : " + countryCode);




And my HTML :



<form method="get" name="catchCityInfos" action="catcher">
<p>Name of the City : <input type="text" name="cityName" /></p>
<p>Country code : <input type="text" name="countryCode" /></p>
<input type="submit" value="Submit" />
</form>


The values are going to the URL, but nothing is printed neither in the console nor the /catcher page



I've tried with the post method but it doesnt change anything










share|improve this question





















  • Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
    – JB Nizet
    Nov 11 at 14:40











  • My form is at the http://localhost:8080/board address and when i submit it goes here http://localhost:8080/catcher?cityName=London&countryCode=UK with the error
    – loic.k
    Nov 11 at 14:44










  • That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
    – JB Nizet
    Nov 11 at 14:48











  • I only have these infos Initializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms And i dont have web.xml file, is it necessary ?
    – loic.k
    Nov 11 at 15:06











  • Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
    – JB Nizet
    Nov 11 at 15:07














up vote
-1
down vote

favorite












I just want to catch some values from my form using servlets but i got this error :



There was an unexpected error (type=Not Found, status=404).
No message available


Here is my Servlet :



@WebServlet("/catcher")
public class catchServlet extends HttpServlet

protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
String cityName = request.getParameter("cityName");
String countryCode = request.getParameter("countryCode");

System.out.println("cityName: " + cityName);
System.out.println("password: " + countryCode);

PrintWriter printWriter = response.getWriter();
printWriter.print("City Infos are :nName : " + cityName + " and country code is : " + countryCode);




And my HTML :



<form method="get" name="catchCityInfos" action="catcher">
<p>Name of the City : <input type="text" name="cityName" /></p>
<p>Country code : <input type="text" name="countryCode" /></p>
<input type="submit" value="Submit" />
</form>


The values are going to the URL, but nothing is printed neither in the console nor the /catcher page



I've tried with the post method but it doesnt change anything










share|improve this question





















  • Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
    – JB Nizet
    Nov 11 at 14:40











  • My form is at the http://localhost:8080/board address and when i submit it goes here http://localhost:8080/catcher?cityName=London&countryCode=UK with the error
    – loic.k
    Nov 11 at 14:44










  • That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
    – JB Nizet
    Nov 11 at 14:48











  • I only have these infos Initializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms And i dont have web.xml file, is it necessary ?
    – loic.k
    Nov 11 at 15:06











  • Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
    – JB Nizet
    Nov 11 at 15:07












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I just want to catch some values from my form using servlets but i got this error :



There was an unexpected error (type=Not Found, status=404).
No message available


Here is my Servlet :



@WebServlet("/catcher")
public class catchServlet extends HttpServlet

protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
String cityName = request.getParameter("cityName");
String countryCode = request.getParameter("countryCode");

System.out.println("cityName: " + cityName);
System.out.println("password: " + countryCode);

PrintWriter printWriter = response.getWriter();
printWriter.print("City Infos are :nName : " + cityName + " and country code is : " + countryCode);




And my HTML :



<form method="get" name="catchCityInfos" action="catcher">
<p>Name of the City : <input type="text" name="cityName" /></p>
<p>Country code : <input type="text" name="countryCode" /></p>
<input type="submit" value="Submit" />
</form>


The values are going to the URL, but nothing is printed neither in the console nor the /catcher page



I've tried with the post method but it doesnt change anything










share|improve this question













I just want to catch some values from my form using servlets but i got this error :



There was an unexpected error (type=Not Found, status=404).
No message available


Here is my Servlet :



@WebServlet("/catcher")
public class catchServlet extends HttpServlet

protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
String cityName = request.getParameter("cityName");
String countryCode = request.getParameter("countryCode");

System.out.println("cityName: " + cityName);
System.out.println("password: " + countryCode);

PrintWriter printWriter = response.getWriter();
printWriter.print("City Infos are :nName : " + cityName + " and country code is : " + countryCode);




And my HTML :



<form method="get" name="catchCityInfos" action="catcher">
<p>Name of the City : <input type="text" name="cityName" /></p>
<p>Country code : <input type="text" name="countryCode" /></p>
<input type="submit" value="Submit" />
</form>


The values are going to the URL, but nothing is printed neither in the console nor the /catcher page



I've tried with the post method but it doesnt change anything







java spring servlets






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 14:33









loic.k

106




106











  • Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
    – JB Nizet
    Nov 11 at 14:40











  • My form is at the http://localhost:8080/board address and when i submit it goes here http://localhost:8080/catcher?cityName=London&countryCode=UK with the error
    – loic.k
    Nov 11 at 14:44










  • That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
    – JB Nizet
    Nov 11 at 14:48











  • I only have these infos Initializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms And i dont have web.xml file, is it necessary ?
    – loic.k
    Nov 11 at 15:06











  • Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
    – JB Nizet
    Nov 11 at 15:07
















  • Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
    – JB Nizet
    Nov 11 at 14:40











  • My form is at the http://localhost:8080/board address and when i submit it goes here http://localhost:8080/catcher?cityName=London&countryCode=UK with the error
    – loic.k
    Nov 11 at 14:44










  • That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
    – JB Nizet
    Nov 11 at 14:48











  • I only have these infos Initializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms And i dont have web.xml file, is it necessary ?
    – loic.k
    Nov 11 at 15:06











  • Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
    – JB Nizet
    Nov 11 at 15:07















Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
– JB Nizet
Nov 11 at 14:40





Either you haven't deployed your code, or you're not accessing the correct URL. What is the context path of your app? What is the URL displayed in the address bar before and after you sublit the form?
– JB Nizet
Nov 11 at 14:40













My form is at the http://localhost:8080/board address and when i submit it goes here http://localhost:8080/catcher?cityName=London&countryCode=UK with the error
– loic.k
Nov 11 at 14:44




My form is at the http://localhost:8080/board address and when i submit it goes here http://localhost:8080/catcher?cityName=London&countryCode=UK with the error
– loic.k
Nov 11 at 14:44












That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
– JB Nizet
Nov 11 at 14:48





That looks correct. You porbably didn't deploy the servlet correctly. What happens when you add a constructor, aith logging statements inside, and you deploy it? Do you see something in the logs? And when you use your debugger? Is the constructor invoked (if you add one)? Do you have a web.xml file? What does it contain?
– JB Nizet
Nov 11 at 14:48













I only have these infos Initializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms And i dont have web.xml file, is it necessary ?
– loic.k
Nov 11 at 15:06





I only have these infos Initializing Spring FrameworkServlet 'dispatcherServlet' FrameworkServlet 'dispatcherServlet': initialization started FrameworkServlet 'dispatcherServlet': initialization completed in 15 ms And i dont have web.xml file, is it necessary ?
– loic.k
Nov 11 at 15:06













Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
– JB Nizet
Nov 11 at 15:07




Wait, you're using Spring MVC? Then why the hell are you writing a servlet, and not a Spring MVC controller? You need to learn Spring MVC.
– JB Nizet
Nov 11 at 15:07

















active

oldest

votes











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',
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%2f53249735%2fhow-to-fix-the-no-message-available-error-when-using-servlets%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f53249735%2fhow-to-fix-the-no-message-available-error-when-using-servlets%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

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線