[Resteasy-users] Status 404 - Could not find resource

2015-11-04 Thread Dave Rathnow
I'm having a strange problem and hope someone can tell me what I'm doing wrong.

I have a Resteasy servlet configured and reachable at http://myhost.com/srv  
and a couple of classes that look like this:

@Path("/connections")
public class Connections {
@Inject
private NetworkService networkService;

@GET
@Path("/")
@Produces({MediaType.APPLICATION_JSON})
public Collection allConnections() {
. . .
return listOfConnectionsDtos;
}
}

@Path("/outgoingrequests")
public class OutgoingRequests {
@Inject
private OutgoingRequestCache cache;

@GET
@Path("/")
@Produces({MediaType.APPLICATION_JSON})
public Collection allRequests() {
. . .
return listOfOutgoingReuqestsDtos;
}
}

These work fine and have been working for some time now. I access them with 
http://myhost.com/srv/connections and http://myhost.com/srv/outgoingrequests 
respectively.

I recently tried to add a new service to my app that looks like this

@Path("/devices")
public class Devices {
@Inject
private DeviceCache cache;

@GET
@Path("/")
@Produces({MediaType.APPLICATION_JSON})
public Collection allDevices() {
. . .
return listOfDeviceDTO;
}
}

However this one doesn't work.  When I try to access it with the url 
http://myhost.com/srv/devices I get "HTTP Status: 404" returned. I've tried 
creating a couple of other dummy service using this same pattern and they are 
all coming back with a 404 error. I've turned on debug logging for Resteasy 
categories and I'm seeing the following exception in my JBoss log file:

15:33:10,001 DEBUG [org.jboss.resteasy.core.SynchronousDispatcher] () PathInfo: 
/devices
15:33:10,002 DEBUG [org.jboss.resteasy.core.SynchronousDispatcher] () Failed 
executing GET /devices: org.jboss.resteasy.spi.NotFoundException: Could not 
find resource for relative : /devices of full path: 
http://myhost.com/myapp/srv/devices
at 
org.jboss.resteasy.core.registry.RootSegment.matchChildren(RootSegment.java:360)
 [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at 
org.jboss.resteasy.core.registry.RootSegment.matchRoot(RootSegment.java:374) 
[resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at 
org.jboss.resteasy.core.registry.RootSegment.matchRoot(RootSegment.java:367) 
[resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at 
org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:350)
 [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at 
org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:192)
 [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at 
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:125)
 [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at 
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
 [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at 
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
 [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at 
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
 [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
  < -- SNIP -- >

My web.xml file looks like this:


resteasy.resources

zedi.pacbridge.web.services.OutgoingRequests,
zedi.pacbridge.web.services.Connections



   
  Resteasy
  
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
   

   
  resteasy.servlet.mapping.prefix
  /srv
   

   
  Resteasy
  /srv/*
   

Can anyone tell me what might be happening here?  What am I doing wrong???

Thanks,
Dave.
--
___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users


Re: [Resteasy-users] Status 404 - Could not find resource

2015-11-04 Thread John D. Ament
HI Dave,

You have a context param which is disabling scanning



resteasy.resources



zedi.pacbridge.web.services.OutgoingRequests,

zedi.pacbridge.web.services.Connections






Please add your class here, or stop using the context param.

On Wed, Nov 4, 2015 at 5:54 PM Dave Rathnow  wrote:

> I’m having a strange problem and hope someone can tell me what I’m doing
> wrong.
>
>
>
> I have a Resteasy servlet configured and reachable at
> http://myhost.com/srv  and a couple of classes that look like this:
>
>
>
> @Path("/connections")
>
> public class Connections {
>
> @Inject
>
> private NetworkService networkService;
>
>
>
> @GET
>
> @Path("/")
>
> @Produces({MediaType.APPLICATION_JSON})
>
> public Collection allConnections() {
>
> . . .
>
> return listOfConnectionsDtos;
>
> }
>
> }
>
>
>
> @Path("/outgoingrequests")
>
> public class OutgoingRequests {
>
> @Inject
>
> private OutgoingRequestCache cache;
>
>
>
> @GET
>
> @Path("/")
>
> @Produces({MediaType.APPLICATION_JSON})
>
> public Collection allRequests() {
>
> . . .
>
> return listOfOutgoingReuqestsDtos;
>
> }
>
> }
>
>
>
> These work fine and have been working for some time now. I access them
> with http://myhost.com/srv/connections and
> http://myhost.com/srv/outgoingrequests respectively.
>
>
>
> I recently tried to add a new service to my app that looks like this
>
>
>
> @Path("/devices")
>
> public class Devices {
>
> @Inject
>
> private DeviceCache cache;
>
>
>
> @GET
>
> @Path("/")
>
> @Produces({MediaType.APPLICATION_JSON})
>
> public Collection allDevices() {
>
> . . .
>
> return listOfDeviceDTO;
>
> }
>
> }
>
>
>
> However this one doesn’t work.  When I try to access it with the url
> http://myhost.com/srv/devices I get “HTTP Status: 404” returned. I've
> tried creating a couple of other dummy service using this same pattern and
> they are all coming back with a 404 error. I’ve turned on debug logging for
> Resteasy categories and I’m seeing the following exception in my JBoss log
> file:
>
>
>
> 15:33:10,001 DEBUG [org.jboss.resteasy.core.SynchronousDispatcher] ()
> PathInfo: /devices
>
> 15:33:10,002 DEBUG [org.jboss.resteasy.core.SynchronousDispatcher] ()
> Failed executing GET /devices: org.jboss.resteasy.spi.NotFoundException:
> Could not find resource for relative : /devices of full path:
> http://myhost.com/myapp/srv/devices
>
> at
> org.jboss.resteasy.core.registry.RootSegment.matchChildren(RootSegment.java:360)
> [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
>
> at
> org.jboss.resteasy.core.registry.RootSegment.matchRoot(RootSegment.java:374)
> [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
>
> at
> org.jboss.resteasy.core.registry.RootSegment.matchRoot(RootSegment.java:367)
> [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
>
> at
> org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:350)
> [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
>
> at
> org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:192)
> [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
>
> at
> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:125)
> [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
>
> at
> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
> [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
>
> at
> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
> [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
>
> at
> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
> [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
>
>   < -- SNIP -- >
>
>
>
> My web.xml file looks like this:
>
>
>
> 
>
> resteasy.resources
>
> 
>
> zedi.pacbridge.web.services.OutgoingRequests,
>
> zedi.pacbridge.web.services.Connections
>
> 
>
> 
>
>
>
>
>
>   Resteasy
>
>
> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
>
>
>
>
>
>
>
>   resteasy.servlet.mapping.prefix
>
>   /srv
>
>
>
>
>
>
>
>   Resteasy
>
>   /srv/*
>
>
>
>
>
> Can anyone tell me what might be happening here?  What am I doing wrong???
>
>
>
> Thanks,
>
> Dave.
>
> --
> ___
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>