Veriday
  • Solutions
    • Solutions
      • Managed IT Services
        • Cloud Readiness
        • Cloud Migration
        • Cloud Management
        • Application Modernization
        • Testing Automation
      • Digital-Agent
      • TaaS
      • Agent Portal
      • Commerce
      • Customer Portal
      • Dealer Portal
      • Intranet
      • Public Websites
      • Supplier Portal
    • Technologies
      • Liferay
      • Appian
      • Entando
  • Industries
    • Finance
    • Insurance
    • Manufacturing
    • Energy & Utilities
    • Retail
  • Products
    • Products
      • Digital-Agent
      • Digital Institute
      • Workplace OTS
    • Technologies
      • Liferay
      • Appian
      • Entando
  • Company
    • About Us
    • Partners
    • Awards & Recognition
    • Leadership
    • Careers
  • Resources
    • Blog
    • Webinars
    • Ebooks
    • White Paper
    • Case Study
    • Press Releases & Announcements
  • Contact Us
  • Menu Menu
Liferay, Technology

How to Troubleshoot 3 Common Jersey Exceptions

How to Troubleshoot 3 Common Jersey Exceptions

When building a web application, web services are an intrinsic component; without web services to supply data to the browser, the application is very limited in delivering value to the user.

Web applications have come a long way from the days of writing XMLHttpRequest objects from scratch and configuring basic Servlets to respond to the requests – there are many frameworks available that can simplify the web service interaction and save precious development time.

The Digital Agent tech stack includes Backbone.js in the front-end and the Jersey module supplied by the Spring Framework in the back-end. Together these two frameworks make implementing web services a breeze, but there are a few common exceptions that can be frustrating if you’re new to the frameworks and don’t know what they mean (or how to resolve them).

When developing with and debugging Jersey, you may have come across these exceptions (these are all HTTP 500 responses). I’ll use a simple ‘User’ web service to illustrate:

Exception 1: NullPointerException

  • @Controller annotation missing

From what I understand, for Spring to allow Jersey to handle requests to a given URL and utilize service-level classes, the ‘@Controller’ annotation must be present in the list of annotations immediately before the class declaration:

@Controller
public class UserWebService

If this annotation isn’t present, Spring isn’t aware of how to properly handle the request using the declared services. My first experience with this exception was writing the web service class from scratch, instead of ‘smartly reusing’ another working web service class.

Exception 2: Runtime Exception – com.sun.jersey.api.NotFoundException: null for uri: http://localhost:8080/delegate/services/user

  • @Path of web service class missing or web service class not deployed

If you’re just created a new web service and are anxious to see it interact with the front-end of the application, you may run into this exception…because you either missed the @Path annotation or didn’t deploy the most up-to-date web service classes. The class declaration now looks like this:

@Controller
@Path("/services/user")
public class UserWebService

The end result is the same – the front-end makes a request to a URI that Jersey isn’t aware of. Check that the necessary annotation is present and deploy those JAR files!

Exception 3: Runtime Exception – javax.ws.rs.WebApplicationException

  • Terminating Rule – @Path of web service class satisfied, but @Path of method not satisfied

This exception can surface when you are adding endpoints to an existing (and working) web service and fail to supply all of the path parameters, such as the ID of a resource.

@GET
@Path("/{id}")
public UserDto getUserById(@PathParam("id") long id)

The root cause is the @Path annotation of a method not being satisfied, in the case of a User web service, a ‘get by ID’ endpoint would require the ID of the user in question – if it’s not supplied (either due to user input or mis-use of a framework), this exception will be thrown.

Bonus! If you see a 404 response from your web service request, the fault is not that of the back-end. Check the URL that your front-end framework is making a request to, chances are it’s incorrect – either a missing leading ‘/’, or a typo in the path parameters.

At the end of the day, despite a few cryptic exceptions, these frameworks will drastically improve development times for web application projects. If (and when) you encounter an exception, it’s a huge time saver if you or someone on your team knows what the root cause is, and can translate the stack trace to plain English for you! Hopefully I’ve provided some human-readable assistance for you and these tips help you out!

The Business Case for Liferay

March 17, 2015/by Marketing @ Veriday
Share this entry
  • Share on Facebook
  • Share on X
  • Share on X
  • Share on LinkedIn
  • Share by Mail

Recent Posts

  • Upgrades shouldn’t slow innovation. Discover how Liferay and Veriday help teams reduce technical debt and evolve digital experiences without disruption.
    How to Reduce Technical Debt During Liferay DXP Upgrades: A Modernization GuideDecember 4, 2025 - 11:00 am
  • Enterprise Cloud Migration in 2026: Risks, Costs, and Best Practices
    How to Build a Cloud Migration Strategy in 2026: CIO PlaybookNovember 21, 2025 - 11:00 am
  • digital experience platform Canada, Liferay portal development US, managed cloud and IT services
    The Future of Liferay Portal Development: What Enterprises Need to Know in 2026November 13, 2025 - 11:30 am
  • From Legacy to Legendary: How Modern Portals Turn Agility into Experience.
    From Legacy to Legendary: How Modern Portals Turn Agility into Experience.November 7, 2025 - 10:00 am
  • AI virtual agent chatting with a user through a Liferay-based customer portal, showcasing generative AI integration.
    Generative AI: How to Embed Smart Chat and Virtual Agents in Customer PortalsOctober 30, 2025 - 11:28 am
  • ROI of Managed Private Cloud: Real-World Cost Savings & TCO Comparison
    How a Managed Private Cloud Can Save You Money: Real Numbers You Can TrustOctober 23, 2025 - 11:06 am

Our Latest eBook

 

 

 

 

 

 

 

 

 

 

 

 

 

Veriday Logo
  • Veriday Logo

Solutions

  • Intranet
  • Customer Portal
  • Agent Portal
  • See All

Industries

  • Manufacturing
  • Finance
  • Utilities
  • Retail
  • See All

Company

  • About Veriday
  • Partners
  • Awards & Recognition
  • Careers
© Copyright - Veriday Inc.    |    Privacy Policy    |    Accessibility
  • LinkedIn
  • X
  • Facebook
6 Facts You Shouldn’t Leave Out of Your Advisor BiographyAdvisors: 5 Quick Ways to Amplify the Reach of Your Digital MarketingTechLeadersJoin Veriday at the upcoming TechLeaders Conference!
Scroll to top