View Full Version : Getting 404 Not Found - while accessing valid REST service with Jersey + ExtJS

13 Aug 2014, 4:51 AM
I am working on ExtJS and need to access the REST services. I tried doing that with Spring's MVC REST supporting functionality and it worked well.

Now its kind of mandatory that I have to go with Jersey(JAX-RS). When tried with Jersey, I keep getting 404 error. I think the annotations, URL mapping, etc are fine (since the similar ones worked for Spring)

Below are the relevant code snippets.





Ext.onReady(function() {

var store = Ext.create('Ext.data.Store', {
autoLoad: true,
autoSync: true,
model: 'Product',
proxy: {
type: 'rest',
url: 'products',
format: 'json',
headers: {
'Content-Type': 'application/json'
reader: {
type: 'json',
root: 'data'
writer: {
type: 'json'
api: {
create: 'products/createJ/',
read: 'products/readJ/',
update: 'products/editJ/',
destroy: 'products/deleteJ/'

Controller :

public class JerseyProductsController {

private ProductService productService;

public Product createJ(@PathParam("id") int id, @RequestBody Product myProduct) {
return productService.create(myProduct);

public Product editJ(@PathParam("id") int id, @RequestBody Product myProduct) {
return productService.update(myProduct);

public Product deleteJ(@PathParam("id") int id) {
return productService.delete(id);

public List<Product> allProductsJ() {
return productService.getAll();

I get 404 for below URL:

Request URL:http://localhost:4080/MyProducts/products/jersey/products/readJ/.json?_dc=1407930853131&page=1&start=0&limit=25
Request Method:GET
Status Code:404 Not Found

Kindly let me know what is being missed.

Gary Schlosberg
13 Aug 2014, 5:40 AM
I've never worked with Jersey before. Do you see the data you are expecting when you go to your URL separately in your browser?

Does the server log the request?

13 Aug 2014, 6:05 AM
No Gary, actually that's the issue.

I get 404 with description as 'The requested resource is not available.' when hitting seperately from browser.

Firstly I thought its about wrong mapping, but it worked well with Spring REST framework. It blows when tried with Jersey.

Scott Mildenberger
14 Aug 2014, 7:16 AM
What URL is going to the server when you use Spring?