• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Weird behaviour once a API end point has been called  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone

I am getting a very strange error when I call my API. I have a jersey application that has multiple API endpoints and I have a separate netbeans project that has my client where I have a jframe set up for a UI. When I call my end point when the user presses a button I constantly get a 404 error however if i continuously press the button (which calls my endpoint) I eventually get information back, i don't really understand why this is happening if anyone could help out that would be great!

ClientGui.java

 
Master Rancher
Posts: 4017
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anything in the server logs when you get the 404?

Have you tried debugging the client?
Even just logging some of the steps in that method would help.

Do you have th eoutput from that lot as well?

You also seem to be logging part of your code, and using Sys.out for other parts.
I would stick with the Logger, assuming it's set up correctly.
 
Jordan May
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

Nope I am getting nothing in the server logs, I have added a few system outs to see whats happening but with no joy. I just find it very strange that the GET request does eventually return something after enough clicks of the button -- The full response that i am getting is :

 
Saloon Keeper
Posts: 2504
321
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would first try and understand if the problem is with the client or the server.

Try using a tool like curl or Postman, or even a browser in developer mode and see if you consistently get the expected result from the server.
 
Jordan May
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tested it using postman, curl and also the browser and the URL works as expected so the problem must be got to do with how the client is calling the URL. The client code seems to work as i do get the result eventually when I keep triggering the actionPerformed, but just not on first click..
 
Ron McLeod
Saloon Keeper
Posts: 2504
321
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jordan May wrote:I tested it using postman, curl and also the browser and the URL works as expected so the problem must be got to do with how the client is calling the URL.


Ok - then emulate the server side and verify that the request from the client has the correct path (/api/productrange/1).

I tried your code and used Netcat to listen for connections on port 8080:
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
ScroogeXHTML - the small and fast RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!