You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "KARR, DAVID (ATTCINW)" <dk...@att.com> on 2009/08/24 20:01:44 UTC

getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

I'm trying to set up a simple REST prototype running alongside some
other existing code.

When I deploy, I appear to fall into the following "if" block in
"AbstractJAXRSFactoryBean.checkResources()":

-----------------
        if (list.size() == 0) {
            org.apache.cxf.common.i18n.Message msg = 
                new
org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE", 
                                                       BUNDLE);
            LOG.severe(msg.toString());
            throw new
WebApplicationException(Response.Status.NOT_FOUND);
        }
---------------

This list would be empty if "serviceFactory.getRealClassResourceInfo()"
returned an empty list.  What exactly would that indicate?

My beans.xml is very simple right now, just:
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:jaxrs="http://cxf.apache.org/jaxrs"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">

	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
/>
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

    <jaxrs:server name="restcatalogserver" address="/rest">
        <jaxrs:serviceBeans>
            <bean class="com.att.ecom.catalog.Catalog"/>
        </jaxrs:serviceBeans>
    </jaxrs:server>
</beans>
--------------------

The "Catalog" class is also very primitive so far:
--------------------------
package com.att.ecom.catalog;

import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

@Path("/catalog/")
@Produces("application/xml")
public class Catalog {

	@GET
	@Path("/items")
	public List<Item> getItems() {
		ArrayList<Item>	result	= new ArrayList<Item>();
		result.add(new Item());
		return (result);
	}
	
	public static class Item {
		private String	title;
		private String  description;
		
		public String getTitle() { return title; }
		public String getDescription() { return description; }
		
		public void setTitle(String title) { this.title = title;
}
		public void setDescription(String description) {
this.description = description; }
	}
}
----------------------------

RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID (ATTCINW)
> Sent: Monday, August 24, 2009 11:02 AM
> To: users@cxf.apache.org
> Subject: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> I'm trying to set up a simple REST prototype running alongside some
> other existing code.
> 
> When I deploy, I appear to fall into the following "if" block in
> "AbstractJAXRSFactoryBean.checkResources()":
> 
> -----------------
>         if (list.size() == 0) {
>             org.apache.cxf.common.i18n.Message msg =
>                 new
> org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
>                                                        BUNDLE);
>             LOG.severe(msg.toString());
>             throw new
> WebApplicationException(Response.Status.NOT_FOUND);
>         }
> ---------------

I also noticed the following warning:

	WARNING: No resource methods found for resource class
com.att.ecom.catalog.Catalog

I've noticed other people on the net getting a similar error, but even
with those reports I don't understand what causes this.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <se...@iona.com>.
I also was able to start the server from Eclipse using this approach :

http://cxf.apache.org/docs/jax-rs.html#JAX-RS-ConfiguringJAXRSservicesprogrammaticallywithSpringconfigurationfile.

cheers, Sergey


Sergey Beryozkin wrote:
> 
> I've tried this class & beans.xml in the system tests area, Catalog class
> was recognized.
> 
> Can you please let me know a bit more about the way you load the (catalog)
> application ?
> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it a standalone
> server which explicitly loads the beans.xml ?
> 
> thanks, Sergey
> 
> 
> KARR, DAVID (ATTCINW) wrote:
>> 
>>> -----Original Message-----
>>> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>>> Sent: Monday, August 24, 2009 1:13 PM
>>> To: users@cxf.apache.org
>>> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
>>> "AbstractJAXRSFactoryBean.checkResources()"
>>> 
>>> 
>>> Hi
>>> 
>>> Everything seems to be ok.
>>> It appears the problem is to do with a missing import :
>>> 
>>> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>>> binding.xml" />
>>> 
>>> can you add it please to your beans.xml ?
>>> 
>>> For some reasons Catalog class is not introspected. Perhaps due to the
>>> fact
>>> the above import is missing and thus no jaxrs-aware spring factory is
>>> invoked
>> 
>> Nope, I'm afraid that didn't help.
>> 
>> The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-2.1.jar,
>> jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
>> 
>> My current XML and Java are this:
>> -----beans.xml------
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>>     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>>     xmlns:cxf="http://cxf.apache.org/core"
>> 	xsi:schemaLocation="
>> http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans.xsd
>> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>> http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
>> http://cxf.apache.org/core http://cxf.apache.org/schemascore.xsd">
>> 
>> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
>> />
>> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>>     <import
>> resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
>>     
>>     <jaxrs:server name="restcatalogserver" address="/rest">
>>         <jaxrs:features>
>>             <cxf:logging/>
>>         </jaxrs:features>
>>         <jaxrs:serviceBeans>
>>             <bean class="com.att.ecom.catalog.Catalog"/>
>>         </jaxrs:serviceBeans>
>>     </jaxrs:server>
>> </beans>
>> -------------------------
>> -----Catalog.java-----
>> package com.att.ecom.catalog;
>> import java.util.ArrayList;
>> import java.util.List;
>> import javax.ws.rs.GET;
>> import javax.ws.rs.Path;
>> import javax.ws.rs.PathParam;
>> import javax.ws.rs.Produces;
>> import javax.xml.bind.annotation.XmlRootElement;
>> 
>> @Path("/catalog/")
>> @Produces("application/xml")
>> public class Catalog {
>> 	@GET
>> 	@Path("/item/{id}")
>> 	public Item getItem(@PathParam("id") String id) {
>> 		Item item	= new Item();
>> 		item.setId(id);
>> 		item.setTitle("abc");
>> 		item.setDescription("def");
>> 		return new Item();
>> 	}
>> 	@XmlRootElement(name = "Item")
>> 	public static class Item {
>> 		private String	id;
>> 		private String	title;
>> 		private String  description;
>> 		
>> 		public String getTitle() { return title; }
>> 		public String getId() { return id; }
>> 		public String getDescription() { return description; }
>> 		
>> 		public void setTitle(String title) { this.title = title;
>> }
>> 		public void setId(String id) { this.id = id; }
>> 		public void setDescription(String description) {
>> this.description = description; }
>> 	}
>> }
>> --------------------
>> 
>>> KARR, DAVID (ATTCINW) wrote:
>>> >
>>> > I'm trying to set up a simple REST prototype running alongside some
>>> > other existing code.
>>> >
>>> > When I deploy, I appear to fall into the following "if" block in
>>> > "AbstractJAXRSFactoryBean.checkResources()":
>>> >
>>> > -----------------
>>> >         if (list.size() == 0) {
>>> >             org.apache.cxf.common.i18n.Message msg =
>>> >                 new
>>> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
>>> >                                                        BUNDLE);
>>> >             LOG.severe(msg.toString());
>>> >             throw new
>>> > WebApplicationException(Response.Status.NOT_FOUND);
>>> >         }
>>> > ---------------
>>> >
>>> > This list would be empty if
>>> "serviceFactory.getRealClassResourceInfo()"
>>> > returned an empty list.  What exactly would that indicate?
>>> >
>>> > My beans.xml is very simple right now, just:
>>> > -----------------------
>>> > <?xml version="1.0" encoding="UTF-8"?>
>>> > <beans xmlns="http://www.springframework.org/schema/beans"
>>> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>>> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>>> > 	xsi:schemaLocation="
>>> > http://www.springframework.org/schema/beans
>>> > http://www.springframework.org/schema/beans/spring-beans.xsd
>>> > http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>>> > http://cxf.apache.org/jaxrs
>> http://cxf.apache.org/schemas/jaxrs.xsd">
>>> >
>>> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>>> > 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
>>> > />
>>> > 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>>> >
>>> >     <jaxrs:server name="restcatalogserver" address="/rest">
>>> >         <jaxrs:serviceBeans>
>>> >             <bean class="com.att.ecom.catalog.Catalog"/>
>>> >         </jaxrs:serviceBeans>
>>> >     </jaxrs:server>
>>> > </beans>
>>> > --------------------
>>> >
>>> > The "Catalog" class is also very primitive so far:
>>> > --------------------------
>>> > package com.att.ecom.catalog;
>>> >
>>> > import java.util.ArrayList;
>>> > import java.util.List;
>>> >
>>> > import javax.ws.rs.GET;
>>> > import javax.ws.rs.Path;
>>> > import javax.ws.rs.Produces;
>>> >
>>> > @Path("/catalog/")
>>> > @Produces("application/xml")
>>> > public class Catalog {
>>> >
>>> > 	@GET
>>> > 	@Path("/items")
>>> > 	public List<Item> getItems() {
>>> > 		ArrayList<Item>	result	= new ArrayList<Item>();
>>> > 		result.add(new Item());
>>> > 		return (result);
>>> > 	}
>>> >
>>> > 	public static class Item {
>>> > 		private String	title;
>>> > 		private String  description;
>>> >
>>> > 		public String getTitle() { return title; }
>>> > 		public String getDescription() { return description; }
>>> >
>>> > 		public void setTitle(String title) { this.title = title;
>>> > }
>>> > 		public void setDescription(String description) {
>>> > this.description = description; }
>>> > 	}
>>> > }
>>> > ----------------------------
>>> >
>>> >
>>> 
>>> --
>>> View this message in context: http://www.nabble.com/getting-
>>> %22NO_RESOURCES_AVAILABLE%22-from-
>>> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>>> tp25120790p25123056.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/getting-%22NO_RESOURCES_AVAILABLE%22-from-%22AbstractJAXRSFactoryBean.checkResources%28%29%22-tp25120790p25132847.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <sb...@progress.com>.
I've run some existing tests. Even though CXF does instantiate a bean in this case it will still be replaced by the bean injected by 
Spring. So basically in your case Catalog is instantiated twice - unless its constructor does some intilaization wilt sideffects 
then no harm will be done. Pretty much the same is happening when cglib proxifes beans.
To avoid it you'd need to create an interface (say Catalog), describe it in the model, and then inject the actual interface 
implementation (for ex CatalogImpl)

Now, if you do not need to inject some additional properties into Catalog then simply remove jaxrs:serviceBeans sections 
alltogether, including the Catalog bean declaration.

cheers, Sergey


> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozk@progress.com]
> Sent: Wednesday, August 26, 2009 7:51 AM
> To: users@cxf.apache.org
> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
>
> Actually, you may not even need to move the behaviours to the
> interface, unless Spring proxifies a bean (with AOP, etc).
> The model is applied to Spring-injected beans too, the runtime will
> only attempt to create an instance of the class described in the
> model if no beans matching/implementing a given class/interface have
> already been injected....

I could use some clarification of this last point.  Assuming the
following Spring context:
---------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:jaxrs="http://cxf.apache.org/jaxrs"
    xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemascore.xsd">

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <import
resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />

    <jaxrs:server name="restcatalogserver" address="/rest">
        <jaxrs:features>
            <cxf:logging/>
        </jaxrs:features>
        <jaxrs:model>
            <jaxrs:resource name="com.att.ecom.catalog.Catalog"
path="/catalog/">
                <jaxrs:operation name="getItem" verb="GET"
path="/item/{id}">
                    <jaxrs:param name="id" type="PATH"/>
                </jaxrs:operation>
            </jaxrs:resource>
        </jaxrs:model>
        <jaxrs:serviceBeans>
            <ref bean="catalog"/>
        </jaxrs:serviceBeans>
    </jaxrs:server>

    <bean id="catalog" class="com.att.ecom.catalog.Catalog"/>
</beans>
---------------------

So are you saying that the "name" attribute of "jaxrs:resource" is
searched through all existing bean instances for a matching class, and
if one is found, it won't create an additional instance?  That seems
odd.

I only propose that because I don't believe it, and I think I can
demonstrate it, although I could easily be misunderstanding something.
In particular, with this context, how many times would you expect the
"Catalog" constructor to be called?  Assuming your description, I would
say once.  However, when I set a breakpoint in the constructor, I hit it
twice.  One of the stack traces shows it's just Spring creating it, and
the other stack trace shows that it's CXF creating it.

>
> cheers, Sergey
>
> ----- Original Message -----
> From: "Sergey Beryozkin" <sb...@progress.com>
> To: <us...@cxf.apache.org>
> Sent: Wednesday, August 26, 2009 3:34 PM
> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
>
>
> > This is where moving the methods to be handled by JAXRS into a
> seperate interfaces comes handly.
> > So if Catalog were an interface and say CatalogImpl were the
> implementation then you'd describe Catalog in the user model (as
> > suggested in the prev email) but in Spring you'd declare a
> CatalogImpl service bean and inject properties or even proxify it as
> > needed.
> >
> > Give it a try please. The DOSGi demo I linked to describes the
> interface only (GreeterService2) in its user model but the OSGI
> > Activator registers an interface implementation object
> >
> > cheers, Sergey
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Wednesday, August 26, 2009 2:21 AM
> >> To: users@cxf.apache.org
> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >>
> >> Hi
> >>
> >> This is a good news...
> >> Here's some more information on how to apply this feature. I'll
need
> > to
> >> document it better - have added a task item...For, given the
Catalog
> >> class
> >> mentioned in this thread the following model can be created :
> >
> > This is very good information.
> >
> > One question, though.  The way you specify the class to instantiate
> is
> > different from typical Spring beans.  It appears there's no way to
> > specify a Spring bean as a resource.  As a result, it appears that
> > there's no way to inject instance variable values into the resource,
> for
> > configuration control, for instance.  It's odd that the attribute is
> > "name", instead of "class".
> >
> > This is odd, as in the same "jaxrs:server" element is the
> > "jaxrs:serviceBeans" element, where you specify the list of beans
> that
> > represent services.
> >
> > So, I assume there's some clarity here somewhere that I haven't seen
> > yet.
> >
> >>
> >> <model>
> >> <resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
> >> <operation name="getItems" verb="GET" path="/items"/>
> >> </resource>
> >> </model>
> >>
> >> The schema for 'model' is here :
> >>
> >
>
http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/re
> >> sources/schemas/jaxrs.xsd
> >>
> >> it is limiting a bit, specifically, parameter types should be
> >> capitalized at
> >> the moment and there's no a proper enum definition for parameter
> > types.
> >> For
> >> ex, 'PATH', 'QUERY', 'MATRIX', 'HEADER' is what should be used when
> >> describing parameters that would otherwise be annotated with
> >> @PathParam,
> >> @QueryParam, @MatrixParam, @HeaderParam. There's no need to
describe
> >> input
> >> parameters which are mapped to request bodies. Response parameters
> are
> >> not
> >> described too.
> >>
> >> 'resource' represents a resource class. It can describe either a
> root
> >> resource or a subresource one.
> >> For ex, if you have
> >>
> >> @Path("catalog")
> >> public class Catalog {
> >>
> >>   @GET
> >>   @Path("items")
> >>   public List<Item> getItems() {...}
> >>
> >>   @Path("items/{id}")
> >>   public Item getItemName(@PathParam("id") Long id) {...}
> >>
> >> }
> >>
> >> where getItemName is a subresource locator and Item class has a
> method
> >> like
> >>
> >> public class Item {
> >> @GET
> >> public String getName() {...}
> >> }
> >>
> >> then, if we remove annotations, the same can be described like this
> :
> >>
> >> <model>
> >>
> >> <resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
> >> <operation name="getItems" verb="GET" path="/items"/>
> >> <operation name="getItemName" path="/item/{id}">
> >>
> >> </operation>
> >> </operation>
> >> </resource>
> >>
> >> <resource name="com.att.ecom.catalog.Item">
> >> <operation name="getName" verb="GET"/>
> >> </operation>
> >> </resource>
> >>
> >> </model>
> >>
> >> The resource with name "com.att.ecom.catalog.Item" is recognized as
> a
> >> subresource because when it introspects
> >> com.att.ecom.catalog.Catalog#getItemName it finds that its return
> >> type's
> >> name matches '"com.att.ecom.catalog.Item".
> >> So it's a flat structure but perhaps I'll support embedding
> resources
> >> too,
> >> similar to the way it's done in WADL. At the moment the only place
> >> where
> >> this feature is demoed is in a 'greeter_rest' demo in a DOSGi
> >> distribution[1] where IMHO this feature can be very handy indeed
but
> I
> >> do
> >> want to allocate more time on it and document and enhance it
> properly.
> >>
> >> Sergey
> >>
> >> [1]
> >>
> http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/greeter_rest/
> >>
> >>
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> >> -----Original Message-----
> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> Sent: Tuesday, August 25, 2009 1:02 PM
> >> >> To: users@cxf.apache.org
> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >>
> >> >> As the last resort/workaround, while you're investigating and
> just
> >> to
> >> >> keep
> >> >> you going, you might want to try this feature :
> >> >> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-
> >> >> RESTfulserviceswithoutannotations
> >> >>
> >> >> You can describe how Catalog should be treated by the JAX-RS
> > runtime
> >> >> without
> >> >> applying annotations and then register that description from
> spring
> >> >
> >> > I've gotten this to work (config in Spring, not annotations), so
> > I'll
> >> at
> >> > least be able to move forward a bit.
> >> >
> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> Sent: Tuesday, August 25, 2009 10:06 AM
> >> >> >> To: users@cxf.apache.org
> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >>
> >> >> >>
> >> >> >> is it OSGi that is getting in the way ? Are you using OSGI by
> > any
> >> >> >> chance ?
> >> >> >> That is the only reason I can think of...
> >> >> >
> >> >> > The prototype is embedded along with a lot of other code that
> is
> >> >> > assembled into an EAR with the ATG Dynamo framework.  I'm
> pretty
> >> > sure
> >> >> > they're not using OSGi, but the EAR assembly is relatively
> >> complex.
> >> >> I'm
> >> >> > not sure what they could be doing that could possibly mess
this
> >> up.
> >> >> >
> >> >> >> If yes then importing javax.ws.rs.* should fix it....
> >> >> >
> >> >> > I assume you mean in the Catalog class?  I'll try it.
> >> >> >
> >> >> >> Is it also possible for you to create a simple test project
> > where
> >> >> you
> >> >> >> will
> >> >> >> load catalog class and try to get the @Path annotation on a
> >> >> >> Catalog.getItems() method, without even CXF being involved ?
> >> >> >
> >> >> > I'll put that on the list of things to try, but I would be
> >> extremely
> >> >> > surprised if that displayed any problem.  It's likely
something
> >> > about
> >> >> my
> >> >> > deployment environment that is causing this.
> >> >> >
> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >
> >> >> >> >> -----Original Message-----
> >> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> Sent: Tuesday, August 25, 2009 7:18 AM
> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Please add breakpoints to
> >> >> >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> >> >> >> >> its
> >> >> >> >> two setServiceBeans(...) methods.
> >> > JAXRSServerFactoryBean.create()
> >> >> > is
> >> >> >> >> called
> >> >> >> >> after one of those methods has been called.
> >> >> >> >
> >> >> >> > It hit "setServiceBeans(Object... beans)" with my one
> Catalog
> >> >> > object.
> >> >> >> >
> >> >> >> > In "getCreatedFromModel(Class<?> realClass)", I noted that
> >> >> >> > "classResourceInfos" was an empty list, so it returned
null.
> >> > That
> >> >> >> could
> >> >> >> > be irrelevant.
> >> >> >> >
> >> >> >> > Then, in "evaluateResourceClass(ClassResourceInfo cri,
> boolean
> >> >> >> > enableStatic)", I saw that when it was processing the
> > "getItem"
> >> >> >> method,
> >> >> >> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)"
> returned
> >> >> null,
> >> >> >> so
> >> >> >> > it didn't create any class resource info.  It also returned
> >> null
> >> >> > from
> >> >> >> > "AnnotationUtils.getMethodAnnotation(annotatedMethod,
> >> >> Path.class)".
> >> >> >> The
> >> >> >> > "getItem()" method has both the "@GET" and "@Path"
> annotation.
> >> >> >> >
> >> >> >> > Why doesn't it think there are any annotations?
> >> >> >> >
> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >
> >> >> >> >> >> -----Original Message-----
> >> >> >> >> >> From: Sergey Beryozkin
> [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
> >> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> I've tried this class & beans.xml in the system tests
> > area,
> >> >> >> Catalog
> >> >> >> >> >> class was
> >> >> >> >> >> recognized.
> >> >> >> >> >>
> >> >> >> >> >> Can you please let me know a bit more about the way you
> >> load
> >> >> the
> >> >> >> >> >> (catalog)
> >> >> >> >> >> application ?
> >> >> >> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or
> is
> >> it
> >> >> a
> >> >> >> >> >> standalone
> >> >> >> >> >> server which explicitly loads the beans.xml ?
> >> >> >> >> >
> >> >> >> >> > I build the application with Ant.  It's deployed to
> > WebLogic
> >> >> 10.
> >> >> >> >> >
> >> >> >> >> > Can you point me to some classes or methods that I could
> > set
> >> >> >> >> breakpoints
> >> >> >> >> > in to try to diagnose why it's not processing the
Catalog
> >> >> class?
> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> thanks, Sergey
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >> >
> >> >> >> >> >> >> -----Original Message-----
> >> >> >> >> >> >> From: Sergey Beryozkin
> >> [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
> >> >> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> Hi
> >> >> >> >> >> >>
> >> >> >> >> >> >> Everything seems to be ok.
> >> >> >> >> >> >> It appears the problem is to do with a missing
import
> :
> >> >> >> >> >> >>
> >> >> >> >> >> >> <import resource="classpath:META-INF/cxf/cxf-
> extension-
> >> >> jaxrs-
> >> >> >> >> >> >> binding.xml" />
> >> >> >> >> >> >>
> >> >> >> >> >> >> can you add it please to your beans.xml ?
> >> >> >> >> >> >>
> >> >> >> >> >> >> For some reasons Catalog class is not introspected.
> >> > Perhaps
> >> >> >> due
> >> >> >> >> to
> >> >> >> >> >> the
> >> >> >> >> >> >> fact
> >> >> >> >> >> >> the above import is missing and thus no jaxrs-aware
> >> spring
> >> >> >> >> factory
> >> >> >> >> >> is
> >> >> >> >> >> >> invoked
> >> >> >> >> >> >
> >> >> >> >> >> > Nope, I'm afraid that didn't help.
> >> >> >> >> >> >
> >> >> >> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar,
> jaxb-
> >> api-
> >> >> >> >> 2.1.jar,
> >> >> >> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >> >> >> >> >> >
> >> >> >> >> >> > My current XML and Java are this:
> >> >> >> >> >> > -----beans.xml------
> >> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> >> > <beans
> >> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >> >
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> >> > xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
> >> >> >> >> >> > xsi:schemaLocation="
> >> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >> >
> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> >> http://cxf.apache.org/schemas/jaxrs.xsd
> >> >> >> >> >> > http://cxf.apache.org/core
> >> >> >> > http://cxf.apache.org/schemascore.xsd">
> >> >> >> >> >> >
> >> >> >> >> >> > <import
> > resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> >> > <import resource="classpath:META-INF/cxf/cxf-
> >> extension-
> >> >> >> soap.xml"
> >> >> >> >> >> > />
> >> >> >> >> >> > <import
> >> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> >> />
> >> >> >> >> >> >     <import
> >> >> >> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> >> >> binding.xml"
> >> >> >> >> />
> >> >> >> >> >> >
> >> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> >> address="/rest">
> >> >> >> >> >> >         <jaxrs:features>
> >> >> >> >> >> >             <cxf:logging/>
> >> >> >> >> >> >         </jaxrs:features>
> >> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >> >             <bean
> class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> >> > </beans>
> >> >> >> >> >> > -------------------------
> >> >> >> >> >> > -----Catalog.java-----
> >> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> >> > import java.util.List;
> >> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> >> > import javax.ws.rs.PathParam;
> >> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> >> > import javax.xml.bind.annotation.XmlRootElement;
> >> >> >> >> >> >
> >> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> >> > public class Catalog {
> >> >> >> >> >> > @GET
> >> >> >> >> >> > @Path("/item/{id}")
> >> >> >> >> >> > public Item getItem(@PathParam("id") String id)
> > {
> >> >> >> >> >> > Item item = new Item();
> >> >> >> >> >> > item.setId(id);
> >> >> >> >> >> > item.setTitle("abc");
> >> >> >> >> >> > item.setDescription("def");
> >> >> >> >> >> > return new Item();
> >> >> >> >> >> > }
> >> >> >> >> >> > @XmlRootElement(name = "Item")
> >> >> >> >> >> > public static class Item {
> >> >> >> >> >> > private String id;
> >> >> >> >> >> > private String title;
> >> >> >> >> >> > private String  description;
> >> >> >> >> >> >
> >> >> >> >> >> > public String getTitle() { return title;
> > }
> >> >> >> >> >> > public String getId() { return id; }
> >> >> >> >> >> > public String getDescription() { return
> >> >> > description;
> >> >> >> }
> >> >> >> >> >> >
> >> >> >> >> >> > public void setTitle(String title) {
> > this.title
> >> >> > =
> >> >> >> title;
> >> >> >> >> >> > }
> >> >> >> >> >> > public void setId(String id) { this.id =
> > id; }
> >> >> >> >> >> > public void setDescription(String
> > description)
> >> {
> >> >> >> >> >> > this.description = description; }
> >> >> >> >> >> > }
> >> >> >> >> >> > }
> >> >> >> >> >> > --------------------
> >> >> >> >> >> >
> >> >> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > I'm trying to set up a simple REST prototype
> running
> >> >> >> alongside
> >> >> >> >> >> some
> >> >> >> >> >> >> > other existing code.
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > When I deploy, I appear to fall into the following
> >> "if"
> >> >> >> block
> >> >> >> >> in
> >> >> >> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > -----------------
> >> >> >> >> >> >> >         if (list.size() == 0) {
> >> >> >> >> >> >> >             org.apache.cxf.common.i18n.Message msg
> =
> >> >> >> >> >> >> >                 new
> >> >> >> >> >> >> >
> >> >> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >> >> >> >> >> >
> >> >> >> > BUNDLE);
> >> >> >> >> >> >> >             LOG.severe(msg.toString());
> >> >> >> >> >> >> >             throw new
> >> >> >> >> >> >> >
WebApplicationException(Response.Status.NOT_FOUND);
> >> >> >> >> >> >> >         }
> >> >> >> >> >> >> > ---------------
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > This list would be empty if
> >> >> >> >> >> >> "serviceFactory.getRealClassResourceInfo()"
> >> >> >> >> >> >> > returned an empty list.  What exactly would that
> >> >> indicate?
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > My beans.xml is very simple right now, just:
> >> >> >> >> >> >> > -----------------------
> >> >> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> >> >> > <beans
> >> >> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >> >> >
> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> >> >> > xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> >> >> > xsi:schemaLocation="
> >> >> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >> >> >
> >> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > <import
> >> > resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> >> >> > <import resource="classpath:META-INF/cxf/cxf-
> >> >> extension-
> >> >> >> >> soap.xml"
> >> >> >> >> >> >> > />
> >> >> >> >> >> >> > <import
> >> >> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> >> >> />
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> >> >> address="/rest">
> >> >> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >> >> >             <bean
> >> class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> >> >> > </beans>
> >> >> >> >> >> >> > --------------------
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > The "Catalog" class is also very primitive so far:
> >> >> >> >> >> >> > --------------------------
> >> >> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> >> >> > import java.util.List;
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> >> >> > public class Catalog {
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > @GET
> >> >> >> >> >> >> > @Path("/items")
> >> >> >> >> >> >> > public List<Item> getItems() {
> >> >> >> >> >> >> > ArrayList<Item> result = new
> >> >> >> >> ArrayList<Item>();
> >> >> >> >> >> >> > result.add(new Item());
> >> >> >> >> >> >> > return (result);
> >> >> >> >> >> >> > }
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > public static class Item {
> >> >> >> >> >> >> > private String title;
> >> >> >> >> >> >> > private String  description;
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > public String getTitle() { return title;
> >> > }
> >> >> >> >> >> >> > public String getDescription() { return
> >> >> >> > description;
> >> >> >> >> }
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > public void setTitle(String title) {
> >> > this.title
> >> >> >> > =
> >> >> >> >> title;
> >> >> >> >> >> >> > }
> >> >> >> >> >> >> > public void setDescription(String
> >> > description)
> >> >> {
> >> >> >> >> >> >> > this.description = description; }
> >> >> >> >> >> >> > }
> >> >> >> >> >> >> > }
> >> >> >> >> >> >> > ----------------------------
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >>
> >> >> >> >> >> >> --
> >> >> >> >> >> >> View this message in context:
> >> >> http://www.nabble.com/getting-
> >> >> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> >> >> tp25120790p25123056.html
> >> >> >> >> >> >> Sent from the cxf-user mailing list archive at
> >> Nabble.com.
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> --
> >> >> >> >> >> View this message in context:
> >> http://www.nabble.com/getting-
> >> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> >> tp25120790p25132223.html
> >> >> >> >> >> Sent from the cxf-user mailing list archive at
> Nabble.com.
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> http://www.nabble.com/getting-
> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> tp25120790p25135192.html
> >> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> tp25120790p25138372.html
> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> tp25120790p25141130.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25149335.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sberyozk@progress.com]
> Sent: Wednesday, August 26, 2009 7:51 AM
> To: users@cxf.apache.org
> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> Actually, you may not even need to move the behaviours to the
> interface, unless Spring proxifies a bean (with AOP, etc).
> The model is applied to Spring-injected beans too, the runtime will
> only attempt to create an instance of the class described in the
> model if no beans matching/implementing a given class/interface have
> already been injected....

I could use some clarification of this last point.  Assuming the
following Spring context:
---------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:jaxrs="http://cxf.apache.org/jaxrs"
    xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemascore.xsd">

	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
/>
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <import
resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
    
    <jaxrs:server name="restcatalogserver" address="/rest">
        <jaxrs:features>
            <cxf:logging/>
        </jaxrs:features>
        <jaxrs:model>
            <jaxrs:resource name="com.att.ecom.catalog.Catalog"
path="/catalog/">
                <jaxrs:operation name="getItem" verb="GET"
path="/item/{id}">
                    <jaxrs:param name="id" type="PATH"/>
                </jaxrs:operation>
            </jaxrs:resource>
        </jaxrs:model>
        <jaxrs:serviceBeans>
            <ref bean="catalog"/>
        </jaxrs:serviceBeans>
    </jaxrs:server>
     
    <bean id="catalog" class="com.att.ecom.catalog.Catalog"/>
</beans>
---------------------

So are you saying that the "name" attribute of "jaxrs:resource" is
searched through all existing bean instances for a matching class, and
if one is found, it won't create an additional instance?  That seems
odd.

I only propose that because I don't believe it, and I think I can
demonstrate it, although I could easily be misunderstanding something.
In particular, with this context, how many times would you expect the
"Catalog" constructor to be called?  Assuming your description, I would
say once.  However, when I set a breakpoint in the constructor, I hit it
twice.  One of the stack traces shows it's just Spring creating it, and
the other stack trace shows that it's CXF creating it.

> 
> cheers, Sergey
> 
> ----- Original Message -----
> From: "Sergey Beryozkin" <sb...@progress.com>
> To: <us...@cxf.apache.org>
> Sent: Wednesday, August 26, 2009 3:34 PM
> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> 
> > This is where moving the methods to be handled by JAXRS into a
> seperate interfaces comes handly.
> > So if Catalog were an interface and say CatalogImpl were the
> implementation then you'd describe Catalog in the user model (as
> > suggested in the prev email) but in Spring you'd declare a
> CatalogImpl service bean and inject properties or even proxify it as
> > needed.
> >
> > Give it a try please. The DOSGi demo I linked to describes the
> interface only (GreeterService2) in its user model but the OSGI
> > Activator registers an interface implementation object
> >
> > cheers, Sergey
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Wednesday, August 26, 2009 2:21 AM
> >> To: users@cxf.apache.org
> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >>
> >> Hi
> >>
> >> This is a good news...
> >> Here's some more information on how to apply this feature. I'll
need
> > to
> >> document it better - have added a task item...For, given the
Catalog
> >> class
> >> mentioned in this thread the following model can be created :
> >
> > This is very good information.
> >
> > One question, though.  The way you specify the class to instantiate
> is
> > different from typical Spring beans.  It appears there's no way to
> > specify a Spring bean as a resource.  As a result, it appears that
> > there's no way to inject instance variable values into the resource,
> for
> > configuration control, for instance.  It's odd that the attribute is
> > "name", instead of "class".
> >
> > This is odd, as in the same "jaxrs:server" element is the
> > "jaxrs:serviceBeans" element, where you specify the list of beans
> that
> > represent services.
> >
> > So, I assume there's some clarity here somewhere that I haven't seen
> > yet.
> >
> >>
> >> <model>
> >> <resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
> >> <operation name="getItems" verb="GET" path="/items"/>
> >> </resource>
> >> </model>
> >>
> >> The schema for 'model' is here :
> >>
> >
>
http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/re
> >> sources/schemas/jaxrs.xsd
> >>
> >> it is limiting a bit, specifically, parameter types should be
> >> capitalized at
> >> the moment and there's no a proper enum definition for parameter
> > types.
> >> For
> >> ex, 'PATH', 'QUERY', 'MATRIX', 'HEADER' is what should be used when
> >> describing parameters that would otherwise be annotated with
> >> @PathParam,
> >> @QueryParam, @MatrixParam, @HeaderParam. There's no need to
describe
> >> input
> >> parameters which are mapped to request bodies. Response parameters
> are
> >> not
> >> described too.
> >>
> >> 'resource' represents a resource class. It can describe either a
> root
> >> resource or a subresource one.
> >> For ex, if you have
> >>
> >> @Path("catalog")
> >> public class Catalog {
> >>
> >>   @GET
> >>   @Path("items")
> >>   public List<Item> getItems() {...}
> >>
> >>   @Path("items/{id}")
> >>   public Item getItemName(@PathParam("id") Long id) {...}
> >>
> >> }
> >>
> >> where getItemName is a subresource locator and Item class has a
> method
> >> like
> >>
> >> public class Item {
> >> @GET
> >> public String getName() {...}
> >> }
> >>
> >> then, if we remove annotations, the same can be described like this
> :
> >>
> >> <model>
> >>
> >> <resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
> >> <operation name="getItems" verb="GET" path="/items"/>
> >> <operation name="getItemName" path="/item/{id}">
> >>
> >> </operation>
> >> </operation>
> >> </resource>
> >>
> >> <resource name="com.att.ecom.catalog.Item">
> >> <operation name="getName" verb="GET"/>
> >> </operation>
> >> </resource>
> >>
> >> </model>
> >>
> >> The resource with name "com.att.ecom.catalog.Item" is recognized as
> a
> >> subresource because when it introspects
> >> com.att.ecom.catalog.Catalog#getItemName it finds that its return
> >> type's
> >> name matches '"com.att.ecom.catalog.Item".
> >> So it's a flat structure but perhaps I'll support embedding
> resources
> >> too,
> >> similar to the way it's done in WADL. At the moment the only place
> >> where
> >> this feature is demoed is in a 'greeter_rest' demo in a DOSGi
> >> distribution[1] where IMHO this feature can be very handy indeed
but
> I
> >> do
> >> want to allocate more time on it and document and enhance it
> properly.
> >>
> >> Sergey
> >>
> >> [1]
> >>
> http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/greeter_rest/
> >>
> >>
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> >> -----Original Message-----
> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> Sent: Tuesday, August 25, 2009 1:02 PM
> >> >> To: users@cxf.apache.org
> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >>
> >> >> As the last resort/workaround, while you're investigating and
> just
> >> to
> >> >> keep
> >> >> you going, you might want to try this feature :
> >> >> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-
> >> >> RESTfulserviceswithoutannotations
> >> >>
> >> >> You can describe how Catalog should be treated by the JAX-RS
> > runtime
> >> >> without
> >> >> applying annotations and then register that description from
> spring
> >> >
> >> > I've gotten this to work (config in Spring, not annotations), so
> > I'll
> >> at
> >> > least be able to move forward a bit.
> >> >
> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> Sent: Tuesday, August 25, 2009 10:06 AM
> >> >> >> To: users@cxf.apache.org
> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >>
> >> >> >>
> >> >> >> is it OSGi that is getting in the way ? Are you using OSGI by
> > any
> >> >> >> chance ?
> >> >> >> That is the only reason I can think of...
> >> >> >
> >> >> > The prototype is embedded along with a lot of other code that
> is
> >> >> > assembled into an EAR with the ATG Dynamo framework.  I'm
> pretty
> >> > sure
> >> >> > they're not using OSGi, but the EAR assembly is relatively
> >> complex.
> >> >> I'm
> >> >> > not sure what they could be doing that could possibly mess
this
> >> up.
> >> >> >
> >> >> >> If yes then importing javax.ws.rs.* should fix it....
> >> >> >
> >> >> > I assume you mean in the Catalog class?  I'll try it.
> >> >> >
> >> >> >> Is it also possible for you to create a simple test project
> > where
> >> >> you
> >> >> >> will
> >> >> >> load catalog class and try to get the @Path annotation on a
> >> >> >> Catalog.getItems() method, without even CXF being involved ?
> >> >> >
> >> >> > I'll put that on the list of things to try, but I would be
> >> extremely
> >> >> > surprised if that displayed any problem.  It's likely
something
> >> > about
> >> >> my
> >> >> > deployment environment that is causing this.
> >> >> >
> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >
> >> >> >> >> -----Original Message-----
> >> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> Sent: Tuesday, August 25, 2009 7:18 AM
> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Please add breakpoints to
> >> >> >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> >> >> >> >> its
> >> >> >> >> two setServiceBeans(...) methods.
> >> > JAXRSServerFactoryBean.create()
> >> >> > is
> >> >> >> >> called
> >> >> >> >> after one of those methods has been called.
> >> >> >> >
> >> >> >> > It hit "setServiceBeans(Object... beans)" with my one
> Catalog
> >> >> > object.
> >> >> >> >
> >> >> >> > In "getCreatedFromModel(Class<?> realClass)", I noted that
> >> >> >> > "classResourceInfos" was an empty list, so it returned
null.
> >> > That
> >> >> >> could
> >> >> >> > be irrelevant.
> >> >> >> >
> >> >> >> > Then, in "evaluateResourceClass(ClassResourceInfo cri,
> boolean
> >> >> >> > enableStatic)", I saw that when it was processing the
> > "getItem"
> >> >> >> method,
> >> >> >> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)"
> returned
> >> >> null,
> >> >> >> so
> >> >> >> > it didn't create any class resource info.  It also returned
> >> null
> >> >> > from
> >> >> >> > "AnnotationUtils.getMethodAnnotation(annotatedMethod,
> >> >> Path.class)".
> >> >> >> The
> >> >> >> > "getItem()" method has both the "@GET" and "@Path"
> annotation.
> >> >> >> >
> >> >> >> > Why doesn't it think there are any annotations?
> >> >> >> >
> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >
> >> >> >> >> >> -----Original Message-----
> >> >> >> >> >> From: Sergey Beryozkin
> [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
> >> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> I've tried this class & beans.xml in the system tests
> > area,
> >> >> >> Catalog
> >> >> >> >> >> class was
> >> >> >> >> >> recognized.
> >> >> >> >> >>
> >> >> >> >> >> Can you please let me know a bit more about the way you
> >> load
> >> >> the
> >> >> >> >> >> (catalog)
> >> >> >> >> >> application ?
> >> >> >> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or
> is
> >> it
> >> >> a
> >> >> >> >> >> standalone
> >> >> >> >> >> server which explicitly loads the beans.xml ?
> >> >> >> >> >
> >> >> >> >> > I build the application with Ant.  It's deployed to
> > WebLogic
> >> >> 10.
> >> >> >> >> >
> >> >> >> >> > Can you point me to some classes or methods that I could
> > set
> >> >> >> >> breakpoints
> >> >> >> >> > in to try to diagnose why it's not processing the
Catalog
> >> >> class?
> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> thanks, Sergey
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >> >
> >> >> >> >> >> >> -----Original Message-----
> >> >> >> >> >> >> From: Sergey Beryozkin
> >> [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
> >> >> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> Hi
> >> >> >> >> >> >>
> >> >> >> >> >> >> Everything seems to be ok.
> >> >> >> >> >> >> It appears the problem is to do with a missing
import
> :
> >> >> >> >> >> >>
> >> >> >> >> >> >> <import resource="classpath:META-INF/cxf/cxf-
> extension-
> >> >> jaxrs-
> >> >> >> >> >> >> binding.xml" />
> >> >> >> >> >> >>
> >> >> >> >> >> >> can you add it please to your beans.xml ?
> >> >> >> >> >> >>
> >> >> >> >> >> >> For some reasons Catalog class is not introspected.
> >> > Perhaps
> >> >> >> due
> >> >> >> >> to
> >> >> >> >> >> the
> >> >> >> >> >> >> fact
> >> >> >> >> >> >> the above import is missing and thus no jaxrs-aware
> >> spring
> >> >> >> >> factory
> >> >> >> >> >> is
> >> >> >> >> >> >> invoked
> >> >> >> >> >> >
> >> >> >> >> >> > Nope, I'm afraid that didn't help.
> >> >> >> >> >> >
> >> >> >> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar,
> jaxb-
> >> api-
> >> >> >> >> 2.1.jar,
> >> >> >> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >> >> >> >> >> >
> >> >> >> >> >> > My current XML and Java are this:
> >> >> >> >> >> > -----beans.xml------
> >> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> >> > <beans
> >> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >> >
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> >> > xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
> >> >> >> >> >> > xsi:schemaLocation="
> >> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >> >
> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> >> http://cxf.apache.org/schemas/jaxrs.xsd
> >> >> >> >> >> > http://cxf.apache.org/core
> >> >> >> > http://cxf.apache.org/schemascore.xsd">
> >> >> >> >> >> >
> >> >> >> >> >> > <import
> > resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> >> > <import resource="classpath:META-INF/cxf/cxf-
> >> extension-
> >> >> >> soap.xml"
> >> >> >> >> >> > />
> >> >> >> >> >> > <import
> >> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> >> />
> >> >> >> >> >> >     <import
> >> >> >> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> >> >> binding.xml"
> >> >> >> >> />
> >> >> >> >> >> >
> >> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> >> address="/rest">
> >> >> >> >> >> >         <jaxrs:features>
> >> >> >> >> >> >             <cxf:logging/>
> >> >> >> >> >> >         </jaxrs:features>
> >> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >> >             <bean
> class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> >> > </beans>
> >> >> >> >> >> > -------------------------
> >> >> >> >> >> > -----Catalog.java-----
> >> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> >> > import java.util.List;
> >> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> >> > import javax.ws.rs.PathParam;
> >> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> >> > import javax.xml.bind.annotation.XmlRootElement;
> >> >> >> >> >> >
> >> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> >> > public class Catalog {
> >> >> >> >> >> > @GET
> >> >> >> >> >> > @Path("/item/{id}")
> >> >> >> >> >> > public Item getItem(@PathParam("id") String id)
> > {
> >> >> >> >> >> > Item item = new Item();
> >> >> >> >> >> > item.setId(id);
> >> >> >> >> >> > item.setTitle("abc");
> >> >> >> >> >> > item.setDescription("def");
> >> >> >> >> >> > return new Item();
> >> >> >> >> >> > }
> >> >> >> >> >> > @XmlRootElement(name = "Item")
> >> >> >> >> >> > public static class Item {
> >> >> >> >> >> > private String id;
> >> >> >> >> >> > private String title;
> >> >> >> >> >> > private String  description;
> >> >> >> >> >> >
> >> >> >> >> >> > public String getTitle() { return title;
> > }
> >> >> >> >> >> > public String getId() { return id; }
> >> >> >> >> >> > public String getDescription() { return
> >> >> > description;
> >> >> >> }
> >> >> >> >> >> >
> >> >> >> >> >> > public void setTitle(String title) {
> > this.title
> >> >> > =
> >> >> >> title;
> >> >> >> >> >> > }
> >> >> >> >> >> > public void setId(String id) { this.id =
> > id; }
> >> >> >> >> >> > public void setDescription(String
> > description)
> >> {
> >> >> >> >> >> > this.description = description; }
> >> >> >> >> >> > }
> >> >> >> >> >> > }
> >> >> >> >> >> > --------------------
> >> >> >> >> >> >
> >> >> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > I'm trying to set up a simple REST prototype
> running
> >> >> >> alongside
> >> >> >> >> >> some
> >> >> >> >> >> >> > other existing code.
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > When I deploy, I appear to fall into the following
> >> "if"
> >> >> >> block
> >> >> >> >> in
> >> >> >> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > -----------------
> >> >> >> >> >> >> >         if (list.size() == 0) {
> >> >> >> >> >> >> >             org.apache.cxf.common.i18n.Message msg
> =
> >> >> >> >> >> >> >                 new
> >> >> >> >> >> >> >
> >> >> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >> >> >> >> >> >
> >> >> >> > BUNDLE);
> >> >> >> >> >> >> >             LOG.severe(msg.toString());
> >> >> >> >> >> >> >             throw new
> >> >> >> >> >> >> >
WebApplicationException(Response.Status.NOT_FOUND);
> >> >> >> >> >> >> >         }
> >> >> >> >> >> >> > ---------------
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > This list would be empty if
> >> >> >> >> >> >> "serviceFactory.getRealClassResourceInfo()"
> >> >> >> >> >> >> > returned an empty list.  What exactly would that
> >> >> indicate?
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > My beans.xml is very simple right now, just:
> >> >> >> >> >> >> > -----------------------
> >> >> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> >> >> > <beans
> >> >> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >> >> >
> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> >> >> > xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> >> >> > xsi:schemaLocation="
> >> >> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >> >> >
> >> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > <import
> >> > resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> >> >> > <import resource="classpath:META-INF/cxf/cxf-
> >> >> extension-
> >> >> >> >> soap.xml"
> >> >> >> >> >> >> > />
> >> >> >> >> >> >> > <import
> >> >> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> >> >> />
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> >> >> address="/rest">
> >> >> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >> >> >             <bean
> >> class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> >> >> > </beans>
> >> >> >> >> >> >> > --------------------
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > The "Catalog" class is also very primitive so far:
> >> >> >> >> >> >> > --------------------------
> >> >> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> >> >> > import java.util.List;
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> >> >> > public class Catalog {
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > @GET
> >> >> >> >> >> >> > @Path("/items")
> >> >> >> >> >> >> > public List<Item> getItems() {
> >> >> >> >> >> >> > ArrayList<Item> result = new
> >> >> >> >> ArrayList<Item>();
> >> >> >> >> >> >> > result.add(new Item());
> >> >> >> >> >> >> > return (result);
> >> >> >> >> >> >> > }
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > public static class Item {
> >> >> >> >> >> >> > private String title;
> >> >> >> >> >> >> > private String  description;
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > public String getTitle() { return title;
> >> > }
> >> >> >> >> >> >> > public String getDescription() { return
> >> >> >> > description;
> >> >> >> >> }
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > public void setTitle(String title) {
> >> > this.title
> >> >> >> > =
> >> >> >> >> title;
> >> >> >> >> >> >> > }
> >> >> >> >> >> >> > public void setDescription(String
> >> > description)
> >> >> {
> >> >> >> >> >> >> > this.description = description; }
> >> >> >> >> >> >> > }
> >> >> >> >> >> >> > }
> >> >> >> >> >> >> > ----------------------------
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >>
> >> >> >> >> >> >> --
> >> >> >> >> >> >> View this message in context:
> >> >> http://www.nabble.com/getting-
> >> >> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> >> >> tp25120790p25123056.html
> >> >> >> >> >> >> Sent from the cxf-user mailing list archive at
> >> Nabble.com.
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> --
> >> >> >> >> >> View this message in context:
> >> http://www.nabble.com/getting-
> >> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> >> tp25120790p25132223.html
> >> >> >> >> >> Sent from the cxf-user mailing list archive at
> Nabble.com.
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> http://www.nabble.com/getting-
> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> tp25120790p25135192.html
> >> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> tp25120790p25138372.html
> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> tp25120790p25141130.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25149335.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >


Re: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <sb...@progress.com>.
Actually, you may not even need to move the behaviours to the interface, unless Spring proxifies a bean (with AOP, etc).
The model is applied to Spring-injected beans too, the runtime will only attempt to create an instance of the class described in the 
model if no beans matching/implementing a given class/interface have already been injected....

cheers, Sergey

----- Original Message ----- 
From: "Sergey Beryozkin" <sb...@progress.com>
To: <us...@cxf.apache.org>
Sent: Wednesday, August 26, 2009 3:34 PM
Subject: Re: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"


> This is where moving the methods to be handled by JAXRS into a seperate interfaces comes handly.
> So if Catalog were an interface and say CatalogImpl were the implementation then you'd describe Catalog in the user model (as 
> suggested in the prev email) but in Spring you'd declare a CatalogImpl service bean and inject properties or even proxify it as 
> needed.
>
> Give it a try please. The DOSGi demo I linked to describes the interface only (GreeterService2) in its user model but the OSGI 
> Activator registers an interface implementation object
>
> cheers, Sergey
>
>> -----Original Message-----
>> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> Sent: Wednesday, August 26, 2009 2:21 AM
>> To: users@cxf.apache.org
>> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> "AbstractJAXRSFactoryBean.checkResources()"
>>
>>
>> Hi
>>
>> This is a good news...
>> Here's some more information on how to apply this feature. I'll need
> to
>> document it better - have added a task item...For, given the Catalog
>> class
>> mentioned in this thread the following model can be created :
>
> This is very good information.
>
> One question, though.  The way you specify the class to instantiate is
> different from typical Spring beans.  It appears there's no way to
> specify a Spring bean as a resource.  As a result, it appears that
> there's no way to inject instance variable values into the resource, for
> configuration control, for instance.  It's odd that the attribute is
> "name", instead of "class".
>
> This is odd, as in the same "jaxrs:server" element is the
> "jaxrs:serviceBeans" element, where you specify the list of beans that
> represent services.
>
> So, I assume there's some clarity here somewhere that I haven't seen
> yet.
>
>>
>> <model>
>> <resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
>> <operation name="getItems" verb="GET" path="/items"/>
>> </resource>
>> </model>
>>
>> The schema for 'model' is here :
>>
> http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/re
>> sources/schemas/jaxrs.xsd
>>
>> it is limiting a bit, specifically, parameter types should be
>> capitalized at
>> the moment and there's no a proper enum definition for parameter
> types.
>> For
>> ex, 'PATH', 'QUERY', 'MATRIX', 'HEADER' is what should be used when
>> describing parameters that would otherwise be annotated with
>> @PathParam,
>> @QueryParam, @MatrixParam, @HeaderParam. There's no need to describe
>> input
>> parameters which are mapped to request bodies. Response parameters are
>> not
>> described too.
>>
>> 'resource' represents a resource class. It can describe either a root
>> resource or a subresource one.
>> For ex, if you have
>>
>> @Path("catalog")
>> public class Catalog {
>>
>>   @GET
>>   @Path("items")
>>   public List<Item> getItems() {...}
>>
>>   @Path("items/{id}")
>>   public Item getItemName(@PathParam("id") Long id) {...}
>>
>> }
>>
>> where getItemName is a subresource locator and Item class has a method
>> like
>>
>> public class Item {
>> @GET
>> public String getName() {...}
>> }
>>
>> then, if we remove annotations, the same can be described like this :
>>
>> <model>
>>
>> <resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
>> <operation name="getItems" verb="GET" path="/items"/>
>> <operation name="getItemName" path="/item/{id}">
>>
>> </operation>
>> </operation>
>> </resource>
>>
>> <resource name="com.att.ecom.catalog.Item">
>> <operation name="getName" verb="GET"/>
>> </operation>
>> </resource>
>>
>> </model>
>>
>> The resource with name "com.att.ecom.catalog.Item" is recognized as a
>> subresource because when it introspects
>> com.att.ecom.catalog.Catalog#getItemName it finds that its return
>> type's
>> name matches '"com.att.ecom.catalog.Item".
>> So it's a flat structure but perhaps I'll support embedding resources
>> too,
>> similar to the way it's done in WADL. At the moment the only place
>> where
>> this feature is demoed is in a 'greeter_rest' demo in a DOSGi
>> distribution[1] where IMHO this feature can be very handy indeed but I
>> do
>> want to allocate more time on it and document and enhance it properly.
>>
>> Sergey
>>
>> [1]
>> http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/greeter_rest/
>>
>>
>> KARR, DAVID (ATTCINW) wrote:
>> >
>> >> -----Original Message-----
>> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> Sent: Tuesday, August 25, 2009 1:02 PM
>> >> To: users@cxf.apache.org
>> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >>
>> >> As the last resort/workaround, while you're investigating and just
>> to
>> >> keep
>> >> you going, you might want to try this feature :
>> >> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-
>> >> RESTfulserviceswithoutannotations
>> >>
>> >> You can describe how Catalog should be treated by the JAX-RS
> runtime
>> >> without
>> >> applying annotations and then register that description from spring
>> >
>> > I've gotten this to work (config in Spring, not annotations), so
> I'll
>> at
>> > least be able to move forward a bit.
>> >
>> >> KARR, DAVID (ATTCINW) wrote:
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> >> Sent: Tuesday, August 25, 2009 10:06 AM
>> >> >> To: users@cxf.apache.org
>> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> >> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >> >>
>> >> >>
>> >> >> is it OSGi that is getting in the way ? Are you using OSGI by
> any
>> >> >> chance ?
>> >> >> That is the only reason I can think of...
>> >> >
>> >> > The prototype is embedded along with a lot of other code that is
>> >> > assembled into an EAR with the ATG Dynamo framework.  I'm pretty
>> > sure
>> >> > they're not using OSGi, but the EAR assembly is relatively
>> complex.
>> >> I'm
>> >> > not sure what they could be doing that could possibly mess this
>> up.
>> >> >
>> >> >> If yes then importing javax.ws.rs.* should fix it....
>> >> >
>> >> > I assume you mean in the Catalog class?  I'll try it.
>> >> >
>> >> >> Is it also possible for you to create a simple test project
> where
>> >> you
>> >> >> will
>> >> >> load catalog class and try to get the @Path annotation on a
>> >> >> Catalog.getItems() method, without even CXF being involved ?
>> >> >
>> >> > I'll put that on the list of things to try, but I would be
>> extremely
>> >> > surprised if that displayed any problem.  It's likely something
>> > about
>> >> my
>> >> > deployment environment that is causing this.
>> >> >
>> >> >> KARR, DAVID (ATTCINW) wrote:
>> >> >> >
>> >> >> >> -----Original Message-----
>> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> >> >> Sent: Tuesday, August 25, 2009 7:18 AM
>> >> >> >> To: users@cxf.apache.org
>> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >> >> >>
>> >> >> >>
>> >> >> >> Please add breakpoints to
>> >> >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
>> >> >> >> its
>> >> >> >> two setServiceBeans(...) methods.
>> > JAXRSServerFactoryBean.create()
>> >> > is
>> >> >> >> called
>> >> >> >> after one of those methods has been called.
>> >> >> >
>> >> >> > It hit "setServiceBeans(Object... beans)" with my one Catalog
>> >> > object.
>> >> >> >
>> >> >> > In "getCreatedFromModel(Class<?> realClass)", I noted that
>> >> >> > "classResourceInfos" was an empty list, so it returned null.
>> > That
>> >> >> could
>> >> >> > be irrelevant.
>> >> >> >
>> >> >> > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
>> >> >> > enableStatic)", I saw that when it was processing the
> "getItem"
>> >> >> method,
>> >> >> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned
>> >> null,
>> >> >> so
>> >> >> > it didn't create any class resource info.  It also returned
>> null
>> >> > from
>> >> >> > "AnnotationUtils.getMethodAnnotation(annotatedMethod,
>> >> Path.class)".
>> >> >> The
>> >> >> > "getItem()" method has both the "@GET" and "@Path" annotation.
>> >> >> >
>> >> >> > Why doesn't it think there are any annotations?
>> >> >> >
>> >> >> >> KARR, DAVID (ATTCINW) wrote:
>> >> >> >> >
>> >> >> >> >> -----Original Message-----
>> >> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> >> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
>> >> >> >> >> To: users@cxf.apache.org
>> >> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> I've tried this class & beans.xml in the system tests
> area,
>> >> >> Catalog
>> >> >> >> >> class was
>> >> >> >> >> recognized.
>> >> >> >> >>
>> >> >> >> >> Can you please let me know a bit more about the way you
>> load
>> >> the
>> >> >> >> >> (catalog)
>> >> >> >> >> application ?
>> >> >> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is
>> it
>> >> a
>> >> >> >> >> standalone
>> >> >> >> >> server which explicitly loads the beans.xml ?
>> >> >> >> >
>> >> >> >> > I build the application with Ant.  It's deployed to
> WebLogic
>> >> 10.
>> >> >> >> >
>> >> >> >> > Can you point me to some classes or methods that I could
> set
>> >> >> >> breakpoints
>> >> >> >> > in to try to diagnose why it's not processing the Catalog
>> >> class?
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> thanks, Sergey
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
>> >> >> >> >> >
>> >> >> >> >> >> -----Original Message-----
>> >> >> >> >> >> From: Sergey Beryozkin
>> [mailto:sergey.beryozkin@iona.com]
>> >> >> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
>> >> >> >> >> >> To: users@cxf.apache.org
>> >> >> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
>> >> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> Hi
>> >> >> >> >> >>
>> >> >> >> >> >> Everything seems to be ok.
>> >> >> >> >> >> It appears the problem is to do with a missing import :
>> >> >> >> >> >>
>> >> >> >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-
>> >> jaxrs-
>> >> >> >> >> >> binding.xml" />
>> >> >> >> >> >>
>> >> >> >> >> >> can you add it please to your beans.xml ?
>> >> >> >> >> >>
>> >> >> >> >> >> For some reasons Catalog class is not introspected.
>> > Perhaps
>> >> >> due
>> >> >> >> to
>> >> >> >> >> the
>> >> >> >> >> >> fact
>> >> >> >> >> >> the above import is missing and thus no jaxrs-aware
>> spring
>> >> >> >> factory
>> >> >> >> >> is
>> >> >> >> >> >> invoked
>> >> >> >> >> >
>> >> >> >> >> > Nope, I'm afraid that didn't help.
>> >> >> >> >> >
>> >> >> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-
>> api-
>> >> >> >> 2.1.jar,
>> >> >> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
>> >> >> >> >> >
>> >> >> >> >> > My current XML and Java are this:
>> >> >> >> >> > -----beans.xml------
>> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> >> >> >> > <beans
>> xmlns="http://www.springframework.org/schema/beans"
>> >> >> >> >> >
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> >> >> >> > xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> >> >> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
>> >> >> >> >> > xsi:schemaLocation="
>> >> >> >> >> > http://www.springframework.org/schema/beans
>> >> >> >> >> >
>> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> >> >> >> >> > http://cxf.apache.org/jaxws
>> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
>> >> >> >> >> > http://cxf.apache.org/jaxrs
>> >> >> >> http://cxf.apache.org/schemas/jaxrs.xsd
>> >> >> >> >> > http://cxf.apache.org/core
>> >> >> > http://cxf.apache.org/schemascore.xsd">
>> >> >> >> >> >
>> >> >> >> >> > <import
> resource="classpath:META-INF/cxf/cxf.xml" />
>> >> >> >> >> > <import resource="classpath:META-INF/cxf/cxf-
>> extension-
>> >> >> soap.xml"
>> >> >> >> >> > />
>> >> >> >> >> > <import
>> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
>> >> >> />
>> >> >> >> >> >     <import
>> >> >> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>> >> >> binding.xml"
>> >> >> >> />
>> >> >> >> >> >
>> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
>> address="/rest">
>> >> >> >> >> >         <jaxrs:features>
>> >> >> >> >> >             <cxf:logging/>
>> >> >> >> >> >         </jaxrs:features>
>> >> >> >> >> >         <jaxrs:serviceBeans>
>> >> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
>> >> >> >> >> >         </jaxrs:serviceBeans>
>> >> >> >> >> >     </jaxrs:server>
>> >> >> >> >> > </beans>
>> >> >> >> >> > -------------------------
>> >> >> >> >> > -----Catalog.java-----
>> >> >> >> >> > package com.att.ecom.catalog;
>> >> >> >> >> > import java.util.ArrayList;
>> >> >> >> >> > import java.util.List;
>> >> >> >> >> > import javax.ws.rs.GET;
>> >> >> >> >> > import javax.ws.rs.Path;
>> >> >> >> >> > import javax.ws.rs.PathParam;
>> >> >> >> >> > import javax.ws.rs.Produces;
>> >> >> >> >> > import javax.xml.bind.annotation.XmlRootElement;
>> >> >> >> >> >
>> >> >> >> >> > @Path("/catalog/")
>> >> >> >> >> > @Produces("application/xml")
>> >> >> >> >> > public class Catalog {
>> >> >> >> >> > @GET
>> >> >> >> >> > @Path("/item/{id}")
>> >> >> >> >> > public Item getItem(@PathParam("id") String id)
> {
>> >> >> >> >> > Item item = new Item();
>> >> >> >> >> > item.setId(id);
>> >> >> >> >> > item.setTitle("abc");
>> >> >> >> >> > item.setDescription("def");
>> >> >> >> >> > return new Item();
>> >> >> >> >> > }
>> >> >> >> >> > @XmlRootElement(name = "Item")
>> >> >> >> >> > public static class Item {
>> >> >> >> >> > private String id;
>> >> >> >> >> > private String title;
>> >> >> >> >> > private String  description;
>> >> >> >> >> >
>> >> >> >> >> > public String getTitle() { return title;
> }
>> >> >> >> >> > public String getId() { return id; }
>> >> >> >> >> > public String getDescription() { return
>> >> > description;
>> >> >> }
>> >> >> >> >> >
>> >> >> >> >> > public void setTitle(String title) {
> this.title
>> >> > =
>> >> >> title;
>> >> >> >> >> > }
>> >> >> >> >> > public void setId(String id) { this.id =
> id; }
>> >> >> >> >> > public void setDescription(String
> description)
>> {
>> >> >> >> >> > this.description = description; }
>> >> >> >> >> > }
>> >> >> >> >> > }
>> >> >> >> >> > --------------------
>> >> >> >> >> >
>> >> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
>> >> >> >> >> >> >
>> >> >> >> >> >> > I'm trying to set up a simple REST prototype running
>> >> >> alongside
>> >> >> >> >> some
>> >> >> >> >> >> > other existing code.
>> >> >> >> >> >> >
>> >> >> >> >> >> > When I deploy, I appear to fall into the following
>> "if"
>> >> >> block
>> >> >> >> in
>> >> >> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
>> >> >> >> >> >> >
>> >> >> >> >> >> > -----------------
>> >> >> >> >> >> >         if (list.size() == 0) {
>> >> >> >> >> >> >             org.apache.cxf.common.i18n.Message msg =
>> >> >> >> >> >> >                 new
>> >> >> >> >> >> >
>> >> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
>> >> >> >> >> >> >
>> >> >> > BUNDLE);
>> >> >> >> >> >> >             LOG.severe(msg.toString());
>> >> >> >> >> >> >             throw new
>> >> >> >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
>> >> >> >> >> >> >         }
>> >> >> >> >> >> > ---------------
>> >> >> >> >> >> >
>> >> >> >> >> >> > This list would be empty if
>> >> >> >> >> >> "serviceFactory.getRealClassResourceInfo()"
>> >> >> >> >> >> > returned an empty list.  What exactly would that
>> >> indicate?
>> >> >> >> >> >> >
>> >> >> >> >> >> > My beans.xml is very simple right now, just:
>> >> >> >> >> >> > -----------------------
>> >> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> >> >> >> >> > <beans
>> >> xmlns="http://www.springframework.org/schema/beans"
>> >> >> >> >> >> >
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> >> >> >> >> > xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> >> >> >> >> >> > xsi:schemaLocation="
>> >> >> >> >> >> > http://www.springframework.org/schema/beans
>> >> >> >> >> >> >
>> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> >> >> >> >> >> > http://cxf.apache.org/jaxws
>> >> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
>> >> >> >> >> >> > http://cxf.apache.org/jaxrs
>> >> >> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
>> >> >> >> >> >> >
>> >> >> >> >> >> > <import
>> > resource="classpath:META-INF/cxf/cxf.xml" />
>> >> >> >> >> >> > <import resource="classpath:META-INF/cxf/cxf-
>> >> extension-
>> >> >> >> soap.xml"
>> >> >> >> >> >> > />
>> >> >> >> >> >> > <import
>> >> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
>> >> >> >> />
>> >> >> >> >> >> >
>> >> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
>> >> address="/rest">
>> >> >> >> >> >> >         <jaxrs:serviceBeans>
>> >> >> >> >> >> >             <bean
>> class="com.att.ecom.catalog.Catalog"/>
>> >> >> >> >> >> >         </jaxrs:serviceBeans>
>> >> >> >> >> >> >     </jaxrs:server>
>> >> >> >> >> >> > </beans>
>> >> >> >> >> >> > --------------------
>> >> >> >> >> >> >
>> >> >> >> >> >> > The "Catalog" class is also very primitive so far:
>> >> >> >> >> >> > --------------------------
>> >> >> >> >> >> > package com.att.ecom.catalog;
>> >> >> >> >> >> >
>> >> >> >> >> >> > import java.util.ArrayList;
>> >> >> >> >> >> > import java.util.List;
>> >> >> >> >> >> >
>> >> >> >> >> >> > import javax.ws.rs.GET;
>> >> >> >> >> >> > import javax.ws.rs.Path;
>> >> >> >> >> >> > import javax.ws.rs.Produces;
>> >> >> >> >> >> >
>> >> >> >> >> >> > @Path("/catalog/")
>> >> >> >> >> >> > @Produces("application/xml")
>> >> >> >> >> >> > public class Catalog {
>> >> >> >> >> >> >
>> >> >> >> >> >> > @GET
>> >> >> >> >> >> > @Path("/items")
>> >> >> >> >> >> > public List<Item> getItems() {
>> >> >> >> >> >> > ArrayList<Item> result = new
>> >> >> >> ArrayList<Item>();
>> >> >> >> >> >> > result.add(new Item());
>> >> >> >> >> >> > return (result);
>> >> >> >> >> >> > }
>> >> >> >> >> >> >
>> >> >> >> >> >> > public static class Item {
>> >> >> >> >> >> > private String title;
>> >> >> >> >> >> > private String  description;
>> >> >> >> >> >> >
>> >> >> >> >> >> > public String getTitle() { return title;
>> > }
>> >> >> >> >> >> > public String getDescription() { return
>> >> >> > description;
>> >> >> >> }
>> >> >> >> >> >> >
>> >> >> >> >> >> > public void setTitle(String title) {
>> > this.title
>> >> >> > =
>> >> >> >> title;
>> >> >> >> >> >> > }
>> >> >> >> >> >> > public void setDescription(String
>> > description)
>> >> {
>> >> >> >> >> >> > this.description = description; }
>> >> >> >> >> >> > }
>> >> >> >> >> >> > }
>> >> >> >> >> >> > ----------------------------
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> --
>> >> >> >> >> >> View this message in context:
>> >> http://www.nabble.com/getting-
>> >> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> >> >> >> >> tp25120790p25123056.html
>> >> >> >> >> >> Sent from the cxf-user mailing list archive at
>> Nabble.com.
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> http://www.nabble.com/getting-
>> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> >> >> >> tp25120790p25132223.html
>> >> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context: http://www.nabble.com/getting-
>> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> >> >> tp25120790p25135192.html
>> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context: http://www.nabble.com/getting-
>> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> >> tp25120790p25138372.html
>> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context: http://www.nabble.com/getting-
>> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> tp25120790p25141130.html
>> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >
>> >
>> >
>>
>> --
>> View this message in context: http://www.nabble.com/getting-
>> %22NO_RESOURCES_AVAILABLE%22-from-
>> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> tp25120790p25149335.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
> 


Re: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <sb...@progress.com>.
This is where moving the methods to be handled by JAXRS into a seperate interfaces comes handly.
So if Catalog were an interface and say CatalogImpl were the implementation then you'd describe Catalog in the user model (as 
suggested in the prev email) but in Spring you'd declare a CatalogImpl service bean and inject properties or even proxify it as 
needed.

Give it a try please. The DOSGi demo I linked to describes the interface only (GreeterService2) in its user model but the OSGI 
Activator registers an interface implementation object

cheers, Sergey

> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Wednesday, August 26, 2009 2:21 AM
> To: users@cxf.apache.org
> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
>
>
> Hi
>
> This is a good news...
> Here's some more information on how to apply this feature. I'll need
to
> document it better - have added a task item...For, given the Catalog
> class
> mentioned in this thread the following model can be created :

This is very good information.

One question, though.  The way you specify the class to instantiate is
different from typical Spring beans.  It appears there's no way to
specify a Spring bean as a resource.  As a result, it appears that
there's no way to inject instance variable values into the resource, for
configuration control, for instance.  It's odd that the attribute is
"name", instead of "class".

This is odd, as in the same "jaxrs:server" element is the
"jaxrs:serviceBeans" element, where you specify the list of beans that
represent services.

So, I assume there's some clarity here somewhere that I haven't seen
yet.

>
> <model>
> <resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
> <operation name="getItems" verb="GET" path="/items"/>
> </resource>
> </model>
>
> The schema for 'model' is here :
>
http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/re
> sources/schemas/jaxrs.xsd
>
> it is limiting a bit, specifically, parameter types should be
> capitalized at
> the moment and there's no a proper enum definition for parameter
types.
> For
> ex, 'PATH', 'QUERY', 'MATRIX', 'HEADER' is what should be used when
> describing parameters that would otherwise be annotated with
> @PathParam,
> @QueryParam, @MatrixParam, @HeaderParam. There's no need to describe
> input
> parameters which are mapped to request bodies. Response parameters are
> not
> described too.
>
> 'resource' represents a resource class. It can describe either a root
> resource or a subresource one.
> For ex, if you have
>
> @Path("catalog")
> public class Catalog {
>
>   @GET
>   @Path("items")
>   public List<Item> getItems() {...}
>
>   @Path("items/{id}")
>   public Item getItemName(@PathParam("id") Long id) {...}
>
> }
>
> where getItemName is a subresource locator and Item class has a method
> like
>
> public class Item {
> @GET
> public String getName() {...}
> }
>
> then, if we remove annotations, the same can be described like this :
>
> <model>
>
> <resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
> <operation name="getItems" verb="GET" path="/items"/>
> <operation name="getItemName" path="/item/{id}">
>
> </operation>
> </operation>
> </resource>
>
> <resource name="com.att.ecom.catalog.Item">
> <operation name="getName" verb="GET"/>
> </operation>
> </resource>
>
> </model>
>
> The resource with name "com.att.ecom.catalog.Item" is recognized as a
> subresource because when it introspects
> com.att.ecom.catalog.Catalog#getItemName it finds that its return
> type's
> name matches '"com.att.ecom.catalog.Item".
> So it's a flat structure but perhaps I'll support embedding resources
> too,
> similar to the way it's done in WADL. At the moment the only place
> where
> this feature is demoed is in a 'greeter_rest' demo in a DOSGi
> distribution[1] where IMHO this feature can be very handy indeed but I
> do
> want to allocate more time on it and document and enhance it properly.
>
> Sergey
>
> [1]
> http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/greeter_rest/
>
>
> KARR, DAVID (ATTCINW) wrote:
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Tuesday, August 25, 2009 1:02 PM
> >> To: users@cxf.apache.org
> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >> As the last resort/workaround, while you're investigating and just
> to
> >> keep
> >> you going, you might want to try this feature :
> >> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-
> >> RESTfulserviceswithoutannotations
> >>
> >> You can describe how Catalog should be treated by the JAX-RS
runtime
> >> without
> >> applying annotations and then register that description from spring
> >
> > I've gotten this to work (config in Spring, not annotations), so
I'll
> at
> > least be able to move forward a bit.
> >
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> >> -----Original Message-----
> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> Sent: Tuesday, August 25, 2009 10:06 AM
> >> >> To: users@cxf.apache.org
> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >>
> >> >>
> >> >> is it OSGi that is getting in the way ? Are you using OSGI by
any
> >> >> chance ?
> >> >> That is the only reason I can think of...
> >> >
> >> > The prototype is embedded along with a lot of other code that is
> >> > assembled into an EAR with the ATG Dynamo framework.  I'm pretty
> > sure
> >> > they're not using OSGi, but the EAR assembly is relatively
> complex.
> >> I'm
> >> > not sure what they could be doing that could possibly mess this
> up.
> >> >
> >> >> If yes then importing javax.ws.rs.* should fix it....
> >> >
> >> > I assume you mean in the Catalog class?  I'll try it.
> >> >
> >> >> Is it also possible for you to create a simple test project
where
> >> you
> >> >> will
> >> >> load catalog class and try to get the @Path annotation on a
> >> >> Catalog.getItems() method, without even CXF being involved ?
> >> >
> >> > I'll put that on the list of things to try, but I would be
> extremely
> >> > surprised if that displayed any problem.  It's likely something
> > about
> >> my
> >> > deployment environment that is causing this.
> >> >
> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> Sent: Tuesday, August 25, 2009 7:18 AM
> >> >> >> To: users@cxf.apache.org
> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >>
> >> >> >>
> >> >> >> Please add breakpoints to
> >> >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> >> >> >> its
> >> >> >> two setServiceBeans(...) methods.
> > JAXRSServerFactoryBean.create()
> >> > is
> >> >> >> called
> >> >> >> after one of those methods has been called.
> >> >> >
> >> >> > It hit "setServiceBeans(Object... beans)" with my one Catalog
> >> > object.
> >> >> >
> >> >> > In "getCreatedFromModel(Class<?> realClass)", I noted that
> >> >> > "classResourceInfos" was an empty list, so it returned null.
> > That
> >> >> could
> >> >> > be irrelevant.
> >> >> >
> >> >> > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
> >> >> > enableStatic)", I saw that when it was processing the
"getItem"
> >> >> method,
> >> >> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned
> >> null,
> >> >> so
> >> >> > it didn't create any class resource info.  It also returned
> null
> >> > from
> >> >> > "AnnotationUtils.getMethodAnnotation(annotatedMethod,
> >> Path.class)".
> >> >> The
> >> >> > "getItem()" method has both the "@GET" and "@Path" annotation.
> >> >> >
> >> >> > Why doesn't it think there are any annotations?
> >> >> >
> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >
> >> >> >> >> -----Original Message-----
> >> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> I've tried this class & beans.xml in the system tests
area,
> >> >> Catalog
> >> >> >> >> class was
> >> >> >> >> recognized.
> >> >> >> >>
> >> >> >> >> Can you please let me know a bit more about the way you
> load
> >> the
> >> >> >> >> (catalog)
> >> >> >> >> application ?
> >> >> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is
> it
> >> a
> >> >> >> >> standalone
> >> >> >> >> server which explicitly loads the beans.xml ?
> >> >> >> >
> >> >> >> > I build the application with Ant.  It's deployed to
WebLogic
> >> 10.
> >> >> >> >
> >> >> >> > Can you point me to some classes or methods that I could
set
> >> >> >> breakpoints
> >> >> >> > in to try to diagnose why it's not processing the Catalog
> >> class?
> >> >> >> >
> >> >> >> >>
> >> >> >> >> thanks, Sergey
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >
> >> >> >> >> >> -----Original Message-----
> >> >> >> >> >> From: Sergey Beryozkin
> [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
> >> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> Hi
> >> >> >> >> >>
> >> >> >> >> >> Everything seems to be ok.
> >> >> >> >> >> It appears the problem is to do with a missing import :
> >> >> >> >> >>
> >> >> >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-
> >> jaxrs-
> >> >> >> >> >> binding.xml" />
> >> >> >> >> >>
> >> >> >> >> >> can you add it please to your beans.xml ?
> >> >> >> >> >>
> >> >> >> >> >> For some reasons Catalog class is not introspected.
> > Perhaps
> >> >> due
> >> >> >> to
> >> >> >> >> the
> >> >> >> >> >> fact
> >> >> >> >> >> the above import is missing and thus no jaxrs-aware
> spring
> >> >> >> factory
> >> >> >> >> is
> >> >> >> >> >> invoked
> >> >> >> >> >
> >> >> >> >> > Nope, I'm afraid that didn't help.
> >> >> >> >> >
> >> >> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-
> api-
> >> >> >> 2.1.jar,
> >> >> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >> >> >> >> >
> >> >> >> >> > My current XML and Java are this:
> >> >> >> >> > -----beans.xml------
> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> > <beans
> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> > xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
> >> >> >> >> > xsi:schemaLocation="
> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> http://cxf.apache.org/schemas/jaxrs.xsd
> >> >> >> >> > http://cxf.apache.org/core
> >> >> > http://cxf.apache.org/schemascore.xsd">
> >> >> >> >> >
> >> >> >> >> > <import
resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> > <import resource="classpath:META-INF/cxf/cxf-
> extension-
> >> >> soap.xml"
> >> >> >> >> > />
> >> >> >> >> > <import
> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> />
> >> >> >> >> >     <import
> >> >> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> >> binding.xml"
> >> >> >> />
> >> >> >> >> >
> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> address="/rest">
> >> >> >> >> >         <jaxrs:features>
> >> >> >> >> >             <cxf:logging/>
> >> >> >> >> >         </jaxrs:features>
> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> > </beans>
> >> >> >> >> > -------------------------
> >> >> >> >> > -----Catalog.java-----
> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> > import java.util.List;
> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> > import javax.ws.rs.PathParam;
> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> > import javax.xml.bind.annotation.XmlRootElement;
> >> >> >> >> >
> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> > public class Catalog {
> >> >> >> >> > @GET
> >> >> >> >> > @Path("/item/{id}")
> >> >> >> >> > public Item getItem(@PathParam("id") String id)
{
> >> >> >> >> > Item item = new Item();
> >> >> >> >> > item.setId(id);
> >> >> >> >> > item.setTitle("abc");
> >> >> >> >> > item.setDescription("def");
> >> >> >> >> > return new Item();
> >> >> >> >> > }
> >> >> >> >> > @XmlRootElement(name = "Item")
> >> >> >> >> > public static class Item {
> >> >> >> >> > private String id;
> >> >> >> >> > private String title;
> >> >> >> >> > private String  description;
> >> >> >> >> >
> >> >> >> >> > public String getTitle() { return title;
}
> >> >> >> >> > public String getId() { return id; }
> >> >> >> >> > public String getDescription() { return
> >> > description;
> >> >> }
> >> >> >> >> >
> >> >> >> >> > public void setTitle(String title) {
this.title
> >> > =
> >> >> title;
> >> >> >> >> > }
> >> >> >> >> > public void setId(String id) { this.id =
id; }
> >> >> >> >> > public void setDescription(String
description)
> {
> >> >> >> >> > this.description = description; }
> >> >> >> >> > }
> >> >> >> >> > }
> >> >> >> >> > --------------------
> >> >> >> >> >
> >> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >> >
> >> >> >> >> >> > I'm trying to set up a simple REST prototype running
> >> >> alongside
> >> >> >> >> some
> >> >> >> >> >> > other existing code.
> >> >> >> >> >> >
> >> >> >> >> >> > When I deploy, I appear to fall into the following
> "if"
> >> >> block
> >> >> >> in
> >> >> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >> >> >> >> >
> >> >> >> >> >> > -----------------
> >> >> >> >> >> >         if (list.size() == 0) {
> >> >> >> >> >> >             org.apache.cxf.common.i18n.Message msg =
> >> >> >> >> >> >                 new
> >> >> >> >> >> >
> >> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >> >> >> >> >
> >> >> > BUNDLE);
> >> >> >> >> >> >             LOG.severe(msg.toString());
> >> >> >> >> >> >             throw new
> >> >> >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
> >> >> >> >> >> >         }
> >> >> >> >> >> > ---------------
> >> >> >> >> >> >
> >> >> >> >> >> > This list would be empty if
> >> >> >> >> >> "serviceFactory.getRealClassResourceInfo()"
> >> >> >> >> >> > returned an empty list.  What exactly would that
> >> indicate?
> >> >> >> >> >> >
> >> >> >> >> >> > My beans.xml is very simple right now, just:
> >> >> >> >> >> > -----------------------
> >> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> >> > <beans
> >> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >> >
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> >> > xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> >> > xsi:schemaLocation="
> >> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >> >
> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >> >> >> >> >
> >> >> >> >> >> > <import
> > resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> >> > <import resource="classpath:META-INF/cxf/cxf-
> >> extension-
> >> >> >> soap.xml"
> >> >> >> >> >> > />
> >> >> >> >> >> > <import
> >> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> >> />
> >> >> >> >> >> >
> >> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> >> address="/rest">
> >> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >> >             <bean
> class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> >> > </beans>
> >> >> >> >> >> > --------------------
> >> >> >> >> >> >
> >> >> >> >> >> > The "Catalog" class is also very primitive so far:
> >> >> >> >> >> > --------------------------
> >> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> >> >
> >> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> >> > import java.util.List;
> >> >> >> >> >> >
> >> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> >> >
> >> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> >> > public class Catalog {
> >> >> >> >> >> >
> >> >> >> >> >> > @GET
> >> >> >> >> >> > @Path("/items")
> >> >> >> >> >> > public List<Item> getItems() {
> >> >> >> >> >> > ArrayList<Item> result = new
> >> >> >> ArrayList<Item>();
> >> >> >> >> >> > result.add(new Item());
> >> >> >> >> >> > return (result);
> >> >> >> >> >> > }
> >> >> >> >> >> >
> >> >> >> >> >> > public static class Item {
> >> >> >> >> >> > private String title;
> >> >> >> >> >> > private String  description;
> >> >> >> >> >> >
> >> >> >> >> >> > public String getTitle() { return title;
> > }
> >> >> >> >> >> > public String getDescription() { return
> >> >> > description;
> >> >> >> }
> >> >> >> >> >> >
> >> >> >> >> >> > public void setTitle(String title) {
> > this.title
> >> >> > =
> >> >> >> title;
> >> >> >> >> >> > }
> >> >> >> >> >> > public void setDescription(String
> > description)
> >> {
> >> >> >> >> >> > this.description = description; }
> >> >> >> >> >> > }
> >> >> >> >> >> > }
> >> >> >> >> >> > ----------------------------
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> --
> >> >> >> >> >> View this message in context:
> >> http://www.nabble.com/getting-
> >> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> >> tp25120790p25123056.html
> >> >> >> >> >> Sent from the cxf-user mailing list archive at
> Nabble.com.
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> http://www.nabble.com/getting-
> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> tp25120790p25132223.html
> >> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> tp25120790p25135192.html
> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> tp25120790p25138372.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25141130.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25149335.html
> Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Wednesday, August 26, 2009 2:21 AM
> To: users@cxf.apache.org
> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> 
> Hi
> 
> This is a good news...
> Here's some more information on how to apply this feature. I'll need
to
> document it better - have added a task item...For, given the Catalog
> class
> mentioned in this thread the following model can be created :

This is very good information.

One question, though.  The way you specify the class to instantiate is
different from typical Spring beans.  It appears there's no way to
specify a Spring bean as a resource.  As a result, it appears that
there's no way to inject instance variable values into the resource, for
configuration control, for instance.  It's odd that the attribute is
"name", instead of "class".

This is odd, as in the same "jaxrs:server" element is the
"jaxrs:serviceBeans" element, where you specify the list of beans that
represent services.

So, I assume there's some clarity here somewhere that I haven't seen
yet.

> 
> <model>
> <resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
> <operation name="getItems" verb="GET" path="/items"/>
> </resource>
> </model>
> 
> The schema for 'model' is here :
>
http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/re
> sources/schemas/jaxrs.xsd
> 
> it is limiting a bit, specifically, parameter types should be
> capitalized at
> the moment and there's no a proper enum definition for parameter
types.
> For
> ex, 'PATH', 'QUERY', 'MATRIX', 'HEADER' is what should be used when
> describing parameters that would otherwise be annotated with
> @PathParam,
> @QueryParam, @MatrixParam, @HeaderParam. There's no need to describe
> input
> parameters which are mapped to request bodies. Response parameters are
> not
> described too.
> 
> 'resource' represents a resource class. It can describe either a root
> resource or a subresource one.
> For ex, if you have
> 
> @Path("catalog")
> public class Catalog {
> 
>   @GET
>   @Path("items")
>   public List<Item> getItems() {...}
> 
>   @Path("items/{id}")
>   public Item getItemName(@PathParam("id") Long id) {...}
> 
> }
> 
> where getItemName is a subresource locator and Item class has a method
> like
> 
> public class Item {
> @GET
> public String getName() {...}
> }
> 
> then, if we remove annotations, the same can be described like this :
> 
> <model>
> 
> <resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
> <operation name="getItems" verb="GET" path="/items"/>
> <operation name="getItemName" path="/item/{id}">
> 
> </operation>
> </operation>
> </resource>
> 
> <resource name="com.att.ecom.catalog.Item">
> <operation name="getName" verb="GET"/>
> </operation>
> </resource>
> 
> </model>
> 
> The resource with name "com.att.ecom.catalog.Item" is recognized as a
> subresource because when it introspects
> com.att.ecom.catalog.Catalog#getItemName it finds that its return
> type's
> name matches '"com.att.ecom.catalog.Item".
> So it's a flat structure but perhaps I'll support embedding resources
> too,
> similar to the way it's done in WADL. At the moment the only place
> where
> this feature is demoed is in a 'greeter_rest' demo in a DOSGi
> distribution[1] where IMHO this feature can be very handy indeed but I
> do
> want to allocate more time on it and document and enhance it properly.
> 
> Sergey
> 
> [1]
> http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/greeter_rest/
> 
> 
> KARR, DAVID (ATTCINW) wrote:
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Tuesday, August 25, 2009 1:02 PM
> >> To: users@cxf.apache.org
> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >> As the last resort/workaround, while you're investigating and just
> to
> >> keep
> >> you going, you might want to try this feature :
> >> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-
> >> RESTfulserviceswithoutannotations
> >>
> >> You can describe how Catalog should be treated by the JAX-RS
runtime
> >> without
> >> applying annotations and then register that description from spring
> >
> > I've gotten this to work (config in Spring, not annotations), so
I'll
> at
> > least be able to move forward a bit.
> >
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> >> -----Original Message-----
> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> Sent: Tuesday, August 25, 2009 10:06 AM
> >> >> To: users@cxf.apache.org
> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >>
> >> >>
> >> >> is it OSGi that is getting in the way ? Are you using OSGI by
any
> >> >> chance ?
> >> >> That is the only reason I can think of...
> >> >
> >> > The prototype is embedded along with a lot of other code that is
> >> > assembled into an EAR with the ATG Dynamo framework.  I'm pretty
> > sure
> >> > they're not using OSGi, but the EAR assembly is relatively
> complex.
> >> I'm
> >> > not sure what they could be doing that could possibly mess this
> up.
> >> >
> >> >> If yes then importing javax.ws.rs.* should fix it....
> >> >
> >> > I assume you mean in the Catalog class?  I'll try it.
> >> >
> >> >> Is it also possible for you to create a simple test project
where
> >> you
> >> >> will
> >> >> load catalog class and try to get the @Path annotation on a
> >> >> Catalog.getItems() method, without even CXF being involved ?
> >> >
> >> > I'll put that on the list of things to try, but I would be
> extremely
> >> > surprised if that displayed any problem.  It's likely something
> > about
> >> my
> >> > deployment environment that is causing this.
> >> >
> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> Sent: Tuesday, August 25, 2009 7:18 AM
> >> >> >> To: users@cxf.apache.org
> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >>
> >> >> >>
> >> >> >> Please add breakpoints to
> >> >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> >> >> >> its
> >> >> >> two setServiceBeans(...) methods.
> > JAXRSServerFactoryBean.create()
> >> > is
> >> >> >> called
> >> >> >> after one of those methods has been called.
> >> >> >
> >> >> > It hit "setServiceBeans(Object... beans)" with my one Catalog
> >> > object.
> >> >> >
> >> >> > In "getCreatedFromModel(Class<?> realClass)", I noted that
> >> >> > "classResourceInfos" was an empty list, so it returned null.
> > That
> >> >> could
> >> >> > be irrelevant.
> >> >> >
> >> >> > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
> >> >> > enableStatic)", I saw that when it was processing the
"getItem"
> >> >> method,
> >> >> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned
> >> null,
> >> >> so
> >> >> > it didn't create any class resource info.  It also returned
> null
> >> > from
> >> >> > "AnnotationUtils.getMethodAnnotation(annotatedMethod,
> >> Path.class)".
> >> >> The
> >> >> > "getItem()" method has both the "@GET" and "@Path" annotation.
> >> >> >
> >> >> > Why doesn't it think there are any annotations?
> >> >> >
> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >
> >> >> >> >> -----Original Message-----
> >> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> I've tried this class & beans.xml in the system tests
area,
> >> >> Catalog
> >> >> >> >> class was
> >> >> >> >> recognized.
> >> >> >> >>
> >> >> >> >> Can you please let me know a bit more about the way you
> load
> >> the
> >> >> >> >> (catalog)
> >> >> >> >> application ?
> >> >> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is
> it
> >> a
> >> >> >> >> standalone
> >> >> >> >> server which explicitly loads the beans.xml ?
> >> >> >> >
> >> >> >> > I build the application with Ant.  It's deployed to
WebLogic
> >> 10.
> >> >> >> >
> >> >> >> > Can you point me to some classes or methods that I could
set
> >> >> >> breakpoints
> >> >> >> > in to try to diagnose why it's not processing the Catalog
> >> class?
> >> >> >> >
> >> >> >> >>
> >> >> >> >> thanks, Sergey
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >
> >> >> >> >> >> -----Original Message-----
> >> >> >> >> >> From: Sergey Beryozkin
> [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
> >> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> Hi
> >> >> >> >> >>
> >> >> >> >> >> Everything seems to be ok.
> >> >> >> >> >> It appears the problem is to do with a missing import :
> >> >> >> >> >>
> >> >> >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-
> >> jaxrs-
> >> >> >> >> >> binding.xml" />
> >> >> >> >> >>
> >> >> >> >> >> can you add it please to your beans.xml ?
> >> >> >> >> >>
> >> >> >> >> >> For some reasons Catalog class is not introspected.
> > Perhaps
> >> >> due
> >> >> >> to
> >> >> >> >> the
> >> >> >> >> >> fact
> >> >> >> >> >> the above import is missing and thus no jaxrs-aware
> spring
> >> >> >> factory
> >> >> >> >> is
> >> >> >> >> >> invoked
> >> >> >> >> >
> >> >> >> >> > Nope, I'm afraid that didn't help.
> >> >> >> >> >
> >> >> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-
> api-
> >> >> >> 2.1.jar,
> >> >> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >> >> >> >> >
> >> >> >> >> > My current XML and Java are this:
> >> >> >> >> > -----beans.xml------
> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> > <beans
> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
> >> >> >> >> > 	xsi:schemaLocation="
> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> http://cxf.apache.org/schemas/jaxrs.xsd
> >> >> >> >> > http://cxf.apache.org/core
> >> >> > http://cxf.apache.org/schemascore.xsd">
> >> >> >> >> >
> >> >> >> >> > 	<import
resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-
> extension-
> >> >> soap.xml"
> >> >> >> >> > />
> >> >> >> >> > 	<import
> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> />
> >> >> >> >> >     <import
> >> >> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> >> binding.xml"
> >> >> >> />
> >> >> >> >> >
> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> address="/rest">
> >> >> >> >> >         <jaxrs:features>
> >> >> >> >> >             <cxf:logging/>
> >> >> >> >> >         </jaxrs:features>
> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> > </beans>
> >> >> >> >> > -------------------------
> >> >> >> >> > -----Catalog.java-----
> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> > import java.util.List;
> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> > import javax.ws.rs.PathParam;
> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> > import javax.xml.bind.annotation.XmlRootElement;
> >> >> >> >> >
> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> > public class Catalog {
> >> >> >> >> > 	@GET
> >> >> >> >> > 	@Path("/item/{id}")
> >> >> >> >> > 	public Item getItem(@PathParam("id") String id)
{
> >> >> >> >> > 		Item item	= new Item();
> >> >> >> >> > 		item.setId(id);
> >> >> >> >> > 		item.setTitle("abc");
> >> >> >> >> > 		item.setDescription("def");
> >> >> >> >> > 		return new Item();
> >> >> >> >> > 	}
> >> >> >> >> > 	@XmlRootElement(name = "Item")
> >> >> >> >> > 	public static class Item {
> >> >> >> >> > 		private String	id;
> >> >> >> >> > 		private String	title;
> >> >> >> >> > 		private String  description;
> >> >> >> >> >
> >> >> >> >> > 		public String getTitle() { return title;
}
> >> >> >> >> > 		public String getId() { return id; }
> >> >> >> >> > 		public String getDescription() { return
> >> > description;
> >> >> }
> >> >> >> >> >
> >> >> >> >> > 		public void setTitle(String title) {
this.title
> >> > =
> >> >> title;
> >> >> >> >> > }
> >> >> >> >> > 		public void setId(String id) { this.id =
id; }
> >> >> >> >> > 		public void setDescription(String
description)
> {
> >> >> >> >> > this.description = description; }
> >> >> >> >> > 	}
> >> >> >> >> > }
> >> >> >> >> > --------------------
> >> >> >> >> >
> >> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >> >
> >> >> >> >> >> > I'm trying to set up a simple REST prototype running
> >> >> alongside
> >> >> >> >> some
> >> >> >> >> >> > other existing code.
> >> >> >> >> >> >
> >> >> >> >> >> > When I deploy, I appear to fall into the following
> "if"
> >> >> block
> >> >> >> in
> >> >> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >> >> >> >> >
> >> >> >> >> >> > -----------------
> >> >> >> >> >> >         if (list.size() == 0) {
> >> >> >> >> >> >             org.apache.cxf.common.i18n.Message msg =
> >> >> >> >> >> >                 new
> >> >> >> >> >> >
> >> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >> >> >> >> >
> >> >> > BUNDLE);
> >> >> >> >> >> >             LOG.severe(msg.toString());
> >> >> >> >> >> >             throw new
> >> >> >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
> >> >> >> >> >> >         }
> >> >> >> >> >> > ---------------
> >> >> >> >> >> >
> >> >> >> >> >> > This list would be empty if
> >> >> >> >> >> "serviceFactory.getRealClassResourceInfo()"
> >> >> >> >> >> > returned an empty list.  What exactly would that
> >> indicate?
> >> >> >> >> >> >
> >> >> >> >> >> > My beans.xml is very simple right now, just:
> >> >> >> >> >> > -----------------------
> >> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> >> > <beans
> >> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >> >
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> >> > 	xsi:schemaLocation="
> >> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >> >
> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >> >> >> >> >
> >> >> >> >> >> > 	<import
> > resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-
> >> extension-
> >> >> >> soap.xml"
> >> >> >> >> >> > />
> >> >> >> >> >> > 	<import
> >> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> >> />
> >> >> >> >> >> >
> >> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> >> address="/rest">
> >> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >> >             <bean
> class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> >> > </beans>
> >> >> >> >> >> > --------------------
> >> >> >> >> >> >
> >> >> >> >> >> > The "Catalog" class is also very primitive so far:
> >> >> >> >> >> > --------------------------
> >> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> >> >
> >> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> >> > import java.util.List;
> >> >> >> >> >> >
> >> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> >> >
> >> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> >> > public class Catalog {
> >> >> >> >> >> >
> >> >> >> >> >> > 	@GET
> >> >> >> >> >> > 	@Path("/items")
> >> >> >> >> >> > 	public List<Item> getItems() {
> >> >> >> >> >> > 		ArrayList<Item>	result	= new
> >> >> >> ArrayList<Item>();
> >> >> >> >> >> > 		result.add(new Item());
> >> >> >> >> >> > 		return (result);
> >> >> >> >> >> > 	}
> >> >> >> >> >> >
> >> >> >> >> >> > 	public static class Item {
> >> >> >> >> >> > 		private String	title;
> >> >> >> >> >> > 		private String  description;
> >> >> >> >> >> >
> >> >> >> >> >> > 		public String getTitle() { return title;
> > }
> >> >> >> >> >> > 		public String getDescription() { return
> >> >> > description;
> >> >> >> }
> >> >> >> >> >> >
> >> >> >> >> >> > 		public void setTitle(String title) {
> > this.title
> >> >> > =
> >> >> >> title;
> >> >> >> >> >> > }
> >> >> >> >> >> > 		public void setDescription(String
> > description)
> >> {
> >> >> >> >> >> > this.description = description; }
> >> >> >> >> >> > 	}
> >> >> >> >> >> > }
> >> >> >> >> >> > ----------------------------
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> --
> >> >> >> >> >> View this message in context:
> >> http://www.nabble.com/getting-
> >> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> >> tp25120790p25123056.html
> >> >> >> >> >> Sent from the cxf-user mailing list archive at
> Nabble.com.
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> http://www.nabble.com/getting-
> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> tp25120790p25132223.html
> >> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> tp25120790p25135192.html
> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> tp25120790p25138372.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25141130.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25149335.html
> Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <se...@iona.com>.
Hi

This is a good news...
Here's some more information on how to apply this feature. I'll need to
document it better - have added a task item...For, given the Catalog class
mentioned in this thread the following model can be created :

<model>
<resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
<operation name="getItems" verb="GET" path="/items"/>
</resource>
</model>

The schema for 'model' is here :
http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs.xsd

it is limiting a bit, specifically, parameter types should be capitalized at
the moment and there's no a proper enum definition for parameter types. For
ex, 'PATH', 'QUERY', 'MATRIX', 'HEADER' is what should be used when
describing parameters that would otherwise be annotated with @PathParam,
@QueryParam, @MatrixParam, @HeaderParam. There's no need to describe input
parameters which are mapped to request bodies. Response parameters are not
described too.

'resource' represents a resource class. It can describe either a root
resource or a subresource one.
For ex, if you have

@Path("catalog")
public class Catalog {

  @GET
  @Path("items")
  public List<Item> getItems() {...}

  @Path("items/{id}")
  public Item getItemName(@PathParam("id") Long id) {...}

}

where getItemName is a subresource locator and Item class has a method like 

public class Item {
@GET
public String getName() {...}
}

then, if we remove annotations, the same can be described like this :

<model>

<resource name=" com.att.ecom.catalog.Catalog" path="/catalog">
<operation name="getItems" verb="GET" path="/items"/>
<operation name="getItemName" path="/item/{id}">
  
</operation>
</operation>
</resource>

<resource name="com.att.ecom.catalog.Item">
<operation name="getName" verb="GET"/>
</operation>
</resource>

</model>

The resource with name "com.att.ecom.catalog.Item" is recognized as a
subresource because when it introspects
com.att.ecom.catalog.Catalog#getItemName it finds that its return type's
name matches '"com.att.ecom.catalog.Item". 
So it's a flat structure but perhaps I'll support embedding resources too,
similar to the way it's done in WADL. At the moment the only place where
this feature is demoed is in a 'greeter_rest' demo in a DOSGi
distribution[1] where IMHO this feature can be very handy indeed but I do
want to allocate more time on it and document and enhance it properly.

Sergey

[1] http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/greeter_rest/


KARR, DAVID (ATTCINW) wrote:
> 
>> -----Original Message-----
>> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> Sent: Tuesday, August 25, 2009 1:02 PM
>> To: users@cxf.apache.org
>> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> "AbstractJAXRSFactoryBean.checkResources()"
>> 
>> As the last resort/workaround, while you're investigating and just to
>> keep
>> you going, you might want to try this feature :
>> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-
>> RESTfulserviceswithoutannotations
>> 
>> You can describe how Catalog should be treated by the JAX-RS runtime
>> without
>> applying annotations and then register that description from spring
> 
> I've gotten this to work (config in Spring, not annotations), so I'll at
> least be able to move forward a bit.
> 
>> KARR, DAVID (ATTCINW) wrote:
>> >
>> >> -----Original Message-----
>> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> Sent: Tuesday, August 25, 2009 10:06 AM
>> >> To: users@cxf.apache.org
>> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >>
>> >>
>> >> is it OSGi that is getting in the way ? Are you using OSGI by any
>> >> chance ?
>> >> That is the only reason I can think of...
>> >
>> > The prototype is embedded along with a lot of other code that is
>> > assembled into an EAR with the ATG Dynamo framework.  I'm pretty
> sure
>> > they're not using OSGi, but the EAR assembly is relatively complex.
>> I'm
>> > not sure what they could be doing that could possibly mess this up.
>> >
>> >> If yes then importing javax.ws.rs.* should fix it....
>> >
>> > I assume you mean in the Catalog class?  I'll try it.
>> >
>> >> Is it also possible for you to create a simple test project where
>> you
>> >> will
>> >> load catalog class and try to get the @Path annotation on a
>> >> Catalog.getItems() method, without even CXF being involved ?
>> >
>> > I'll put that on the list of things to try, but I would be extremely
>> > surprised if that displayed any problem.  It's likely something
> about
>> my
>> > deployment environment that is causing this.
>> >
>> >> KARR, DAVID (ATTCINW) wrote:
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> >> Sent: Tuesday, August 25, 2009 7:18 AM
>> >> >> To: users@cxf.apache.org
>> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> >> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >> >>
>> >> >>
>> >> >> Please add breakpoints to
>> >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
>> >> >> its
>> >> >> two setServiceBeans(...) methods.
> JAXRSServerFactoryBean.create()
>> > is
>> >> >> called
>> >> >> after one of those methods has been called.
>> >> >
>> >> > It hit "setServiceBeans(Object... beans)" with my one Catalog
>> > object.
>> >> >
>> >> > In "getCreatedFromModel(Class<?> realClass)", I noted that
>> >> > "classResourceInfos" was an empty list, so it returned null.
> That
>> >> could
>> >> > be irrelevant.
>> >> >
>> >> > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
>> >> > enableStatic)", I saw that when it was processing the "getItem"
>> >> method,
>> >> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned
>> null,
>> >> so
>> >> > it didn't create any class resource info.  It also returned null
>> > from
>> >> > "AnnotationUtils.getMethodAnnotation(annotatedMethod,
>> Path.class)".
>> >> The
>> >> > "getItem()" method has both the "@GET" and "@Path" annotation.
>> >> >
>> >> > Why doesn't it think there are any annotations?
>> >> >
>> >> >> KARR, DAVID (ATTCINW) wrote:
>> >> >> >
>> >> >> >> -----Original Message-----
>> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
>> >> >> >> To: users@cxf.apache.org
>> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >> >> >>
>> >> >> >>
>> >> >> >> I've tried this class & beans.xml in the system tests area,
>> >> Catalog
>> >> >> >> class was
>> >> >> >> recognized.
>> >> >> >>
>> >> >> >> Can you please let me know a bit more about the way you load
>> the
>> >> >> >> (catalog)
>> >> >> >> application ?
>> >> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it
>> a
>> >> >> >> standalone
>> >> >> >> server which explicitly loads the beans.xml ?
>> >> >> >
>> >> >> > I build the application with Ant.  It's deployed to WebLogic
>> 10.
>> >> >> >
>> >> >> > Can you point me to some classes or methods that I could set
>> >> >> breakpoints
>> >> >> > in to try to diagnose why it's not processing the Catalog
>> class?
>> >> >> >
>> >> >> >>
>> >> >> >> thanks, Sergey
>> >> >> >>
>> >> >> >>
>> >> >> >> KARR, DAVID (ATTCINW) wrote:
>> >> >> >> >
>> >> >> >> >> -----Original Message-----
>> >> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
>> >> >> >> >> To: users@cxf.apache.org
>> >> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
>> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> Hi
>> >> >> >> >>
>> >> >> >> >> Everything seems to be ok.
>> >> >> >> >> It appears the problem is to do with a missing import :
>> >> >> >> >>
>> >> >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-
>> jaxrs-
>> >> >> >> >> binding.xml" />
>> >> >> >> >>
>> >> >> >> >> can you add it please to your beans.xml ?
>> >> >> >> >>
>> >> >> >> >> For some reasons Catalog class is not introspected.
> Perhaps
>> >> due
>> >> >> to
>> >> >> >> the
>> >> >> >> >> fact
>> >> >> >> >> the above import is missing and thus no jaxrs-aware spring
>> >> >> factory
>> >> >> >> is
>> >> >> >> >> invoked
>> >> >> >> >
>> >> >> >> > Nope, I'm afraid that didn't help.
>> >> >> >> >
>> >> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-
>> >> >> 2.1.jar,
>> >> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
>> >> >> >> >
>> >> >> >> > My current XML and Java are this:
>> >> >> >> > -----beans.xml------
>> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> >> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
>> >> >> >> > 	xsi:schemaLocation="
>> >> >> >> > http://www.springframework.org/schema/beans
>> >> >> >> >
> http://www.springframework.org/schema/beans/spring-beans.xsd
>> >> >> >> > http://cxf.apache.org/jaxws
>> >> >> http://cxf.apache.org/schemas/jaxws.xsd
>> >> >> >> > http://cxf.apache.org/jaxrs
>> >> >> http://cxf.apache.org/schemas/jaxrs.xsd
>> >> >> >> > http://cxf.apache.org/core
>> >> > http://cxf.apache.org/schemascore.xsd">
>> >> >> >> >
>> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
>> >> soap.xml"
>> >> >> >> > />
>> >> >> >> > 	<import
>> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
>> >> />
>> >> >> >> >     <import
>> >> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>> >> binding.xml"
>> >> >> />
>> >> >> >> >
>> >> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
>> >> >> >> >         <jaxrs:features>
>> >> >> >> >             <cxf:logging/>
>> >> >> >> >         </jaxrs:features>
>> >> >> >> >         <jaxrs:serviceBeans>
>> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
>> >> >> >> >         </jaxrs:serviceBeans>
>> >> >> >> >     </jaxrs:server>
>> >> >> >> > </beans>
>> >> >> >> > -------------------------
>> >> >> >> > -----Catalog.java-----
>> >> >> >> > package com.att.ecom.catalog;
>> >> >> >> > import java.util.ArrayList;
>> >> >> >> > import java.util.List;
>> >> >> >> > import javax.ws.rs.GET;
>> >> >> >> > import javax.ws.rs.Path;
>> >> >> >> > import javax.ws.rs.PathParam;
>> >> >> >> > import javax.ws.rs.Produces;
>> >> >> >> > import javax.xml.bind.annotation.XmlRootElement;
>> >> >> >> >
>> >> >> >> > @Path("/catalog/")
>> >> >> >> > @Produces("application/xml")
>> >> >> >> > public class Catalog {
>> >> >> >> > 	@GET
>> >> >> >> > 	@Path("/item/{id}")
>> >> >> >> > 	public Item getItem(@PathParam("id") String id) {
>> >> >> >> > 		Item item	= new Item();
>> >> >> >> > 		item.setId(id);
>> >> >> >> > 		item.setTitle("abc");
>> >> >> >> > 		item.setDescription("def");
>> >> >> >> > 		return new Item();
>> >> >> >> > 	}
>> >> >> >> > 	@XmlRootElement(name = "Item")
>> >> >> >> > 	public static class Item {
>> >> >> >> > 		private String	id;
>> >> >> >> > 		private String	title;
>> >> >> >> > 		private String  description;
>> >> >> >> >
>> >> >> >> > 		public String getTitle() { return title; }
>> >> >> >> > 		public String getId() { return id; }
>> >> >> >> > 		public String getDescription() { return
>> > description;
>> >> }
>> >> >> >> >
>> >> >> >> > 		public void setTitle(String title) { this.title
>> > =
>> >> title;
>> >> >> >> > }
>> >> >> >> > 		public void setId(String id) { this.id = id; }
>> >> >> >> > 		public void setDescription(String description) {
>> >> >> >> > this.description = description; }
>> >> >> >> > 	}
>> >> >> >> > }
>> >> >> >> > --------------------
>> >> >> >> >
>> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
>> >> >> >> >> >
>> >> >> >> >> > I'm trying to set up a simple REST prototype running
>> >> alongside
>> >> >> >> some
>> >> >> >> >> > other existing code.
>> >> >> >> >> >
>> >> >> >> >> > When I deploy, I appear to fall into the following "if"
>> >> block
>> >> >> in
>> >> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
>> >> >> >> >> >
>> >> >> >> >> > -----------------
>> >> >> >> >> >         if (list.size() == 0) {
>> >> >> >> >> >             org.apache.cxf.common.i18n.Message msg =
>> >> >> >> >> >                 new
>> >> >> >> >> >
>> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
>> >> >> >> >> >
>> >> > BUNDLE);
>> >> >> >> >> >             LOG.severe(msg.toString());
>> >> >> >> >> >             throw new
>> >> >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
>> >> >> >> >> >         }
>> >> >> >> >> > ---------------
>> >> >> >> >> >
>> >> >> >> >> > This list would be empty if
>> >> >> >> >> "serviceFactory.getRealClassResourceInfo()"
>> >> >> >> >> > returned an empty list.  What exactly would that
>> indicate?
>> >> >> >> >> >
>> >> >> >> >> > My beans.xml is very simple right now, just:
>> >> >> >> >> > -----------------------
>> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> >> >> >> > <beans
>> xmlns="http://www.springframework.org/schema/beans"
>> >> >> >> >> >
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> >> >> >> >> > 	xsi:schemaLocation="
>> >> >> >> >> > http://www.springframework.org/schema/beans
>> >> >> >> >> >
>> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> >> >> >> >> > http://cxf.apache.org/jaxws
>> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
>> >> >> >> >> > http://cxf.apache.org/jaxrs
>> >> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
>> >> >> >> >> >
>> >> >> >> >> > 	<import
> resource="classpath:META-INF/cxf/cxf.xml" />
>> >> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-
>> extension-
>> >> >> soap.xml"
>> >> >> >> >> > />
>> >> >> >> >> > 	<import
>> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
>> >> >> />
>> >> >> >> >> >
>> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
>> address="/rest">
>> >> >> >> >> >         <jaxrs:serviceBeans>
>> >> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
>> >> >> >> >> >         </jaxrs:serviceBeans>
>> >> >> >> >> >     </jaxrs:server>
>> >> >> >> >> > </beans>
>> >> >> >> >> > --------------------
>> >> >> >> >> >
>> >> >> >> >> > The "Catalog" class is also very primitive so far:
>> >> >> >> >> > --------------------------
>> >> >> >> >> > package com.att.ecom.catalog;
>> >> >> >> >> >
>> >> >> >> >> > import java.util.ArrayList;
>> >> >> >> >> > import java.util.List;
>> >> >> >> >> >
>> >> >> >> >> > import javax.ws.rs.GET;
>> >> >> >> >> > import javax.ws.rs.Path;
>> >> >> >> >> > import javax.ws.rs.Produces;
>> >> >> >> >> >
>> >> >> >> >> > @Path("/catalog/")
>> >> >> >> >> > @Produces("application/xml")
>> >> >> >> >> > public class Catalog {
>> >> >> >> >> >
>> >> >> >> >> > 	@GET
>> >> >> >> >> > 	@Path("/items")
>> >> >> >> >> > 	public List<Item> getItems() {
>> >> >> >> >> > 		ArrayList<Item>	result	= new
>> >> >> ArrayList<Item>();
>> >> >> >> >> > 		result.add(new Item());
>> >> >> >> >> > 		return (result);
>> >> >> >> >> > 	}
>> >> >> >> >> >
>> >> >> >> >> > 	public static class Item {
>> >> >> >> >> > 		private String	title;
>> >> >> >> >> > 		private String  description;
>> >> >> >> >> >
>> >> >> >> >> > 		public String getTitle() { return title;
> }
>> >> >> >> >> > 		public String getDescription() { return
>> >> > description;
>> >> >> }
>> >> >> >> >> >
>> >> >> >> >> > 		public void setTitle(String title) {
> this.title
>> >> > =
>> >> >> title;
>> >> >> >> >> > }
>> >> >> >> >> > 		public void setDescription(String
> description)
>> {
>> >> >> >> >> > this.description = description; }
>> >> >> >> >> > 	}
>> >> >> >> >> > }
>> >> >> >> >> > ----------------------------
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> http://www.nabble.com/getting-
>> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> >> >> >> tp25120790p25123056.html
>> >> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context: http://www.nabble.com/getting-
>> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> >> >> tp25120790p25132223.html
>> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context: http://www.nabble.com/getting-
>> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> >> tp25120790p25135192.html
>> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context: http://www.nabble.com/getting-
>> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> tp25120790p25138372.html
>> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >
>> >
>> >
>> 
>> --
>> View this message in context: http://www.nabble.com/getting-
>> %22NO_RESOURCES_AVAILABLE%22-from-
>> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> tp25120790p25141130.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/getting-%22NO_RESOURCES_AVAILABLE%22-from-%22AbstractJAXRSFactoryBean.checkResources%28%29%22-tp25120790p25149335.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Tuesday, August 25, 2009 1:02 PM
> To: users@cxf.apache.org
> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> As the last resort/workaround, while you're investigating and just to
> keep
> you going, you might want to try this feature :
> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-
> RESTfulserviceswithoutannotations
> 
> You can describe how Catalog should be treated by the JAX-RS runtime
> without
> applying annotations and then register that description from spring

I've gotten this to work (config in Spring, not annotations), so I'll at
least be able to move forward a bit.

> KARR, DAVID (ATTCINW) wrote:
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Tuesday, August 25, 2009 10:06 AM
> >> To: users@cxf.apache.org
> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >>
> >> is it OSGi that is getting in the way ? Are you using OSGI by any
> >> chance ?
> >> That is the only reason I can think of...
> >
> > The prototype is embedded along with a lot of other code that is
> > assembled into an EAR with the ATG Dynamo framework.  I'm pretty
sure
> > they're not using OSGi, but the EAR assembly is relatively complex.
> I'm
> > not sure what they could be doing that could possibly mess this up.
> >
> >> If yes then importing javax.ws.rs.* should fix it....
> >
> > I assume you mean in the Catalog class?  I'll try it.
> >
> >> Is it also possible for you to create a simple test project where
> you
> >> will
> >> load catalog class and try to get the @Path annotation on a
> >> Catalog.getItems() method, without even CXF being involved ?
> >
> > I'll put that on the list of things to try, but I would be extremely
> > surprised if that displayed any problem.  It's likely something
about
> my
> > deployment environment that is causing this.
> >
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> >> -----Original Message-----
> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> Sent: Tuesday, August 25, 2009 7:18 AM
> >> >> To: users@cxf.apache.org
> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >>
> >> >>
> >> >> Please add breakpoints to
> >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> >> >> its
> >> >> two setServiceBeans(...) methods.
JAXRSServerFactoryBean.create()
> > is
> >> >> called
> >> >> after one of those methods has been called.
> >> >
> >> > It hit "setServiceBeans(Object... beans)" with my one Catalog
> > object.
> >> >
> >> > In "getCreatedFromModel(Class<?> realClass)", I noted that
> >> > "classResourceInfos" was an empty list, so it returned null.
That
> >> could
> >> > be irrelevant.
> >> >
> >> > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
> >> > enableStatic)", I saw that when it was processing the "getItem"
> >> method,
> >> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned
> null,
> >> so
> >> > it didn't create any class resource info.  It also returned null
> > from
> >> > "AnnotationUtils.getMethodAnnotation(annotatedMethod,
> Path.class)".
> >> The
> >> > "getItem()" method has both the "@GET" and "@Path" annotation.
> >> >
> >> > Why doesn't it think there are any annotations?
> >> >
> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
> >> >> >> To: users@cxf.apache.org
> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >>
> >> >> >>
> >> >> >> I've tried this class & beans.xml in the system tests area,
> >> Catalog
> >> >> >> class was
> >> >> >> recognized.
> >> >> >>
> >> >> >> Can you please let me know a bit more about the way you load
> the
> >> >> >> (catalog)
> >> >> >> application ?
> >> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it
> a
> >> >> >> standalone
> >> >> >> server which explicitly loads the beans.xml ?
> >> >> >
> >> >> > I build the application with Ant.  It's deployed to WebLogic
> 10.
> >> >> >
> >> >> > Can you point me to some classes or methods that I could set
> >> >> breakpoints
> >> >> > in to try to diagnose why it's not processing the Catalog
> class?
> >> >> >
> >> >> >>
> >> >> >> thanks, Sergey
> >> >> >>
> >> >> >>
> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >
> >> >> >> >> -----Original Message-----
> >> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Hi
> >> >> >> >>
> >> >> >> >> Everything seems to be ok.
> >> >> >> >> It appears the problem is to do with a missing import :
> >> >> >> >>
> >> >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-
> jaxrs-
> >> >> >> >> binding.xml" />
> >> >> >> >>
> >> >> >> >> can you add it please to your beans.xml ?
> >> >> >> >>
> >> >> >> >> For some reasons Catalog class is not introspected.
Perhaps
> >> due
> >> >> to
> >> >> >> the
> >> >> >> >> fact
> >> >> >> >> the above import is missing and thus no jaxrs-aware spring
> >> >> factory
> >> >> >> is
> >> >> >> >> invoked
> >> >> >> >
> >> >> >> > Nope, I'm afraid that didn't help.
> >> >> >> >
> >> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-
> >> >> 2.1.jar,
> >> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >> >> >> >
> >> >> >> > My current XML and Java are this:
> >> >> >> > -----beans.xml------
> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
> >> >> >> > 	xsi:schemaLocation="
> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >
http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> > http://cxf.apache.org/jaxws
> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> http://cxf.apache.org/schemas/jaxrs.xsd
> >> >> >> > http://cxf.apache.org/core
> >> > http://cxf.apache.org/schemascore.xsd">
> >> >> >> >
> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
> >> soap.xml"
> >> >> >> > />
> >> >> >> > 	<import
> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> />
> >> >> >> >     <import
> >> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> binding.xml"
> >> >> />
> >> >> >> >
> >> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >> >> >> >         <jaxrs:features>
> >> >> >> >             <cxf:logging/>
> >> >> >> >         </jaxrs:features>
> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >     </jaxrs:server>
> >> >> >> > </beans>
> >> >> >> > -------------------------
> >> >> >> > -----Catalog.java-----
> >> >> >> > package com.att.ecom.catalog;
> >> >> >> > import java.util.ArrayList;
> >> >> >> > import java.util.List;
> >> >> >> > import javax.ws.rs.GET;
> >> >> >> > import javax.ws.rs.Path;
> >> >> >> > import javax.ws.rs.PathParam;
> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> > import javax.xml.bind.annotation.XmlRootElement;
> >> >> >> >
> >> >> >> > @Path("/catalog/")
> >> >> >> > @Produces("application/xml")
> >> >> >> > public class Catalog {
> >> >> >> > 	@GET
> >> >> >> > 	@Path("/item/{id}")
> >> >> >> > 	public Item getItem(@PathParam("id") String id) {
> >> >> >> > 		Item item	= new Item();
> >> >> >> > 		item.setId(id);
> >> >> >> > 		item.setTitle("abc");
> >> >> >> > 		item.setDescription("def");
> >> >> >> > 		return new Item();
> >> >> >> > 	}
> >> >> >> > 	@XmlRootElement(name = "Item")
> >> >> >> > 	public static class Item {
> >> >> >> > 		private String	id;
> >> >> >> > 		private String	title;
> >> >> >> > 		private String  description;
> >> >> >> >
> >> >> >> > 		public String getTitle() { return title; }
> >> >> >> > 		public String getId() { return id; }
> >> >> >> > 		public String getDescription() { return
> > description;
> >> }
> >> >> >> >
> >> >> >> > 		public void setTitle(String title) { this.title
> > =
> >> title;
> >> >> >> > }
> >> >> >> > 		public void setId(String id) { this.id = id; }
> >> >> >> > 		public void setDescription(String description) {
> >> >> >> > this.description = description; }
> >> >> >> > 	}
> >> >> >> > }
> >> >> >> > --------------------
> >> >> >> >
> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >
> >> >> >> >> > I'm trying to set up a simple REST prototype running
> >> alongside
> >> >> >> some
> >> >> >> >> > other existing code.
> >> >> >> >> >
> >> >> >> >> > When I deploy, I appear to fall into the following "if"
> >> block
> >> >> in
> >> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >> >> >> >
> >> >> >> >> > -----------------
> >> >> >> >> >         if (list.size() == 0) {
> >> >> >> >> >             org.apache.cxf.common.i18n.Message msg =
> >> >> >> >> >                 new
> >> >> >> >> >
> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >> >> >> >
> >> > BUNDLE);
> >> >> >> >> >             LOG.severe(msg.toString());
> >> >> >> >> >             throw new
> >> >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
> >> >> >> >> >         }
> >> >> >> >> > ---------------
> >> >> >> >> >
> >> >> >> >> > This list would be empty if
> >> >> >> >> "serviceFactory.getRealClassResourceInfo()"
> >> >> >> >> > returned an empty list.  What exactly would that
> indicate?
> >> >> >> >> >
> >> >> >> >> > My beans.xml is very simple right now, just:
> >> >> >> >> > -----------------------
> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> > <beans
> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> > 	xsi:schemaLocation="
> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >> >> >> >
> >> >> >> >> > 	<import
resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-
> extension-
> >> >> soap.xml"
> >> >> >> >> > />
> >> >> >> >> > 	<import
> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> />
> >> >> >> >> >
> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> address="/rest">
> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> > </beans>
> >> >> >> >> > --------------------
> >> >> >> >> >
> >> >> >> >> > The "Catalog" class is also very primitive so far:
> >> >> >> >> > --------------------------
> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> >
> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> > import java.util.List;
> >> >> >> >> >
> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> >
> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> > public class Catalog {
> >> >> >> >> >
> >> >> >> >> > 	@GET
> >> >> >> >> > 	@Path("/items")
> >> >> >> >> > 	public List<Item> getItems() {
> >> >> >> >> > 		ArrayList<Item>	result	= new
> >> >> ArrayList<Item>();
> >> >> >> >> > 		result.add(new Item());
> >> >> >> >> > 		return (result);
> >> >> >> >> > 	}
> >> >> >> >> >
> >> >> >> >> > 	public static class Item {
> >> >> >> >> > 		private String	title;
> >> >> >> >> > 		private String  description;
> >> >> >> >> >
> >> >> >> >> > 		public String getTitle() { return title;
}
> >> >> >> >> > 		public String getDescription() { return
> >> > description;
> >> >> }
> >> >> >> >> >
> >> >> >> >> > 		public void setTitle(String title) {
this.title
> >> > =
> >> >> title;
> >> >> >> >> > }
> >> >> >> >> > 		public void setDescription(String
description)
> {
> >> >> >> >> > this.description = description; }
> >> >> >> >> > 	}
> >> >> >> >> > }
> >> >> >> >> > ----------------------------
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> http://www.nabble.com/getting-
> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> tp25120790p25123056.html
> >> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> tp25120790p25132223.html
> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> tp25120790p25135192.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25138372.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25141130.html
> Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Tuesday, August 25, 2009 1:02 PM
> To: users@cxf.apache.org
> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> 
> I've heard before WebLogic has some sort of OSGI-based kernel so it
> might be
> that assemblies are wrapped into bundles under the hood - not sure
> though.
> 
> > > If yes then importing javax.ws.rs.* should fix it....
> 
> > I assume you mean in the Catalog class?  I'll try it.
> 
> IN OSGI environment one needs to explicitly import packages containing
> annotations so if OSGI were used then one'd update either a bundle or
> some
> system configuration file with an Import-Package OSGI directive....
> 
> > I'll put that on the list of things to try, but I would be extremely
> surprised if that displayed any problem.
> 
> give a try please - simply update Catalog constructor - Catalog seem
to
> be
> instantiated by Spring just fine, and in that constructor do
> getClass().getMethod("getItems").getAnnotation(Path.class); or may be
> in a
> static initializer.
> 
> As the last resort/workaround, while you're investigating and just to
> keep
> you going, you might want to try this feature :
> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-
> RESTfulserviceswithoutannotations
> 
> You can describe how Catalog should be treated by the JAX-RS runtime
> without
> applying annotations and then register that description from spring

I'm having trouble getting this to work.

First of all, this single example only shows putting paths on methods,
not on the class.  I have a "root" path on the class, and then sub-paths
on each method.  How is that modeled using this strategy?

> KARR, DAVID (ATTCINW) wrote:
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Tuesday, August 25, 2009 10:06 AM
> >> To: users@cxf.apache.org
> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >>
> >> is it OSGi that is getting in the way ? Are you using OSGI by any
> >> chance ?
> >> That is the only reason I can think of...
> >
> > The prototype is embedded along with a lot of other code that is
> > assembled into an EAR with the ATG Dynamo framework.  I'm pretty
sure
> > they're not using OSGi, but the EAR assembly is relatively complex.
> I'm
> > not sure what they could be doing that could possibly mess this up.
> >
> >> If yes then importing javax.ws.rs.* should fix it....
> >
> > I assume you mean in the Catalog class?  I'll try it.
> >
> >> Is it also possible for you to create a simple test project where
> you
> >> will
> >> load catalog class and try to get the @Path annotation on a
> >> Catalog.getItems() method, without even CXF being involved ?
> >
> > I'll put that on the list of things to try, but I would be extremely
> > surprised if that displayed any problem.  It's likely something
about
> my
> > deployment environment that is causing this.
> >
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> >> -----Original Message-----
> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> Sent: Tuesday, August 25, 2009 7:18 AM
> >> >> To: users@cxf.apache.org
> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >>
> >> >>
> >> >> Please add breakpoints to
> >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> >> >> its
> >> >> two setServiceBeans(...) methods.
JAXRSServerFactoryBean.create()
> > is
> >> >> called
> >> >> after one of those methods has been called.
> >> >
> >> > It hit "setServiceBeans(Object... beans)" with my one Catalog
> > object.
> >> >
> >> > In "getCreatedFromModel(Class<?> realClass)", I noted that
> >> > "classResourceInfos" was an empty list, so it returned null.
That
> >> could
> >> > be irrelevant.
> >> >
> >> > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
> >> > enableStatic)", I saw that when it was processing the "getItem"
> >> method,
> >> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned
> null,
> >> so
> >> > it didn't create any class resource info.  It also returned null
> > from
> >> > "AnnotationUtils.getMethodAnnotation(annotatedMethod,
> Path.class)".
> >> The
> >> > "getItem()" method has both the "@GET" and "@Path" annotation.
> >> >
> >> > Why doesn't it think there are any annotations?
> >> >
> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
> >> >> >> To: users@cxf.apache.org
> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >>
> >> >> >>
> >> >> >> I've tried this class & beans.xml in the system tests area,
> >> Catalog
> >> >> >> class was
> >> >> >> recognized.
> >> >> >>
> >> >> >> Can you please let me know a bit more about the way you load
> the
> >> >> >> (catalog)
> >> >> >> application ?
> >> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it
> a
> >> >> >> standalone
> >> >> >> server which explicitly loads the beans.xml ?
> >> >> >
> >> >> > I build the application with Ant.  It's deployed to WebLogic
> 10.
> >> >> >
> >> >> > Can you point me to some classes or methods that I could set
> >> >> breakpoints
> >> >> > in to try to diagnose why it's not processing the Catalog
> class?
> >> >> >
> >> >> >>
> >> >> >> thanks, Sergey
> >> >> >>
> >> >> >>
> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >
> >> >> >> >> -----Original Message-----
> >> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Hi
> >> >> >> >>
> >> >> >> >> Everything seems to be ok.
> >> >> >> >> It appears the problem is to do with a missing import :
> >> >> >> >>
> >> >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-
> jaxrs-
> >> >> >> >> binding.xml" />
> >> >> >> >>
> >> >> >> >> can you add it please to your beans.xml ?
> >> >> >> >>
> >> >> >> >> For some reasons Catalog class is not introspected.
Perhaps
> >> due
> >> >> to
> >> >> >> the
> >> >> >> >> fact
> >> >> >> >> the above import is missing and thus no jaxrs-aware spring
> >> >> factory
> >> >> >> is
> >> >> >> >> invoked
> >> >> >> >
> >> >> >> > Nope, I'm afraid that didn't help.
> >> >> >> >
> >> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-
> >> >> 2.1.jar,
> >> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >> >> >> >
> >> >> >> > My current XML and Java are this:
> >> >> >> > -----beans.xml------
> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
> >> >> >> > 	xsi:schemaLocation="
> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >
http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> > http://cxf.apache.org/jaxws
> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> http://cxf.apache.org/schemas/jaxrs.xsd
> >> >> >> > http://cxf.apache.org/core
> >> > http://cxf.apache.org/schemascore.xsd">
> >> >> >> >
> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
> >> soap.xml"
> >> >> >> > />
> >> >> >> > 	<import
> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> />
> >> >> >> >     <import
> >> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> binding.xml"
> >> >> />
> >> >> >> >
> >> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >> >> >> >         <jaxrs:features>
> >> >> >> >             <cxf:logging/>
> >> >> >> >         </jaxrs:features>
> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >     </jaxrs:server>
> >> >> >> > </beans>
> >> >> >> > -------------------------
> >> >> >> > -----Catalog.java-----
> >> >> >> > package com.att.ecom.catalog;
> >> >> >> > import java.util.ArrayList;
> >> >> >> > import java.util.List;
> >> >> >> > import javax.ws.rs.GET;
> >> >> >> > import javax.ws.rs.Path;
> >> >> >> > import javax.ws.rs.PathParam;
> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> > import javax.xml.bind.annotation.XmlRootElement;
> >> >> >> >
> >> >> >> > @Path("/catalog/")
> >> >> >> > @Produces("application/xml")
> >> >> >> > public class Catalog {
> >> >> >> > 	@GET
> >> >> >> > 	@Path("/item/{id}")
> >> >> >> > 	public Item getItem(@PathParam("id") String id) {
> >> >> >> > 		Item item	= new Item();
> >> >> >> > 		item.setId(id);
> >> >> >> > 		item.setTitle("abc");
> >> >> >> > 		item.setDescription("def");
> >> >> >> > 		return new Item();
> >> >> >> > 	}
> >> >> >> > 	@XmlRootElement(name = "Item")
> >> >> >> > 	public static class Item {
> >> >> >> > 		private String	id;
> >> >> >> > 		private String	title;
> >> >> >> > 		private String  description;
> >> >> >> >
> >> >> >> > 		public String getTitle() { return title; }
> >> >> >> > 		public String getId() { return id; }
> >> >> >> > 		public String getDescription() { return
> > description;
> >> }
> >> >> >> >
> >> >> >> > 		public void setTitle(String title) { this.title
> > =
> >> title;
> >> >> >> > }
> >> >> >> > 		public void setId(String id) { this.id = id; }
> >> >> >> > 		public void setDescription(String description) {
> >> >> >> > this.description = description; }
> >> >> >> > 	}
> >> >> >> > }
> >> >> >> > --------------------
> >> >> >> >
> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >
> >> >> >> >> > I'm trying to set up a simple REST prototype running
> >> alongside
> >> >> >> some
> >> >> >> >> > other existing code.
> >> >> >> >> >
> >> >> >> >> > When I deploy, I appear to fall into the following "if"
> >> block
> >> >> in
> >> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >> >> >> >
> >> >> >> >> > -----------------
> >> >> >> >> >         if (list.size() == 0) {
> >> >> >> >> >             org.apache.cxf.common.i18n.Message msg =
> >> >> >> >> >                 new
> >> >> >> >> >
> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >> >> >> >
> >> > BUNDLE);
> >> >> >> >> >             LOG.severe(msg.toString());
> >> >> >> >> >             throw new
> >> >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
> >> >> >> >> >         }
> >> >> >> >> > ---------------
> >> >> >> >> >
> >> >> >> >> > This list would be empty if
> >> >> >> >> "serviceFactory.getRealClassResourceInfo()"
> >> >> >> >> > returned an empty list.  What exactly would that
> indicate?
> >> >> >> >> >
> >> >> >> >> > My beans.xml is very simple right now, just:
> >> >> >> >> > -----------------------
> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> > <beans
> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> > 	xsi:schemaLocation="
> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >> >> >> >
> >> >> >> >> > 	<import
resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-
> extension-
> >> >> soap.xml"
> >> >> >> >> > />
> >> >> >> >> > 	<import
> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> />
> >> >> >> >> >
> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> address="/rest">
> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> > </beans>
> >> >> >> >> > --------------------
> >> >> >> >> >
> >> >> >> >> > The "Catalog" class is also very primitive so far:
> >> >> >> >> > --------------------------
> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> >
> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> > import java.util.List;
> >> >> >> >> >
> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> >
> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> > public class Catalog {
> >> >> >> >> >
> >> >> >> >> > 	@GET
> >> >> >> >> > 	@Path("/items")
> >> >> >> >> > 	public List<Item> getItems() {
> >> >> >> >> > 		ArrayList<Item>	result	= new
> >> >> ArrayList<Item>();
> >> >> >> >> > 		result.add(new Item());
> >> >> >> >> > 		return (result);
> >> >> >> >> > 	}
> >> >> >> >> >
> >> >> >> >> > 	public static class Item {
> >> >> >> >> > 		private String	title;
> >> >> >> >> > 		private String  description;
> >> >> >> >> >
> >> >> >> >> > 		public String getTitle() { return title;
}
> >> >> >> >> > 		public String getDescription() { return
> >> > description;
> >> >> }
> >> >> >> >> >
> >> >> >> >> > 		public void setTitle(String title) {
this.title
> >> > =
> >> >> title;
> >> >> >> >> > }
> >> >> >> >> > 		public void setDescription(String
description)
> {
> >> >> >> >> > this.description = description; }
> >> >> >> >> > 	}
> >> >> >> >> > }
> >> >> >> >> > ----------------------------
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> http://www.nabble.com/getting-
> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> tp25120790p25123056.html
> >> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> tp25120790p25132223.html
> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> tp25120790p25135192.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25138372.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25141130.html
> Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Tuesday, August 25, 2009 1:02 PM
> To: users@cxf.apache.org
> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> 
> I've heard before WebLogic has some sort of OSGI-based kernel so it
> might be
> that assemblies are wrapped into bundles under the hood - not sure
> though.

I'm pretty familiar with how WebLogic works, and I'm pretty sure it
doesn't use OSGi directly.  I just searched the documentation tree, and
I didn't find any significant references.

> > > If yes then importing javax.ws.rs.* should fix it....
> 
> > I assume you mean in the Catalog class?  I'll try it.

Adding that import to the Catalog class had no effect.

> IN OSGI environment one needs to explicitly import packages containing
> annotations so if OSGI were used then one'd update either a bundle or
> some
> system configuration file with an Import-Package OSGI directive....
> 
> > I'll put that on the list of things to try, but I would be extremely
> surprised if that displayed any problem.
> 
> give a try please - simply update Catalog constructor - Catalog seem
to
> be
> instantiated by Spring just fine, and in that constructor do
> getClass().getMethod("getItems").getAnnotation(Path.class); or may be
> in a
> static initializer.

I'll give this a try, but when I stepped into the CXF code that ended up
calling "getAnnotation(), this is where it was returning null, so I'd be
very surprised if I got something different from this.

> As the last resort/workaround, while you're investigating and just to
> keep
> you going, you might want to try this feature :
> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-
> RESTfulserviceswithoutannotations
> 
> You can describe how Catalog should be treated by the JAX-RS runtime
> without
> applying annotations and then register that description from spring

Yup, I already found that.  I wish there was at least a tiny bit more
documentation on that strategy.  The only documentation I can find is
just the existence of that single model file.  Some of the details are
obvious, but others not quite.  I wrote another topic about this on the
list.

> KARR, DAVID (ATTCINW) wrote:
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Tuesday, August 25, 2009 10:06 AM
> >> To: users@cxf.apache.org
> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >>
> >> is it OSGi that is getting in the way ? Are you using OSGI by any
> >> chance ?
> >> That is the only reason I can think of...
> >
> > The prototype is embedded along with a lot of other code that is
> > assembled into an EAR with the ATG Dynamo framework.  I'm pretty
sure
> > they're not using OSGi, but the EAR assembly is relatively complex.
> I'm
> > not sure what they could be doing that could possibly mess this up.
> >
> >> If yes then importing javax.ws.rs.* should fix it....
> >
> > I assume you mean in the Catalog class?  I'll try it.
> >
> >> Is it also possible for you to create a simple test project where
> you
> >> will
> >> load catalog class and try to get the @Path annotation on a
> >> Catalog.getItems() method, without even CXF being involved ?
> >
> > I'll put that on the list of things to try, but I would be extremely
> > surprised if that displayed any problem.  It's likely something
about
> my
> > deployment environment that is causing this.
> >
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> >> -----Original Message-----
> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> Sent: Tuesday, August 25, 2009 7:18 AM
> >> >> To: users@cxf.apache.org
> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >>
> >> >>
> >> >> Please add breakpoints to
> >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> >> >> its
> >> >> two setServiceBeans(...) methods.
JAXRSServerFactoryBean.create()
> > is
> >> >> called
> >> >> after one of those methods has been called.
> >> >
> >> > It hit "setServiceBeans(Object... beans)" with my one Catalog
> > object.
> >> >
> >> > In "getCreatedFromModel(Class<?> realClass)", I noted that
> >> > "classResourceInfos" was an empty list, so it returned null.
That
> >> could
> >> > be irrelevant.
> >> >
> >> > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
> >> > enableStatic)", I saw that when it was processing the "getItem"
> >> method,
> >> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned
> null,
> >> so
> >> > it didn't create any class resource info.  It also returned null
> > from
> >> > "AnnotationUtils.getMethodAnnotation(annotatedMethod,
> Path.class)".
> >> The
> >> > "getItem()" method has both the "@GET" and "@Path" annotation.
> >> >
> >> > Why doesn't it think there are any annotations?
> >> >
> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
> >> >> >> To: users@cxf.apache.org
> >> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >>
> >> >> >>
> >> >> >> I've tried this class & beans.xml in the system tests area,
> >> Catalog
> >> >> >> class was
> >> >> >> recognized.
> >> >> >>
> >> >> >> Can you please let me know a bit more about the way you load
> the
> >> >> >> (catalog)
> >> >> >> application ?
> >> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it
> a
> >> >> >> standalone
> >> >> >> server which explicitly loads the beans.xml ?
> >> >> >
> >> >> > I build the application with Ant.  It's deployed to WebLogic
> 10.
> >> >> >
> >> >> > Can you point me to some classes or methods that I could set
> >> >> breakpoints
> >> >> > in to try to diagnose why it's not processing the Catalog
> class?
> >> >> >
> >> >> >>
> >> >> >> thanks, Sergey
> >> >> >>
> >> >> >>
> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >
> >> >> >> >> -----Original Message-----
> >> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
> >> >> >> >> To: users@cxf.apache.org
> >> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Hi
> >> >> >> >>
> >> >> >> >> Everything seems to be ok.
> >> >> >> >> It appears the problem is to do with a missing import :
> >> >> >> >>
> >> >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-
> jaxrs-
> >> >> >> >> binding.xml" />
> >> >> >> >>
> >> >> >> >> can you add it please to your beans.xml ?
> >> >> >> >>
> >> >> >> >> For some reasons Catalog class is not introspected.
Perhaps
> >> due
> >> >> to
> >> >> >> the
> >> >> >> >> fact
> >> >> >> >> the above import is missing and thus no jaxrs-aware spring
> >> >> factory
> >> >> >> is
> >> >> >> >> invoked
> >> >> >> >
> >> >> >> > Nope, I'm afraid that didn't help.
> >> >> >> >
> >> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-
> >> >> 2.1.jar,
> >> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >> >> >> >
> >> >> >> > My current XML and Java are this:
> >> >> >> > -----beans.xml------
> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
> >> >> >> > 	xsi:schemaLocation="
> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >
http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> > http://cxf.apache.org/jaxws
> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> http://cxf.apache.org/schemas/jaxrs.xsd
> >> >> >> > http://cxf.apache.org/core
> >> > http://cxf.apache.org/schemascore.xsd">
> >> >> >> >
> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
> >> soap.xml"
> >> >> >> > />
> >> >> >> > 	<import
> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> />
> >> >> >> >     <import
> >> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> binding.xml"
> >> >> />
> >> >> >> >
> >> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >> >> >> >         <jaxrs:features>
> >> >> >> >             <cxf:logging/>
> >> >> >> >         </jaxrs:features>
> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >     </jaxrs:server>
> >> >> >> > </beans>
> >> >> >> > -------------------------
> >> >> >> > -----Catalog.java-----
> >> >> >> > package com.att.ecom.catalog;
> >> >> >> > import java.util.ArrayList;
> >> >> >> > import java.util.List;
> >> >> >> > import javax.ws.rs.GET;
> >> >> >> > import javax.ws.rs.Path;
> >> >> >> > import javax.ws.rs.PathParam;
> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> > import javax.xml.bind.annotation.XmlRootElement;
> >> >> >> >
> >> >> >> > @Path("/catalog/")
> >> >> >> > @Produces("application/xml")
> >> >> >> > public class Catalog {
> >> >> >> > 	@GET
> >> >> >> > 	@Path("/item/{id}")
> >> >> >> > 	public Item getItem(@PathParam("id") String id) {
> >> >> >> > 		Item item	= new Item();
> >> >> >> > 		item.setId(id);
> >> >> >> > 		item.setTitle("abc");
> >> >> >> > 		item.setDescription("def");
> >> >> >> > 		return new Item();
> >> >> >> > 	}
> >> >> >> > 	@XmlRootElement(name = "Item")
> >> >> >> > 	public static class Item {
> >> >> >> > 		private String	id;
> >> >> >> > 		private String	title;
> >> >> >> > 		private String  description;
> >> >> >> >
> >> >> >> > 		public String getTitle() { return title; }
> >> >> >> > 		public String getId() { return id; }
> >> >> >> > 		public String getDescription() { return
> > description;
> >> }
> >> >> >> >
> >> >> >> > 		public void setTitle(String title) { this.title
> > =
> >> title;
> >> >> >> > }
> >> >> >> > 		public void setId(String id) { this.id = id; }
> >> >> >> > 		public void setDescription(String description) {
> >> >> >> > this.description = description; }
> >> >> >> > 	}
> >> >> >> > }
> >> >> >> > --------------------
> >> >> >> >
> >> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >> >
> >> >> >> >> > I'm trying to set up a simple REST prototype running
> >> alongside
> >> >> >> some
> >> >> >> >> > other existing code.
> >> >> >> >> >
> >> >> >> >> > When I deploy, I appear to fall into the following "if"
> >> block
> >> >> in
> >> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >> >> >> >
> >> >> >> >> > -----------------
> >> >> >> >> >         if (list.size() == 0) {
> >> >> >> >> >             org.apache.cxf.common.i18n.Message msg =
> >> >> >> >> >                 new
> >> >> >> >> >
> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >> >> >> >
> >> > BUNDLE);
> >> >> >> >> >             LOG.severe(msg.toString());
> >> >> >> >> >             throw new
> >> >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
> >> >> >> >> >         }
> >> >> >> >> > ---------------
> >> >> >> >> >
> >> >> >> >> > This list would be empty if
> >> >> >> >> "serviceFactory.getRealClassResourceInfo()"
> >> >> >> >> > returned an empty list.  What exactly would that
> indicate?
> >> >> >> >> >
> >> >> >> >> > My beans.xml is very simple right now, just:
> >> >> >> >> > -----------------------
> >> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> >> > <beans
> xmlns="http://www.springframework.org/schema/beans"
> >> >> >> >> >
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> >> > 	xsi:schemaLocation="
> >> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >> >
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> >> > http://cxf.apache.org/jaxws
> >> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >> >> >> >
> >> >> >> >> > 	<import
resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-
> extension-
> >> >> soap.xml"
> >> >> >> >> > />
> >> >> >> >> > 	<import
> >> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> >> />
> >> >> >> >> >
> >> >> >> >> >     <jaxrs:server name="restcatalogserver"
> address="/rest">
> >> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >> >     </jaxrs:server>
> >> >> >> >> > </beans>
> >> >> >> >> > --------------------
> >> >> >> >> >
> >> >> >> >> > The "Catalog" class is also very primitive so far:
> >> >> >> >> > --------------------------
> >> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >> >
> >> >> >> >> > import java.util.ArrayList;
> >> >> >> >> > import java.util.List;
> >> >> >> >> >
> >> >> >> >> > import javax.ws.rs.GET;
> >> >> >> >> > import javax.ws.rs.Path;
> >> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >> >
> >> >> >> >> > @Path("/catalog/")
> >> >> >> >> > @Produces("application/xml")
> >> >> >> >> > public class Catalog {
> >> >> >> >> >
> >> >> >> >> > 	@GET
> >> >> >> >> > 	@Path("/items")
> >> >> >> >> > 	public List<Item> getItems() {
> >> >> >> >> > 		ArrayList<Item>	result	= new
> >> >> ArrayList<Item>();
> >> >> >> >> > 		result.add(new Item());
> >> >> >> >> > 		return (result);
> >> >> >> >> > 	}
> >> >> >> >> >
> >> >> >> >> > 	public static class Item {
> >> >> >> >> > 		private String	title;
> >> >> >> >> > 		private String  description;
> >> >> >> >> >
> >> >> >> >> > 		public String getTitle() { return title;
}
> >> >> >> >> > 		public String getDescription() { return
> >> > description;
> >> >> }
> >> >> >> >> >
> >> >> >> >> > 		public void setTitle(String title) {
this.title
> >> > =
> >> >> title;
> >> >> >> >> > }
> >> >> >> >> > 		public void setDescription(String
description)
> {
> >> >> >> >> > this.description = description; }
> >> >> >> >> > 	}
> >> >> >> >> > }
> >> >> >> >> > ----------------------------
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> http://www.nabble.com/getting-
> >> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> >> tp25120790p25123056.html
> >> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> tp25120790p25132223.html
> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> tp25120790p25135192.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25138372.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25141130.html
> Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <se...@iona.com>.
I've heard before WebLogic has some sort of OSGI-based kernel so it might be
that assemblies are wrapped into bundles under the hood - not sure though.

> > If yes then importing javax.ws.rs.* should fix it....

> I assume you mean in the Catalog class?  I'll try it.

IN OSGI environment one needs to explicitly import packages containing
annotations so if OSGI were used then one'd update either a bundle or some
system configuration file with an Import-Package OSGI directive....

> I'll put that on the list of things to try, but I would be extremely
surprised if that displayed any problem.

give a try please - simply update Catalog constructor - Catalog seem to be
instantiated by Spring just fine, and in that constructor do
getClass().getMethod("getItems").getAnnotation(Path.class); or may be in a
static initializer.

As the last resort/workaround, while you're investigating and just to keep
you going, you might want to try this feature :
http://cxf.apache.org/docs/jax-rs.html#JAX-RS-RESTfulserviceswithoutannotations

You can describe how Catalog should be treated by the JAX-RS runtime without
applying annotations and then register that description from spring

cheers, Sergey




KARR, DAVID (ATTCINW) wrote:
> 
>> -----Original Message-----
>> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> Sent: Tuesday, August 25, 2009 10:06 AM
>> To: users@cxf.apache.org
>> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> "AbstractJAXRSFactoryBean.checkResources()"
>> 
>> 
>> is it OSGi that is getting in the way ? Are you using OSGI by any
>> chance ?
>> That is the only reason I can think of...
> 
> The prototype is embedded along with a lot of other code that is
> assembled into an EAR with the ATG Dynamo framework.  I'm pretty sure
> they're not using OSGi, but the EAR assembly is relatively complex.  I'm
> not sure what they could be doing that could possibly mess this up.
> 
>> If yes then importing javax.ws.rs.* should fix it....
> 
> I assume you mean in the Catalog class?  I'll try it.
> 
>> Is it also possible for you to create a simple test project where you
>> will
>> load catalog class and try to get the @Path annotation on a
>> Catalog.getItems() method, without even CXF being involved ?
> 
> I'll put that on the list of things to try, but I would be extremely
> surprised if that displayed any problem.  It's likely something about my
> deployment environment that is causing this.
> 
>> KARR, DAVID (ATTCINW) wrote:
>> >
>> >> -----Original Message-----
>> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> Sent: Tuesday, August 25, 2009 7:18 AM
>> >> To: users@cxf.apache.org
>> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >>
>> >>
>> >> Please add breakpoints to
>> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
>> >> its
>> >> two setServiceBeans(...) methods. JAXRSServerFactoryBean.create()
> is
>> >> called
>> >> after one of those methods has been called.
>> >
>> > It hit "setServiceBeans(Object... beans)" with my one Catalog
> object.
>> >
>> > In "getCreatedFromModel(Class<?> realClass)", I noted that
>> > "classResourceInfos" was an empty list, so it returned null.  That
>> could
>> > be irrelevant.
>> >
>> > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
>> > enableStatic)", I saw that when it was processing the "getItem"
>> method,
>> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned null,
>> so
>> > it didn't create any class resource info.  It also returned null
> from
>> > "AnnotationUtils.getMethodAnnotation(annotatedMethod, Path.class)".
>> The
>> > "getItem()" method has both the "@GET" and "@Path" annotation.
>> >
>> > Why doesn't it think there are any annotations?
>> >
>> >> KARR, DAVID (ATTCINW) wrote:
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
>> >> >> To: users@cxf.apache.org
>> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> >> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >> >>
>> >> >>
>> >> >> I've tried this class & beans.xml in the system tests area,
>> Catalog
>> >> >> class was
>> >> >> recognized.
>> >> >>
>> >> >> Can you please let me know a bit more about the way you load the
>> >> >> (catalog)
>> >> >> application ?
>> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it a
>> >> >> standalone
>> >> >> server which explicitly loads the beans.xml ?
>> >> >
>> >> > I build the application with Ant.  It's deployed to WebLogic 10.
>> >> >
>> >> > Can you point me to some classes or methods that I could set
>> >> breakpoints
>> >> > in to try to diagnose why it's not processing the Catalog class?
>> >> >
>> >> >>
>> >> >> thanks, Sergey
>> >> >>
>> >> >>
>> >> >> KARR, DAVID (ATTCINW) wrote:
>> >> >> >
>> >> >> >> -----Original Message-----
>> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
>> >> >> >> To: users@cxf.apache.org
>> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
>> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >> >> >>
>> >> >> >>
>> >> >> >> Hi
>> >> >> >>
>> >> >> >> Everything seems to be ok.
>> >> >> >> It appears the problem is to do with a missing import :
>> >> >> >>
>> >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>> >> >> >> binding.xml" />
>> >> >> >>
>> >> >> >> can you add it please to your beans.xml ?
>> >> >> >>
>> >> >> >> For some reasons Catalog class is not introspected. Perhaps
>> due
>> >> to
>> >> >> the
>> >> >> >> fact
>> >> >> >> the above import is missing and thus no jaxrs-aware spring
>> >> factory
>> >> >> is
>> >> >> >> invoked
>> >> >> >
>> >> >> > Nope, I'm afraid that didn't help.
>> >> >> >
>> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-
>> >> 2.1.jar,
>> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
>> >> >> >
>> >> >> > My current XML and Java are this:
>> >> >> > -----beans.xml------
>> >> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
>> >> >> > 	xsi:schemaLocation="
>> >> >> > http://www.springframework.org/schema/beans
>> >> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> >> >> > http://cxf.apache.org/jaxws
>> >> http://cxf.apache.org/schemas/jaxws.xsd
>> >> >> > http://cxf.apache.org/jaxrs
>> >> http://cxf.apache.org/schemas/jaxrs.xsd
>> >> >> > http://cxf.apache.org/core
>> > http://cxf.apache.org/schemascore.xsd">
>> >> >> >
>> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
>> soap.xml"
>> >> >> > />
>> >> >> > 	<import
> resource="classpath:META-INF/cxf/cxf-servlet.xml"
>> />
>> >> >> >     <import
>> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>> binding.xml"
>> >> />
>> >> >> >
>> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
>> >> >> >         <jaxrs:features>
>> >> >> >             <cxf:logging/>
>> >> >> >         </jaxrs:features>
>> >> >> >         <jaxrs:serviceBeans>
>> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
>> >> >> >         </jaxrs:serviceBeans>
>> >> >> >     </jaxrs:server>
>> >> >> > </beans>
>> >> >> > -------------------------
>> >> >> > -----Catalog.java-----
>> >> >> > package com.att.ecom.catalog;
>> >> >> > import java.util.ArrayList;
>> >> >> > import java.util.List;
>> >> >> > import javax.ws.rs.GET;
>> >> >> > import javax.ws.rs.Path;
>> >> >> > import javax.ws.rs.PathParam;
>> >> >> > import javax.ws.rs.Produces;
>> >> >> > import javax.xml.bind.annotation.XmlRootElement;
>> >> >> >
>> >> >> > @Path("/catalog/")
>> >> >> > @Produces("application/xml")
>> >> >> > public class Catalog {
>> >> >> > 	@GET
>> >> >> > 	@Path("/item/{id}")
>> >> >> > 	public Item getItem(@PathParam("id") String id) {
>> >> >> > 		Item item	= new Item();
>> >> >> > 		item.setId(id);
>> >> >> > 		item.setTitle("abc");
>> >> >> > 		item.setDescription("def");
>> >> >> > 		return new Item();
>> >> >> > 	}
>> >> >> > 	@XmlRootElement(name = "Item")
>> >> >> > 	public static class Item {
>> >> >> > 		private String	id;
>> >> >> > 		private String	title;
>> >> >> > 		private String  description;
>> >> >> >
>> >> >> > 		public String getTitle() { return title; }
>> >> >> > 		public String getId() { return id; }
>> >> >> > 		public String getDescription() { return
> description;
>> }
>> >> >> >
>> >> >> > 		public void setTitle(String title) { this.title
> =
>> title;
>> >> >> > }
>> >> >> > 		public void setId(String id) { this.id = id; }
>> >> >> > 		public void setDescription(String description) {
>> >> >> > this.description = description; }
>> >> >> > 	}
>> >> >> > }
>> >> >> > --------------------
>> >> >> >
>> >> >> >> KARR, DAVID (ATTCINW) wrote:
>> >> >> >> >
>> >> >> >> > I'm trying to set up a simple REST prototype running
>> alongside
>> >> >> some
>> >> >> >> > other existing code.
>> >> >> >> >
>> >> >> >> > When I deploy, I appear to fall into the following "if"
>> block
>> >> in
>> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
>> >> >> >> >
>> >> >> >> > -----------------
>> >> >> >> >         if (list.size() == 0) {
>> >> >> >> >             org.apache.cxf.common.i18n.Message msg =
>> >> >> >> >                 new
>> >> >> >> >
> org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
>> >> >> >> >
>> > BUNDLE);
>> >> >> >> >             LOG.severe(msg.toString());
>> >> >> >> >             throw new
>> >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
>> >> >> >> >         }
>> >> >> >> > ---------------
>> >> >> >> >
>> >> >> >> > This list would be empty if
>> >> >> >> "serviceFactory.getRealClassResourceInfo()"
>> >> >> >> > returned an empty list.  What exactly would that indicate?
>> >> >> >> >
>> >> >> >> > My beans.xml is very simple right now, just:
>> >> >> >> > -----------------------
>> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> >> >> >> > 	xsi:schemaLocation="
>> >> >> >> > http://www.springframework.org/schema/beans
>> >> >> >> >
> http://www.springframework.org/schema/beans/spring-beans.xsd
>> >> >> >> > http://cxf.apache.org/jaxws
>> >> >> http://cxf.apache.org/schemas/jaxws.xsd
>> >> >> >> > http://cxf.apache.org/jaxrs
>> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
>> >> >> >> >
>> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
>> >> soap.xml"
>> >> >> >> > />
>> >> >> >> > 	<import
>> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
>> >> />
>> >> >> >> >
>> >> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
>> >> >> >> >         <jaxrs:serviceBeans>
>> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
>> >> >> >> >         </jaxrs:serviceBeans>
>> >> >> >> >     </jaxrs:server>
>> >> >> >> > </beans>
>> >> >> >> > --------------------
>> >> >> >> >
>> >> >> >> > The "Catalog" class is also very primitive so far:
>> >> >> >> > --------------------------
>> >> >> >> > package com.att.ecom.catalog;
>> >> >> >> >
>> >> >> >> > import java.util.ArrayList;
>> >> >> >> > import java.util.List;
>> >> >> >> >
>> >> >> >> > import javax.ws.rs.GET;
>> >> >> >> > import javax.ws.rs.Path;
>> >> >> >> > import javax.ws.rs.Produces;
>> >> >> >> >
>> >> >> >> > @Path("/catalog/")
>> >> >> >> > @Produces("application/xml")
>> >> >> >> > public class Catalog {
>> >> >> >> >
>> >> >> >> > 	@GET
>> >> >> >> > 	@Path("/items")
>> >> >> >> > 	public List<Item> getItems() {
>> >> >> >> > 		ArrayList<Item>	result	= new
>> >> ArrayList<Item>();
>> >> >> >> > 		result.add(new Item());
>> >> >> >> > 		return (result);
>> >> >> >> > 	}
>> >> >> >> >
>> >> >> >> > 	public static class Item {
>> >> >> >> > 		private String	title;
>> >> >> >> > 		private String  description;
>> >> >> >> >
>> >> >> >> > 		public String getTitle() { return title; }
>> >> >> >> > 		public String getDescription() { return
>> > description;
>> >> }
>> >> >> >> >
>> >> >> >> > 		public void setTitle(String title) { this.title
>> > =
>> >> title;
>> >> >> >> > }
>> >> >> >> > 		public void setDescription(String description) {
>> >> >> >> > this.description = description; }
>> >> >> >> > 	}
>> >> >> >> > }
>> >> >> >> > ----------------------------
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context: http://www.nabble.com/getting-
>> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> >> >> tp25120790p25123056.html
>> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context: http://www.nabble.com/getting-
>> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> >> tp25120790p25132223.html
>> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context: http://www.nabble.com/getting-
>> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> tp25120790p25135192.html
>> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >
>> >
>> >
>> 
>> --
>> View this message in context: http://www.nabble.com/getting-
>> %22NO_RESOURCES_AVAILABLE%22-from-
>> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> tp25120790p25138372.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/getting-%22NO_RESOURCES_AVAILABLE%22-from-%22AbstractJAXRSFactoryBean.checkResources%28%29%22-tp25120790p25141130.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Tuesday, August 25, 2009 10:06 AM
> To: users@cxf.apache.org
> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> 
> is it OSGi that is getting in the way ? Are you using OSGI by any
> chance ?
> That is the only reason I can think of...

The prototype is embedded along with a lot of other code that is
assembled into an EAR with the ATG Dynamo framework.  I'm pretty sure
they're not using OSGi, but the EAR assembly is relatively complex.  I'm
not sure what they could be doing that could possibly mess this up.

> If yes then importing javax.ws.rs.* should fix it....

I assume you mean in the Catalog class?  I'll try it.

> Is it also possible for you to create a simple test project where you
> will
> load catalog class and try to get the @Path annotation on a
> Catalog.getItems() method, without even CXF being involved ?

I'll put that on the list of things to try, but I would be extremely
surprised if that displayed any problem.  It's likely something about my
deployment environment that is causing this.

> KARR, DAVID (ATTCINW) wrote:
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Tuesday, August 25, 2009 7:18 AM
> >> To: users@cxf.apache.org
> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >>
> >> Please add breakpoints to
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> >> its
> >> two setServiceBeans(...) methods. JAXRSServerFactoryBean.create()
is
> >> called
> >> after one of those methods has been called.
> >
> > It hit "setServiceBeans(Object... beans)" with my one Catalog
object.
> >
> > In "getCreatedFromModel(Class<?> realClass)", I noted that
> > "classResourceInfos" was an empty list, so it returned null.  That
> could
> > be irrelevant.
> >
> > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
> > enableStatic)", I saw that when it was processing the "getItem"
> method,
> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned null,
> so
> > it didn't create any class resource info.  It also returned null
from
> > "AnnotationUtils.getMethodAnnotation(annotatedMethod, Path.class)".
> The
> > "getItem()" method has both the "@GET" and "@Path" annotation.
> >
> > Why doesn't it think there are any annotations?
> >
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> >> -----Original Message-----
> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
> >> >> To: users@cxf.apache.org
> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >>
> >> >>
> >> >> I've tried this class & beans.xml in the system tests area,
> Catalog
> >> >> class was
> >> >> recognized.
> >> >>
> >> >> Can you please let me know a bit more about the way you load the
> >> >> (catalog)
> >> >> application ?
> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it a
> >> >> standalone
> >> >> server which explicitly loads the beans.xml ?
> >> >
> >> > I build the application with Ant.  It's deployed to WebLogic 10.
> >> >
> >> > Can you point me to some classes or methods that I could set
> >> breakpoints
> >> > in to try to diagnose why it's not processing the Catalog class?
> >> >
> >> >>
> >> >> thanks, Sergey
> >> >>
> >> >>
> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
> >> >> >> To: users@cxf.apache.org
> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >>
> >> >> >>
> >> >> >> Hi
> >> >> >>
> >> >> >> Everything seems to be ok.
> >> >> >> It appears the problem is to do with a missing import :
> >> >> >>
> >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> >> >> binding.xml" />
> >> >> >>
> >> >> >> can you add it please to your beans.xml ?
> >> >> >>
> >> >> >> For some reasons Catalog class is not introspected. Perhaps
> due
> >> to
> >> >> the
> >> >> >> fact
> >> >> >> the above import is missing and thus no jaxrs-aware spring
> >> factory
> >> >> is
> >> >> >> invoked
> >> >> >
> >> >> > Nope, I'm afraid that didn't help.
> >> >> >
> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-
> >> 2.1.jar,
> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >> >> >
> >> >> > My current XML and Java are this:
> >> >> > -----beans.xml------
> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
> >> >> > 	xsi:schemaLocation="
> >> >> > http://www.springframework.org/schema/beans
> >> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> > http://cxf.apache.org/jaxws
> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> > http://cxf.apache.org/jaxrs
> >> http://cxf.apache.org/schemas/jaxrs.xsd
> >> >> > http://cxf.apache.org/core
> > http://cxf.apache.org/schemascore.xsd">
> >> >> >
> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
> soap.xml"
> >> >> > />
> >> >> > 	<import
resource="classpath:META-INF/cxf/cxf-servlet.xml"
> />
> >> >> >     <import
> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> binding.xml"
> >> />
> >> >> >
> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >> >> >         <jaxrs:features>
> >> >> >             <cxf:logging/>
> >> >> >         </jaxrs:features>
> >> >> >         <jaxrs:serviceBeans>
> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >         </jaxrs:serviceBeans>
> >> >> >     </jaxrs:server>
> >> >> > </beans>
> >> >> > -------------------------
> >> >> > -----Catalog.java-----
> >> >> > package com.att.ecom.catalog;
> >> >> > import java.util.ArrayList;
> >> >> > import java.util.List;
> >> >> > import javax.ws.rs.GET;
> >> >> > import javax.ws.rs.Path;
> >> >> > import javax.ws.rs.PathParam;
> >> >> > import javax.ws.rs.Produces;
> >> >> > import javax.xml.bind.annotation.XmlRootElement;
> >> >> >
> >> >> > @Path("/catalog/")
> >> >> > @Produces("application/xml")
> >> >> > public class Catalog {
> >> >> > 	@GET
> >> >> > 	@Path("/item/{id}")
> >> >> > 	public Item getItem(@PathParam("id") String id) {
> >> >> > 		Item item	= new Item();
> >> >> > 		item.setId(id);
> >> >> > 		item.setTitle("abc");
> >> >> > 		item.setDescription("def");
> >> >> > 		return new Item();
> >> >> > 	}
> >> >> > 	@XmlRootElement(name = "Item")
> >> >> > 	public static class Item {
> >> >> > 		private String	id;
> >> >> > 		private String	title;
> >> >> > 		private String  description;
> >> >> >
> >> >> > 		public String getTitle() { return title; }
> >> >> > 		public String getId() { return id; }
> >> >> > 		public String getDescription() { return
description;
> }
> >> >> >
> >> >> > 		public void setTitle(String title) { this.title
=
> title;
> >> >> > }
> >> >> > 		public void setId(String id) { this.id = id; }
> >> >> > 		public void setDescription(String description) {
> >> >> > this.description = description; }
> >> >> > 	}
> >> >> > }
> >> >> > --------------------
> >> >> >
> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >
> >> >> >> > I'm trying to set up a simple REST prototype running
> alongside
> >> >> some
> >> >> >> > other existing code.
> >> >> >> >
> >> >> >> > When I deploy, I appear to fall into the following "if"
> block
> >> in
> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >> >> >
> >> >> >> > -----------------
> >> >> >> >         if (list.size() == 0) {
> >> >> >> >             org.apache.cxf.common.i18n.Message msg =
> >> >> >> >                 new
> >> >> >> >
org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >> >> >
> > BUNDLE);
> >> >> >> >             LOG.severe(msg.toString());
> >> >> >> >             throw new
> >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
> >> >> >> >         }
> >> >> >> > ---------------
> >> >> >> >
> >> >> >> > This list would be empty if
> >> >> >> "serviceFactory.getRealClassResourceInfo()"
> >> >> >> > returned an empty list.  What exactly would that indicate?
> >> >> >> >
> >> >> >> > My beans.xml is very simple right now, just:
> >> >> >> > -----------------------
> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> > 	xsi:schemaLocation="
> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >
http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> > http://cxf.apache.org/jaxws
> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >> >> >
> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
> >> soap.xml"
> >> >> >> > />
> >> >> >> > 	<import
> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> />
> >> >> >> >
> >> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >     </jaxrs:server>
> >> >> >> > </beans>
> >> >> >> > --------------------
> >> >> >> >
> >> >> >> > The "Catalog" class is also very primitive so far:
> >> >> >> > --------------------------
> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >
> >> >> >> > import java.util.ArrayList;
> >> >> >> > import java.util.List;
> >> >> >> >
> >> >> >> > import javax.ws.rs.GET;
> >> >> >> > import javax.ws.rs.Path;
> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >
> >> >> >> > @Path("/catalog/")
> >> >> >> > @Produces("application/xml")
> >> >> >> > public class Catalog {
> >> >> >> >
> >> >> >> > 	@GET
> >> >> >> > 	@Path("/items")
> >> >> >> > 	public List<Item> getItems() {
> >> >> >> > 		ArrayList<Item>	result	= new
> >> ArrayList<Item>();
> >> >> >> > 		result.add(new Item());
> >> >> >> > 		return (result);
> >> >> >> > 	}
> >> >> >> >
> >> >> >> > 	public static class Item {
> >> >> >> > 		private String	title;
> >> >> >> > 		private String  description;
> >> >> >> >
> >> >> >> > 		public String getTitle() { return title; }
> >> >> >> > 		public String getDescription() { return
> > description;
> >> }
> >> >> >> >
> >> >> >> > 		public void setTitle(String title) { this.title
> > =
> >> title;
> >> >> >> > }
> >> >> >> > 		public void setDescription(String description) {
> >> >> >> > this.description = description; }
> >> >> >> > 	}
> >> >> >> > }
> >> >> >> > ----------------------------
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> tp25120790p25123056.html
> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> tp25120790p25132223.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25135192.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25138372.html
> Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID (ATTCINW)
> Sent: Tuesday, August 25, 2009 10:45 AM
> To: users@cxf.apache.org
> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> > -----Original Message-----
> > From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> > Sent: Tuesday, August 25, 2009 10:06 AM
> > To: users@cxf.apache.org
> > Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> > "AbstractJAXRSFactoryBean.checkResources()"
> >
> >
> > is it OSGi that is getting in the way ? Are you using OSGI by any
> > chance ?
> > That is the only reason I can think of...
> 
> Not that I'd like this to be a permanent solution, but isn't it
> possible
> to configure everything that is being done with annotations in the
> Spring context instead?  I think I saw an example of that somewhere,
> but
> I don't see it in the JAX-RS section of the Apache CXF doc.

I finally noticed the section right at the end of the book titled
"RESTful services without annotations".  The extent of the documentation
for this appears to consist of the single model file example, being
this:

------------------
<model>
 <resource
name="org.apache.cxf.systest.jaxrs.BookStoreNoAnnotationsInterface"
path="bookstore2">
  <operation name="getBook" verb="GET" path="/books/{id}">
   <param name="id" type="PATH"/>
  </operation>
  <operation name="getBookChapter" path="/books/{id}/chapter">
   <param name="id" type="PATH"/>
  </operation>
 </resource>
 <resource name="org.apache.cxf.systest.jaxrs.ChapterNoAnnotations">
  <operation name="getItself" verb="GET"/>
 </resource>
</model>
------------------

Can someone tell me what the "PATH" value on the "type" attributes
signify?  What other possible values are there for that attribute?

> > If yes then importing javax.ws.rs.* should fix it....
> >
> > Is it also possible for you to create a simple test project where
you
> > will
> > load catalog class and try to get the @Path annotation on a
> > Catalog.getItems() method, without even CXF being involved ?
> >
> > cheers, Sergey
> >
> >
> > KARR, DAVID (ATTCINW) wrote:
> > >
> > >> -----Original Message-----
> > >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> > >> Sent: Tuesday, August 25, 2009 7:18 AM
> > >> To: users@cxf.apache.org
> > >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> > >> "AbstractJAXRSFactoryBean.checkResources()"
> > >>
> > >>
> > >> Please add breakpoints to
> > org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> > >> its
> > >> two setServiceBeans(...) methods. JAXRSServerFactoryBean.create()
> is
> > >> called
> > >> after one of those methods has been called.
> > >
> > > It hit "setServiceBeans(Object... beans)" with my one Catalog
> object.
> > >
> > > In "getCreatedFromModel(Class<?> realClass)", I noted that
> > > "classResourceInfos" was an empty list, so it returned null.  That
> > could
> > > be irrelevant.
> > >
> > > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
> > > enableStatic)", I saw that when it was processing the "getItem"
> > method,
> > > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned
> null,
> > so
> > > it didn't create any class resource info.  It also returned null
> from
> > > "AnnotationUtils.getMethodAnnotation(annotatedMethod,
Path.class)".
> > The
> > > "getItem()" method has both the "@GET" and "@Path" annotation.
> > >
> > > Why doesn't it think there are any annotations?
> > >
> > >> KARR, DAVID (ATTCINW) wrote:
> > >> >
> > >> >> -----Original Message-----
> > >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> > >> >> Sent: Tuesday, August 25, 2009 3:54 AM
> > >> >> To: users@cxf.apache.org
> > >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> > >> >> "AbstractJAXRSFactoryBean.checkResources()"
> > >> >>
> > >> >>
> > >> >> I've tried this class & beans.xml in the system tests area,
> > Catalog
> > >> >> class was
> > >> >> recognized.
> > >> >>
> > >> >> Can you please let me know a bit more about the way you load
> the
> > >> >> (catalog)
> > >> >> application ?
> > >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it
a
> > >> >> standalone
> > >> >> server which explicitly loads the beans.xml ?
> > >> >
> > >> > I build the application with Ant.  It's deployed to WebLogic
10.
> > >> >
> > >> > Can you point me to some classes or methods that I could set
> > >> breakpoints
> > >> > in to try to diagnose why it's not processing the Catalog
class?
> > >> >
> > >> >>
> > >> >> thanks, Sergey
> > >> >>
> > >> >>
> > >> >> KARR, DAVID (ATTCINW) wrote:
> > >> >> >
> > >> >> >> -----Original Message-----
> > >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> > >> >> >> Sent: Monday, August 24, 2009 1:13 PM
> > >> >> >> To: users@cxf.apache.org
> > >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> > >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> > >> >> >>
> > >> >> >>
> > >> >> >> Hi
> > >> >> >>
> > >> >> >> Everything seems to be ok.
> > >> >> >> It appears the problem is to do with a missing import :
> > >> >> >>
> > >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-
> jaxrs-
> > >> >> >> binding.xml" />
> > >> >> >>
> > >> >> >> can you add it please to your beans.xml ?
> > >> >> >>
> > >> >> >> For some reasons Catalog class is not introspected. Perhaps
> > due
> > >> to
> > >> >> the
> > >> >> >> fact
> > >> >> >> the above import is missing and thus no jaxrs-aware spring
> > >> factory
> > >> >> is
> > >> >> >> invoked
> > >> >> >
> > >> >> > Nope, I'm afraid that didn't help.
> > >> >> >
> > >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-
> > >> 2.1.jar,
> > >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> > >> >> >
> > >> >> > My current XML and Java are this:
> > >> >> > -----beans.xml------
> > >> >> > <?xml version="1.0" encoding="UTF-8"?>
> > >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> > >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> > >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> > >> >> >     xmlns:cxf="http://cxf.apache.org/core"
> > >> >> > 	xsi:schemaLocation="
> > >> >> > http://www.springframework.org/schema/beans
> > >> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> > >> >> > http://cxf.apache.org/jaxws
> > >> http://cxf.apache.org/schemas/jaxws.xsd
> > >> >> > http://cxf.apache.org/jaxrs
> > >> http://cxf.apache.org/schemas/jaxrs.xsd
> > >> >> > http://cxf.apache.org/core
> > > http://cxf.apache.org/schemascore.xsd">
> > >> >> >
> > >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> > >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
> > soap.xml"
> > >> >> > />
> > >> >> > 	<import
> resource="classpath:META-INF/cxf/cxf-servlet.xml"
> > />
> > >> >> >     <import
> > >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> > binding.xml"
> > >> />
> > >> >> >
> > >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> > >> >> >         <jaxrs:features>
> > >> >> >             <cxf:logging/>
> > >> >> >         </jaxrs:features>
> > >> >> >         <jaxrs:serviceBeans>
> > >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> > >> >> >         </jaxrs:serviceBeans>
> > >> >> >     </jaxrs:server>
> > >> >> > </beans>
> > >> >> > -------------------------
> > >> >> > -----Catalog.java-----
> > >> >> > package com.att.ecom.catalog;
> > >> >> > import java.util.ArrayList;
> > >> >> > import java.util.List;
> > >> >> > import javax.ws.rs.GET;
> > >> >> > import javax.ws.rs.Path;
> > >> >> > import javax.ws.rs.PathParam;
> > >> >> > import javax.ws.rs.Produces;
> > >> >> > import javax.xml.bind.annotation.XmlRootElement;
> > >> >> >
> > >> >> > @Path("/catalog/")
> > >> >> > @Produces("application/xml")
> > >> >> > public class Catalog {
> > >> >> > 	@GET
> > >> >> > 	@Path("/item/{id}")
> > >> >> > 	public Item getItem(@PathParam("id") String id) {
> > >> >> > 		Item item	= new Item();
> > >> >> > 		item.setId(id);
> > >> >> > 		item.setTitle("abc");
> > >> >> > 		item.setDescription("def");
> > >> >> > 		return new Item();
> > >> >> > 	}
> > >> >> > 	@XmlRootElement(name = "Item")
> > >> >> > 	public static class Item {
> > >> >> > 		private String	id;
> > >> >> > 		private String	title;
> > >> >> > 		private String  description;
> > >> >> >
> > >> >> > 		public String getTitle() { return title; }
> > >> >> > 		public String getId() { return id; }
> > >> >> > 		public String getDescription() { return
> description;
> > }
> > >> >> >
> > >> >> > 		public void setTitle(String title) { this.title
> =
> > title;
> > >> >> > }
> > >> >> > 		public void setId(String id) { this.id = id; }
> > >> >> > 		public void setDescription(String description) {
> > >> >> > this.description = description; }
> > >> >> > 	}
> > >> >> > }
> > >> >> > --------------------
> > >> >> >
> > >> >> >> KARR, DAVID (ATTCINW) wrote:
> > >> >> >> >
> > >> >> >> > I'm trying to set up a simple REST prototype running
> > alongside
> > >> >> some
> > >> >> >> > other existing code.
> > >> >> >> >
> > >> >> >> > When I deploy, I appear to fall into the following "if"
> > block
> > >> in
> > >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> > >> >> >> >
> > >> >> >> > -----------------
> > >> >> >> >         if (list.size() == 0) {
> > >> >> >> >             org.apache.cxf.common.i18n.Message msg =
> > >> >> >> >                 new
> > >> >> >> >
> org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> > >> >> >> >
> > > BUNDLE);
> > >> >> >> >             LOG.severe(msg.toString());
> > >> >> >> >             throw new
> > >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
> > >> >> >> >         }
> > >> >> >> > ---------------
> > >> >> >> >
> > >> >> >> > This list would be empty if
> > >> >> >> "serviceFactory.getRealClassResourceInfo()"
> > >> >> >> > returned an empty list.  What exactly would that
indicate?
> > >> >> >> >
> > >> >> >> > My beans.xml is very simple right now, just:
> > >> >> >> > -----------------------
> > >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> > >> >> >> > <beans
xmlns="http://www.springframework.org/schema/beans"
> > >> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> > >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> > >> >> >> > 	xsi:schemaLocation="
> > >> >> >> > http://www.springframework.org/schema/beans
> > >> >> >> >
> http://www.springframework.org/schema/beans/spring-beans.xsd
> > >> >> >> > http://cxf.apache.org/jaxws
> > >> >> http://cxf.apache.org/schemas/jaxws.xsd
> > >> >> >> > http://cxf.apache.org/jaxrs
> > >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> > >> >> >> >
> > >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> > >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-
> extension-
> > >> soap.xml"
> > >> >> >> > />
> > >> >> >> > 	<import
> > > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> > >> />
> > >> >> >> >
> > >> >> >> >     <jaxrs:server name="restcatalogserver"
> address="/rest">
> > >> >> >> >         <jaxrs:serviceBeans>
> > >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> > >> >> >> >         </jaxrs:serviceBeans>
> > >> >> >> >     </jaxrs:server>
> > >> >> >> > </beans>
> > >> >> >> > --------------------
> > >> >> >> >
> > >> >> >> > The "Catalog" class is also very primitive so far:
> > >> >> >> > --------------------------
> > >> >> >> > package com.att.ecom.catalog;
> > >> >> >> >
> > >> >> >> > import java.util.ArrayList;
> > >> >> >> > import java.util.List;
> > >> >> >> >
> > >> >> >> > import javax.ws.rs.GET;
> > >> >> >> > import javax.ws.rs.Path;
> > >> >> >> > import javax.ws.rs.Produces;
> > >> >> >> >
> > >> >> >> > @Path("/catalog/")
> > >> >> >> > @Produces("application/xml")
> > >> >> >> > public class Catalog {
> > >> >> >> >
> > >> >> >> > 	@GET
> > >> >> >> > 	@Path("/items")
> > >> >> >> > 	public List<Item> getItems() {
> > >> >> >> > 		ArrayList<Item>	result	= new
> > >> ArrayList<Item>();
> > >> >> >> > 		result.add(new Item());
> > >> >> >> > 		return (result);
> > >> >> >> > 	}
> > >> >> >> >
> > >> >> >> > 	public static class Item {
> > >> >> >> > 		private String	title;
> > >> >> >> > 		private String  description;
> > >> >> >> >
> > >> >> >> > 		public String getTitle() { return title; }
> > >> >> >> > 		public String getDescription() { return
> > > description;
> > >> }
> > >> >> >> >
> > >> >> >> > 		public void setTitle(String title) { this.title
> > > =
> > >> title;
> > >> >> >> > }
> > >> >> >> > 		public void setDescription(String description)
> {
> > >> >> >> > this.description = description; }
> > >> >> >> > 	}
> > >> >> >> > }
> > >> >> >> > ----------------------------
> > >> >> >> >
> > >> >> >> >
> > >> >> >>
> > >> >> >> --
> > >> >> >> View this message in context:
http://www.nabble.com/getting-
> > >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> > >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> > >> >> >> tp25120790p25123056.html
> > >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> > >> >> >
> > >> >> >
> > >> >> >
> > >> >>
> > >> >> --
> > >> >> View this message in context: http://www.nabble.com/getting-
> > >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> > >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> > >> >> tp25120790p25132223.html
> > >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> > >> >
> > >> >
> > >> >
> > >>
> > >> --
> > >> View this message in context: http://www.nabble.com/getting-
> > >> %22NO_RESOURCES_AVAILABLE%22-from-
> > >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> > >> tp25120790p25135192.html
> > >> Sent from the cxf-user mailing list archive at Nabble.com.
> > >
> > >
> > >
> >
> > --
> > View this message in context: http://www.nabble.com/getting-
> > %22NO_RESOURCES_AVAILABLE%22-from-
> > %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> > tp25120790p25138372.html
> > Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Tuesday, August 25, 2009 10:06 AM
> To: users@cxf.apache.org
> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> 
> is it OSGi that is getting in the way ? Are you using OSGI by any
> chance ?
> That is the only reason I can think of...

Not that I'd like this to be a permanent solution, but isn't it possible
to configure everything that is being done with annotations in the
Spring context instead?  I think I saw an example of that somewhere, but
I don't see it in the JAX-RS section of the Apache CXF doc.

> If yes then importing javax.ws.rs.* should fix it....
> 
> Is it also possible for you to create a simple test project where you
> will
> load catalog class and try to get the @Path annotation on a
> Catalog.getItems() method, without even CXF being involved ?
> 
> cheers, Sergey
> 
> 
> KARR, DAVID (ATTCINW) wrote:
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Tuesday, August 25, 2009 7:18 AM
> >> To: users@cxf.apache.org
> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >>
> >> Please add breakpoints to
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> >> its
> >> two setServiceBeans(...) methods. JAXRSServerFactoryBean.create()
is
> >> called
> >> after one of those methods has been called.
> >
> > It hit "setServiceBeans(Object... beans)" with my one Catalog
object.
> >
> > In "getCreatedFromModel(Class<?> realClass)", I noted that
> > "classResourceInfos" was an empty list, so it returned null.  That
> could
> > be irrelevant.
> >
> > Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
> > enableStatic)", I saw that when it was processing the "getItem"
> method,
> > "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned null,
> so
> > it didn't create any class resource info.  It also returned null
from
> > "AnnotationUtils.getMethodAnnotation(annotatedMethod, Path.class)".
> The
> > "getItem()" method has both the "@GET" and "@Path" annotation.
> >
> > Why doesn't it think there are any annotations?
> >
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> >> -----Original Message-----
> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> Sent: Tuesday, August 25, 2009 3:54 AM
> >> >> To: users@cxf.apache.org
> >> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >>
> >> >>
> >> >> I've tried this class & beans.xml in the system tests area,
> Catalog
> >> >> class was
> >> >> recognized.
> >> >>
> >> >> Can you please let me know a bit more about the way you load the
> >> >> (catalog)
> >> >> application ?
> >> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it a
> >> >> standalone
> >> >> server which explicitly loads the beans.xml ?
> >> >
> >> > I build the application with Ant.  It's deployed to WebLogic 10.
> >> >
> >> > Can you point me to some classes or methods that I could set
> >> breakpoints
> >> > in to try to diagnose why it's not processing the Catalog class?
> >> >
> >> >>
> >> >> thanks, Sergey
> >> >>
> >> >>
> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> >> Sent: Monday, August 24, 2009 1:13 PM
> >> >> >> To: users@cxf.apache.org
> >> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >> >>
> >> >> >>
> >> >> >> Hi
> >> >> >>
> >> >> >> Everything seems to be ok.
> >> >> >> It appears the problem is to do with a missing import :
> >> >> >>
> >> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> >> >> binding.xml" />
> >> >> >>
> >> >> >> can you add it please to your beans.xml ?
> >> >> >>
> >> >> >> For some reasons Catalog class is not introspected. Perhaps
> due
> >> to
> >> >> the
> >> >> >> fact
> >> >> >> the above import is missing and thus no jaxrs-aware spring
> >> factory
> >> >> is
> >> >> >> invoked
> >> >> >
> >> >> > Nope, I'm afraid that didn't help.
> >> >> >
> >> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-
> >> 2.1.jar,
> >> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >> >> >
> >> >> > My current XML and Java are this:
> >> >> > -----beans.xml------
> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >     xmlns:cxf="http://cxf.apache.org/core"
> >> >> > 	xsi:schemaLocation="
> >> >> > http://www.springframework.org/schema/beans
> >> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> > http://cxf.apache.org/jaxws
> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> > http://cxf.apache.org/jaxrs
> >> http://cxf.apache.org/schemas/jaxrs.xsd
> >> >> > http://cxf.apache.org/core
> > http://cxf.apache.org/schemascore.xsd">
> >> >> >
> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
> soap.xml"
> >> >> > />
> >> >> > 	<import
resource="classpath:META-INF/cxf/cxf-servlet.xml"
> />
> >> >> >     <import
> >> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> binding.xml"
> >> />
> >> >> >
> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >> >> >         <jaxrs:features>
> >> >> >             <cxf:logging/>
> >> >> >         </jaxrs:features>
> >> >> >         <jaxrs:serviceBeans>
> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >         </jaxrs:serviceBeans>
> >> >> >     </jaxrs:server>
> >> >> > </beans>
> >> >> > -------------------------
> >> >> > -----Catalog.java-----
> >> >> > package com.att.ecom.catalog;
> >> >> > import java.util.ArrayList;
> >> >> > import java.util.List;
> >> >> > import javax.ws.rs.GET;
> >> >> > import javax.ws.rs.Path;
> >> >> > import javax.ws.rs.PathParam;
> >> >> > import javax.ws.rs.Produces;
> >> >> > import javax.xml.bind.annotation.XmlRootElement;
> >> >> >
> >> >> > @Path("/catalog/")
> >> >> > @Produces("application/xml")
> >> >> > public class Catalog {
> >> >> > 	@GET
> >> >> > 	@Path("/item/{id}")
> >> >> > 	public Item getItem(@PathParam("id") String id) {
> >> >> > 		Item item	= new Item();
> >> >> > 		item.setId(id);
> >> >> > 		item.setTitle("abc");
> >> >> > 		item.setDescription("def");
> >> >> > 		return new Item();
> >> >> > 	}
> >> >> > 	@XmlRootElement(name = "Item")
> >> >> > 	public static class Item {
> >> >> > 		private String	id;
> >> >> > 		private String	title;
> >> >> > 		private String  description;
> >> >> >
> >> >> > 		public String getTitle() { return title; }
> >> >> > 		public String getId() { return id; }
> >> >> > 		public String getDescription() { return
description;
> }
> >> >> >
> >> >> > 		public void setTitle(String title) { this.title
=
> title;
> >> >> > }
> >> >> > 		public void setId(String id) { this.id = id; }
> >> >> > 		public void setDescription(String description) {
> >> >> > this.description = description; }
> >> >> > 	}
> >> >> > }
> >> >> > --------------------
> >> >> >
> >> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >> >
> >> >> >> > I'm trying to set up a simple REST prototype running
> alongside
> >> >> some
> >> >> >> > other existing code.
> >> >> >> >
> >> >> >> > When I deploy, I appear to fall into the following "if"
> block
> >> in
> >> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >> >> >
> >> >> >> > -----------------
> >> >> >> >         if (list.size() == 0) {
> >> >> >> >             org.apache.cxf.common.i18n.Message msg =
> >> >> >> >                 new
> >> >> >> >
org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >> >> >
> > BUNDLE);
> >> >> >> >             LOG.severe(msg.toString());
> >> >> >> >             throw new
> >> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
> >> >> >> >         }
> >> >> >> > ---------------
> >> >> >> >
> >> >> >> > This list would be empty if
> >> >> >> "serviceFactory.getRealClassResourceInfo()"
> >> >> >> > returned an empty list.  What exactly would that indicate?
> >> >> >> >
> >> >> >> > My beans.xml is very simple right now, just:
> >> >> >> > -----------------------
> >> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> >> > 	xsi:schemaLocation="
> >> >> >> > http://www.springframework.org/schema/beans
> >> >> >> >
http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> >> > http://cxf.apache.org/jaxws
> >> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> >> > http://cxf.apache.org/jaxrs
> >> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >> >> >
> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
> >> soap.xml"
> >> >> >> > />
> >> >> >> > 	<import
> > resource="classpath:META-INF/cxf/cxf-servlet.xml"
> >> />
> >> >> >> >
> >> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >> >> >> >         <jaxrs:serviceBeans>
> >> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >> >         </jaxrs:serviceBeans>
> >> >> >> >     </jaxrs:server>
> >> >> >> > </beans>
> >> >> >> > --------------------
> >> >> >> >
> >> >> >> > The "Catalog" class is also very primitive so far:
> >> >> >> > --------------------------
> >> >> >> > package com.att.ecom.catalog;
> >> >> >> >
> >> >> >> > import java.util.ArrayList;
> >> >> >> > import java.util.List;
> >> >> >> >
> >> >> >> > import javax.ws.rs.GET;
> >> >> >> > import javax.ws.rs.Path;
> >> >> >> > import javax.ws.rs.Produces;
> >> >> >> >
> >> >> >> > @Path("/catalog/")
> >> >> >> > @Produces("application/xml")
> >> >> >> > public class Catalog {
> >> >> >> >
> >> >> >> > 	@GET
> >> >> >> > 	@Path("/items")
> >> >> >> > 	public List<Item> getItems() {
> >> >> >> > 		ArrayList<Item>	result	= new
> >> ArrayList<Item>();
> >> >> >> > 		result.add(new Item());
> >> >> >> > 		return (result);
> >> >> >> > 	}
> >> >> >> >
> >> >> >> > 	public static class Item {
> >> >> >> > 		private String	title;
> >> >> >> > 		private String  description;
> >> >> >> >
> >> >> >> > 		public String getTitle() { return title; }
> >> >> >> > 		public String getDescription() { return
> > description;
> >> }
> >> >> >> >
> >> >> >> > 		public void setTitle(String title) { this.title
> > =
> >> title;
> >> >> >> > }
> >> >> >> > 		public void setDescription(String description) {
> >> >> >> > this.description = description; }
> >> >> >> > 	}
> >> >> >> > }
> >> >> >> > ----------------------------
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> >> tp25120790p25123056.html
> >> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> tp25120790p25132223.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25135192.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25138372.html
> Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <se...@iona.com>.
is it OSGi that is getting in the way ? Are you using OSGI by any chance ?
That is the only reason I can think of...
If yes then importing javax.ws.rs.* should fix it....

Is it also possible for you to create a simple test project where you will
load catalog class and try to get the @Path annotation on a
Catalog.getItems() method, without even CXF being involved ?

cheers, Sergey


KARR, DAVID (ATTCINW) wrote:
> 
>> -----Original Message-----
>> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> Sent: Tuesday, August 25, 2009 7:18 AM
>> To: users@cxf.apache.org
>> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> "AbstractJAXRSFactoryBean.checkResources()"
>> 
>> 
>> Please add breakpoints to org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
>> its
>> two setServiceBeans(...) methods. JAXRSServerFactoryBean.create() is
>> called
>> after one of those methods has been called.
> 
> It hit "setServiceBeans(Object... beans)" with my one Catalog object.
> 
> In "getCreatedFromModel(Class<?> realClass)", I noted that
> "classResourceInfos" was an empty list, so it returned null.  That could
> be irrelevant.
> 
> Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
> enableStatic)", I saw that when it was processing the "getItem" method,
> "AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned null, so
> it didn't create any class resource info.  It also returned null from
> "AnnotationUtils.getMethodAnnotation(annotatedMethod, Path.class)".  The
> "getItem()" method has both the "@GET" and "@Path" annotation.
> 
> Why doesn't it think there are any annotations?
> 
>> KARR, DAVID (ATTCINW) wrote:
>> >
>> >> -----Original Message-----
>> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> Sent: Tuesday, August 25, 2009 3:54 AM
>> >> To: users@cxf.apache.org
>> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >>
>> >>
>> >> I've tried this class & beans.xml in the system tests area, Catalog
>> >> class was
>> >> recognized.
>> >>
>> >> Can you please let me know a bit more about the way you load the
>> >> (catalog)
>> >> application ?
>> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it a
>> >> standalone
>> >> server which explicitly loads the beans.xml ?
>> >
>> > I build the application with Ant.  It's deployed to WebLogic 10.
>> >
>> > Can you point me to some classes or methods that I could set
>> breakpoints
>> > in to try to diagnose why it's not processing the Catalog class?
>> >
>> >>
>> >> thanks, Sergey
>> >>
>> >>
>> >> KARR, DAVID (ATTCINW) wrote:
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> >> Sent: Monday, August 24, 2009 1:13 PM
>> >> >> To: users@cxf.apache.org
>> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
>> >> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >> >>
>> >> >>
>> >> >> Hi
>> >> >>
>> >> >> Everything seems to be ok.
>> >> >> It appears the problem is to do with a missing import :
>> >> >>
>> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>> >> >> binding.xml" />
>> >> >>
>> >> >> can you add it please to your beans.xml ?
>> >> >>
>> >> >> For some reasons Catalog class is not introspected. Perhaps due
>> to
>> >> the
>> >> >> fact
>> >> >> the above import is missing and thus no jaxrs-aware spring
>> factory
>> >> is
>> >> >> invoked
>> >> >
>> >> > Nope, I'm afraid that didn't help.
>> >> >
>> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-
>> 2.1.jar,
>> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
>> >> >
>> >> > My current XML and Java are this:
>> >> > -----beans.xml------
>> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> >> >     xmlns:cxf="http://cxf.apache.org/core"
>> >> > 	xsi:schemaLocation="
>> >> > http://www.springframework.org/schema/beans
>> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> >> > http://cxf.apache.org/jaxws
>> http://cxf.apache.org/schemas/jaxws.xsd
>> >> > http://cxf.apache.org/jaxrs
>> http://cxf.apache.org/schemas/jaxrs.xsd
>> >> > http://cxf.apache.org/core
> http://cxf.apache.org/schemascore.xsd">
>> >> >
>> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
>> >> > />
>> >> > 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> >> >     <import
>> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"
>> />
>> >> >
>> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
>> >> >         <jaxrs:features>
>> >> >             <cxf:logging/>
>> >> >         </jaxrs:features>
>> >> >         <jaxrs:serviceBeans>
>> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
>> >> >         </jaxrs:serviceBeans>
>> >> >     </jaxrs:server>
>> >> > </beans>
>> >> > -------------------------
>> >> > -----Catalog.java-----
>> >> > package com.att.ecom.catalog;
>> >> > import java.util.ArrayList;
>> >> > import java.util.List;
>> >> > import javax.ws.rs.GET;
>> >> > import javax.ws.rs.Path;
>> >> > import javax.ws.rs.PathParam;
>> >> > import javax.ws.rs.Produces;
>> >> > import javax.xml.bind.annotation.XmlRootElement;
>> >> >
>> >> > @Path("/catalog/")
>> >> > @Produces("application/xml")
>> >> > public class Catalog {
>> >> > 	@GET
>> >> > 	@Path("/item/{id}")
>> >> > 	public Item getItem(@PathParam("id") String id) {
>> >> > 		Item item	= new Item();
>> >> > 		item.setId(id);
>> >> > 		item.setTitle("abc");
>> >> > 		item.setDescription("def");
>> >> > 		return new Item();
>> >> > 	}
>> >> > 	@XmlRootElement(name = "Item")
>> >> > 	public static class Item {
>> >> > 		private String	id;
>> >> > 		private String	title;
>> >> > 		private String  description;
>> >> >
>> >> > 		public String getTitle() { return title; }
>> >> > 		public String getId() { return id; }
>> >> > 		public String getDescription() { return description; }
>> >> >
>> >> > 		public void setTitle(String title) { this.title = title;
>> >> > }
>> >> > 		public void setId(String id) { this.id = id; }
>> >> > 		public void setDescription(String description) {
>> >> > this.description = description; }
>> >> > 	}
>> >> > }
>> >> > --------------------
>> >> >
>> >> >> KARR, DAVID (ATTCINW) wrote:
>> >> >> >
>> >> >> > I'm trying to set up a simple REST prototype running alongside
>> >> some
>> >> >> > other existing code.
>> >> >> >
>> >> >> > When I deploy, I appear to fall into the following "if" block
>> in
>> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
>> >> >> >
>> >> >> > -----------------
>> >> >> >         if (list.size() == 0) {
>> >> >> >             org.apache.cxf.common.i18n.Message msg =
>> >> >> >                 new
>> >> >> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
>> >> >> >
> BUNDLE);
>> >> >> >             LOG.severe(msg.toString());
>> >> >> >             throw new
>> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
>> >> >> >         }
>> >> >> > ---------------
>> >> >> >
>> >> >> > This list would be empty if
>> >> >> "serviceFactory.getRealClassResourceInfo()"
>> >> >> > returned an empty list.  What exactly would that indicate?
>> >> >> >
>> >> >> > My beans.xml is very simple right now, just:
>> >> >> > -----------------------
>> >> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> >> >> > 	xsi:schemaLocation="
>> >> >> > http://www.springframework.org/schema/beans
>> >> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> >> >> > http://cxf.apache.org/jaxws
>> >> http://cxf.apache.org/schemas/jaxws.xsd
>> >> >> > http://cxf.apache.org/jaxrs
>> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
>> >> >> >
>> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
>> soap.xml"
>> >> >> > />
>> >> >> > 	<import
> resource="classpath:META-INF/cxf/cxf-servlet.xml"
>> />
>> >> >> >
>> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
>> >> >> >         <jaxrs:serviceBeans>
>> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
>> >> >> >         </jaxrs:serviceBeans>
>> >> >> >     </jaxrs:server>
>> >> >> > </beans>
>> >> >> > --------------------
>> >> >> >
>> >> >> > The "Catalog" class is also very primitive so far:
>> >> >> > --------------------------
>> >> >> > package com.att.ecom.catalog;
>> >> >> >
>> >> >> > import java.util.ArrayList;
>> >> >> > import java.util.List;
>> >> >> >
>> >> >> > import javax.ws.rs.GET;
>> >> >> > import javax.ws.rs.Path;
>> >> >> > import javax.ws.rs.Produces;
>> >> >> >
>> >> >> > @Path("/catalog/")
>> >> >> > @Produces("application/xml")
>> >> >> > public class Catalog {
>> >> >> >
>> >> >> > 	@GET
>> >> >> > 	@Path("/items")
>> >> >> > 	public List<Item> getItems() {
>> >> >> > 		ArrayList<Item>	result	= new
>> ArrayList<Item>();
>> >> >> > 		result.add(new Item());
>> >> >> > 		return (result);
>> >> >> > 	}
>> >> >> >
>> >> >> > 	public static class Item {
>> >> >> > 		private String	title;
>> >> >> > 		private String  description;
>> >> >> >
>> >> >> > 		public String getTitle() { return title; }
>> >> >> > 		public String getDescription() { return
> description;
>> }
>> >> >> >
>> >> >> > 		public void setTitle(String title) { this.title
> =
>> title;
>> >> >> > }
>> >> >> > 		public void setDescription(String description) {
>> >> >> > this.description = description; }
>> >> >> > 	}
>> >> >> > }
>> >> >> > ----------------------------
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context: http://www.nabble.com/getting-
>> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> >> tp25120790p25123056.html
>> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context: http://www.nabble.com/getting-
>> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> tp25120790p25132223.html
>> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >
>> >
>> >
>> 
>> --
>> View this message in context: http://www.nabble.com/getting-
>> %22NO_RESOURCES_AVAILABLE%22-from-
>> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> tp25120790p25135192.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/getting-%22NO_RESOURCES_AVAILABLE%22-from-%22AbstractJAXRSFactoryBean.checkResources%28%29%22-tp25120790p25138372.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Tuesday, August 25, 2009 7:18 AM
> To: users@cxf.apache.org
> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> 
> Please add breakpoints to org.apache.cxf.jaxrs.JAXRSServerFactoryBean,
> its
> two setServiceBeans(...) methods. JAXRSServerFactoryBean.create() is
> called
> after one of those methods has been called.

It hit "setServiceBeans(Object... beans)" with my one Catalog object.

In "getCreatedFromModel(Class<?> realClass)", I noted that
"classResourceInfos" was an empty list, so it returned null.  That could
be irrelevant.

Then, in "evaluateResourceClass(ClassResourceInfo cri, boolean
enableStatic)", I saw that when it was processing the "getItem" method,
"AnnotationUtils.getHttpMethodValue(annotatedMethod)" returned null, so
it didn't create any class resource info.  It also returned null from
"AnnotationUtils.getMethodAnnotation(annotatedMethod, Path.class)".  The
"getItem()" method has both the "@GET" and "@Path" annotation.

Why doesn't it think there are any annotations?

> KARR, DAVID (ATTCINW) wrote:
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Tuesday, August 25, 2009 3:54 AM
> >> To: users@cxf.apache.org
> >> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >>
> >> I've tried this class & beans.xml in the system tests area, Catalog
> >> class was
> >> recognized.
> >>
> >> Can you please let me know a bit more about the way you load the
> >> (catalog)
> >> application ?
> >> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it a
> >> standalone
> >> server which explicitly loads the beans.xml ?
> >
> > I build the application with Ant.  It's deployed to WebLogic 10.
> >
> > Can you point me to some classes or methods that I could set
> breakpoints
> > in to try to diagnose why it's not processing the Catalog class?
> >
> >>
> >> thanks, Sergey
> >>
> >>
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> >> -----Original Message-----
> >> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> >> Sent: Monday, August 24, 2009 1:13 PM
> >> >> To: users@cxf.apache.org
> >> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> >> "AbstractJAXRSFactoryBean.checkResources()"
> >> >>
> >> >>
> >> >> Hi
> >> >>
> >> >> Everything seems to be ok.
> >> >> It appears the problem is to do with a missing import :
> >> >>
> >> >> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> >> binding.xml" />
> >> >>
> >> >> can you add it please to your beans.xml ?
> >> >>
> >> >> For some reasons Catalog class is not introspected. Perhaps due
> to
> >> the
> >> >> fact
> >> >> the above import is missing and thus no jaxrs-aware spring
> factory
> >> is
> >> >> invoked
> >> >
> >> > Nope, I'm afraid that didn't help.
> >> >
> >> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-
> 2.1.jar,
> >> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >> >
> >> > My current XML and Java are this:
> >> > -----beans.xml------
> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >     xmlns:cxf="http://cxf.apache.org/core"
> >> > 	xsi:schemaLocation="
> >> > http://www.springframework.org/schema/beans
> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> > http://cxf.apache.org/jaxws
> http://cxf.apache.org/schemas/jaxws.xsd
> >> > http://cxf.apache.org/jaxrs
> http://cxf.apache.org/schemas/jaxrs.xsd
> >> > http://cxf.apache.org/core
http://cxf.apache.org/schemascore.xsd">
> >> >
> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
> >> > />
> >> > 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> >> >     <import
> >> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"
> />
> >> >
> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >> >         <jaxrs:features>
> >> >             <cxf:logging/>
> >> >         </jaxrs:features>
> >> >         <jaxrs:serviceBeans>
> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >         </jaxrs:serviceBeans>
> >> >     </jaxrs:server>
> >> > </beans>
> >> > -------------------------
> >> > -----Catalog.java-----
> >> > package com.att.ecom.catalog;
> >> > import java.util.ArrayList;
> >> > import java.util.List;
> >> > import javax.ws.rs.GET;
> >> > import javax.ws.rs.Path;
> >> > import javax.ws.rs.PathParam;
> >> > import javax.ws.rs.Produces;
> >> > import javax.xml.bind.annotation.XmlRootElement;
> >> >
> >> > @Path("/catalog/")
> >> > @Produces("application/xml")
> >> > public class Catalog {
> >> > 	@GET
> >> > 	@Path("/item/{id}")
> >> > 	public Item getItem(@PathParam("id") String id) {
> >> > 		Item item	= new Item();
> >> > 		item.setId(id);
> >> > 		item.setTitle("abc");
> >> > 		item.setDescription("def");
> >> > 		return new Item();
> >> > 	}
> >> > 	@XmlRootElement(name = "Item")
> >> > 	public static class Item {
> >> > 		private String	id;
> >> > 		private String	title;
> >> > 		private String  description;
> >> >
> >> > 		public String getTitle() { return title; }
> >> > 		public String getId() { return id; }
> >> > 		public String getDescription() { return description; }
> >> >
> >> > 		public void setTitle(String title) { this.title = title;
> >> > }
> >> > 		public void setId(String id) { this.id = id; }
> >> > 		public void setDescription(String description) {
> >> > this.description = description; }
> >> > 	}
> >> > }
> >> > --------------------
> >> >
> >> >> KARR, DAVID (ATTCINW) wrote:
> >> >> >
> >> >> > I'm trying to set up a simple REST prototype running alongside
> >> some
> >> >> > other existing code.
> >> >> >
> >> >> > When I deploy, I appear to fall into the following "if" block
> in
> >> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >> >
> >> >> > -----------------
> >> >> >         if (list.size() == 0) {
> >> >> >             org.apache.cxf.common.i18n.Message msg =
> >> >> >                 new
> >> >> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >> >
BUNDLE);
> >> >> >             LOG.severe(msg.toString());
> >> >> >             throw new
> >> >> > WebApplicationException(Response.Status.NOT_FOUND);
> >> >> >         }
> >> >> > ---------------
> >> >> >
> >> >> > This list would be empty if
> >> >> "serviceFactory.getRealClassResourceInfo()"
> >> >> > returned an empty list.  What exactly would that indicate?
> >> >> >
> >> >> > My beans.xml is very simple right now, just:
> >> >> > -----------------------
> >> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> >> > 	xsi:schemaLocation="
> >> >> > http://www.springframework.org/schema/beans
> >> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> >> > http://cxf.apache.org/jaxws
> >> http://cxf.apache.org/schemas/jaxws.xsd
> >> >> > http://cxf.apache.org/jaxrs
> >> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >> >
> >> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-
> soap.xml"
> >> >> > />
> >> >> > 	<import
resource="classpath:META-INF/cxf/cxf-servlet.xml"
> />
> >> >> >
> >> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >> >> >         <jaxrs:serviceBeans>
> >> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >> >         </jaxrs:serviceBeans>
> >> >> >     </jaxrs:server>
> >> >> > </beans>
> >> >> > --------------------
> >> >> >
> >> >> > The "Catalog" class is also very primitive so far:
> >> >> > --------------------------
> >> >> > package com.att.ecom.catalog;
> >> >> >
> >> >> > import java.util.ArrayList;
> >> >> > import java.util.List;
> >> >> >
> >> >> > import javax.ws.rs.GET;
> >> >> > import javax.ws.rs.Path;
> >> >> > import javax.ws.rs.Produces;
> >> >> >
> >> >> > @Path("/catalog/")
> >> >> > @Produces("application/xml")
> >> >> > public class Catalog {
> >> >> >
> >> >> > 	@GET
> >> >> > 	@Path("/items")
> >> >> > 	public List<Item> getItems() {
> >> >> > 		ArrayList<Item>	result	= new
> ArrayList<Item>();
> >> >> > 		result.add(new Item());
> >> >> > 		return (result);
> >> >> > 	}
> >> >> >
> >> >> > 	public static class Item {
> >> >> > 		private String	title;
> >> >> > 		private String  description;
> >> >> >
> >> >> > 		public String getTitle() { return title; }
> >> >> > 		public String getDescription() { return
description;
> }
> >> >> >
> >> >> > 		public void setTitle(String title) { this.title
=
> title;
> >> >> > }
> >> >> > 		public void setDescription(String description) {
> >> >> > this.description = description; }
> >> >> > 	}
> >> >> > }
> >> >> > ----------------------------
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context: http://www.nabble.com/getting-
> >> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> >> tp25120790p25123056.html
> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25132223.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25135192.html
> Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <se...@iona.com>.
Please add breakpoints to org.apache.cxf.jaxrs.JAXRSServerFactoryBean, its
two setServiceBeans(...) methods. JAXRSServerFactoryBean.create() is called
after one of those methods has been called. 

thanks, Sergey


KARR, DAVID (ATTCINW) wrote:
> 
>> -----Original Message-----
>> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> Sent: Tuesday, August 25, 2009 3:54 AM
>> To: users@cxf.apache.org
>> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
>> "AbstractJAXRSFactoryBean.checkResources()"
>> 
>> 
>> I've tried this class & beans.xml in the system tests area, Catalog
>> class was
>> recognized.
>> 
>> Can you please let me know a bit more about the way you load the
>> (catalog)
>> application ?
>> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it a
>> standalone
>> server which explicitly loads the beans.xml ?
> 
> I build the application with Ant.  It's deployed to WebLogic 10.
> 
> Can you point me to some classes or methods that I could set breakpoints
> in to try to diagnose why it's not processing the Catalog class?
> 
>> 
>> thanks, Sergey
>> 
>> 
>> KARR, DAVID (ATTCINW) wrote:
>> >
>> >> -----Original Message-----
>> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> >> Sent: Monday, August 24, 2009 1:13 PM
>> >> To: users@cxf.apache.org
>> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
>> >> "AbstractJAXRSFactoryBean.checkResources()"
>> >>
>> >>
>> >> Hi
>> >>
>> >> Everything seems to be ok.
>> >> It appears the problem is to do with a missing import :
>> >>
>> >> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>> >> binding.xml" />
>> >>
>> >> can you add it please to your beans.xml ?
>> >>
>> >> For some reasons Catalog class is not introspected. Perhaps due to
>> the
>> >> fact
>> >> the above import is missing and thus no jaxrs-aware spring factory
>> is
>> >> invoked
>> >
>> > Nope, I'm afraid that didn't help.
>> >
>> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-2.1.jar,
>> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
>> >
>> > My current XML and Java are this:
>> > -----beans.xml------
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <beans xmlns="http://www.springframework.org/schema/beans"
>> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> >     xmlns:cxf="http://cxf.apache.org/core"
>> > 	xsi:schemaLocation="
>> > http://www.springframework.org/schema/beans
>> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> > http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>> > http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
>> > http://cxf.apache.org/core http://cxf.apache.org/schemascore.xsd">
>> >
>> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>> > 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
>> > />
>> > 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> >     <import
>> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
>> >
>> >     <jaxrs:server name="restcatalogserver" address="/rest">
>> >         <jaxrs:features>
>> >             <cxf:logging/>
>> >         </jaxrs:features>
>> >         <jaxrs:serviceBeans>
>> >             <bean class="com.att.ecom.catalog.Catalog"/>
>> >         </jaxrs:serviceBeans>
>> >     </jaxrs:server>
>> > </beans>
>> > -------------------------
>> > -----Catalog.java-----
>> > package com.att.ecom.catalog;
>> > import java.util.ArrayList;
>> > import java.util.List;
>> > import javax.ws.rs.GET;
>> > import javax.ws.rs.Path;
>> > import javax.ws.rs.PathParam;
>> > import javax.ws.rs.Produces;
>> > import javax.xml.bind.annotation.XmlRootElement;
>> >
>> > @Path("/catalog/")
>> > @Produces("application/xml")
>> > public class Catalog {
>> > 	@GET
>> > 	@Path("/item/{id}")
>> > 	public Item getItem(@PathParam("id") String id) {
>> > 		Item item	= new Item();
>> > 		item.setId(id);
>> > 		item.setTitle("abc");
>> > 		item.setDescription("def");
>> > 		return new Item();
>> > 	}
>> > 	@XmlRootElement(name = "Item")
>> > 	public static class Item {
>> > 		private String	id;
>> > 		private String	title;
>> > 		private String  description;
>> >
>> > 		public String getTitle() { return title; }
>> > 		public String getId() { return id; }
>> > 		public String getDescription() { return description; }
>> >
>> > 		public void setTitle(String title) { this.title = title;
>> > }
>> > 		public void setId(String id) { this.id = id; }
>> > 		public void setDescription(String description) {
>> > this.description = description; }
>> > 	}
>> > }
>> > --------------------
>> >
>> >> KARR, DAVID (ATTCINW) wrote:
>> >> >
>> >> > I'm trying to set up a simple REST prototype running alongside
>> some
>> >> > other existing code.
>> >> >
>> >> > When I deploy, I appear to fall into the following "if" block in
>> >> > "AbstractJAXRSFactoryBean.checkResources()":
>> >> >
>> >> > -----------------
>> >> >         if (list.size() == 0) {
>> >> >             org.apache.cxf.common.i18n.Message msg =
>> >> >                 new
>> >> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
>> >> >                                                        BUNDLE);
>> >> >             LOG.severe(msg.toString());
>> >> >             throw new
>> >> > WebApplicationException(Response.Status.NOT_FOUND);
>> >> >         }
>> >> > ---------------
>> >> >
>> >> > This list would be empty if
>> >> "serviceFactory.getRealClassResourceInfo()"
>> >> > returned an empty list.  What exactly would that indicate?
>> >> >
>> >> > My beans.xml is very simple right now, just:
>> >> > -----------------------
>> >> > <?xml version="1.0" encoding="UTF-8"?>
>> >> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> >> > 	xsi:schemaLocation="
>> >> > http://www.springframework.org/schema/beans
>> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> >> > http://cxf.apache.org/jaxws
>> http://cxf.apache.org/schemas/jaxws.xsd
>> >> > http://cxf.apache.org/jaxrs
>> > http://cxf.apache.org/schemas/jaxrs.xsd">
>> >> >
>> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
>> >> > />
>> >> > 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> >> >
>> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
>> >> >         <jaxrs:serviceBeans>
>> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
>> >> >         </jaxrs:serviceBeans>
>> >> >     </jaxrs:server>
>> >> > </beans>
>> >> > --------------------
>> >> >
>> >> > The "Catalog" class is also very primitive so far:
>> >> > --------------------------
>> >> > package com.att.ecom.catalog;
>> >> >
>> >> > import java.util.ArrayList;
>> >> > import java.util.List;
>> >> >
>> >> > import javax.ws.rs.GET;
>> >> > import javax.ws.rs.Path;
>> >> > import javax.ws.rs.Produces;
>> >> >
>> >> > @Path("/catalog/")
>> >> > @Produces("application/xml")
>> >> > public class Catalog {
>> >> >
>> >> > 	@GET
>> >> > 	@Path("/items")
>> >> > 	public List<Item> getItems() {
>> >> > 		ArrayList<Item>	result	= new ArrayList<Item>();
>> >> > 		result.add(new Item());
>> >> > 		return (result);
>> >> > 	}
>> >> >
>> >> > 	public static class Item {
>> >> > 		private String	title;
>> >> > 		private String  description;
>> >> >
>> >> > 		public String getTitle() { return title; }
>> >> > 		public String getDescription() { return description; }
>> >> >
>> >> > 		public void setTitle(String title) { this.title = title;
>> >> > }
>> >> > 		public void setDescription(String description) {
>> >> > this.description = description; }
>> >> > 	}
>> >> > }
>> >> > ----------------------------
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context: http://www.nabble.com/getting-
>> >> %22NO_RESOURCES_AVAILABLE%22-from-
>> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> >> tp25120790p25123056.html
>> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >
>> >
>> >
>> 
>> --
>> View this message in context: http://www.nabble.com/getting-
>> %22NO_RESOURCES_AVAILABLE%22-from-
>> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> tp25120790p25132223.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/getting-%22NO_RESOURCES_AVAILABLE%22-from-%22AbstractJAXRSFactoryBean.checkResources%28%29%22-tp25120790p25135192.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Tuesday, August 25, 2009 3:54 AM
> To: users@cxf.apache.org
> Subject: RE: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> 
> I've tried this class & beans.xml in the system tests area, Catalog
> class was
> recognized.
> 
> Can you please let me know a bit more about the way you load the
> (catalog)
> application ?
> Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it a
> standalone
> server which explicitly loads the beans.xml ?

I build the application with Ant.  It's deployed to WebLogic 10.

Can you point me to some classes or methods that I could set breakpoints
in to try to diagnose why it's not processing the Catalog class?

> 
> thanks, Sergey
> 
> 
> KARR, DAVID (ATTCINW) wrote:
> >
> >> -----Original Message-----
> >> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> >> Sent: Monday, August 24, 2009 1:13 PM
> >> To: users@cxf.apache.org
> >> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> >> "AbstractJAXRSFactoryBean.checkResources()"
> >>
> >>
> >> Hi
> >>
> >> Everything seems to be ok.
> >> It appears the problem is to do with a missing import :
> >>
> >> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> binding.xml" />
> >>
> >> can you add it please to your beans.xml ?
> >>
> >> For some reasons Catalog class is not introspected. Perhaps due to
> the
> >> fact
> >> the above import is missing and thus no jaxrs-aware spring factory
> is
> >> invoked
> >
> > Nope, I'm afraid that didn't help.
> >
> > The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-2.1.jar,
> > jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> >
> > My current XML and Java are this:
> > -----beans.xml------
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://www.springframework.org/schema/beans"
> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >     xmlns:cxf="http://cxf.apache.org/core"
> > 	xsi:schemaLocation="
> > http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> > http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> > http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
> > http://cxf.apache.org/core http://cxf.apache.org/schemascore.xsd">
> >
> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> > 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
> > />
> > 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> >     <import
> > resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
> >
> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >         <jaxrs:features>
> >             <cxf:logging/>
> >         </jaxrs:features>
> >         <jaxrs:serviceBeans>
> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >         </jaxrs:serviceBeans>
> >     </jaxrs:server>
> > </beans>
> > -------------------------
> > -----Catalog.java-----
> > package com.att.ecom.catalog;
> > import java.util.ArrayList;
> > import java.util.List;
> > import javax.ws.rs.GET;
> > import javax.ws.rs.Path;
> > import javax.ws.rs.PathParam;
> > import javax.ws.rs.Produces;
> > import javax.xml.bind.annotation.XmlRootElement;
> >
> > @Path("/catalog/")
> > @Produces("application/xml")
> > public class Catalog {
> > 	@GET
> > 	@Path("/item/{id}")
> > 	public Item getItem(@PathParam("id") String id) {
> > 		Item item	= new Item();
> > 		item.setId(id);
> > 		item.setTitle("abc");
> > 		item.setDescription("def");
> > 		return new Item();
> > 	}
> > 	@XmlRootElement(name = "Item")
> > 	public static class Item {
> > 		private String	id;
> > 		private String	title;
> > 		private String  description;
> >
> > 		public String getTitle() { return title; }
> > 		public String getId() { return id; }
> > 		public String getDescription() { return description; }
> >
> > 		public void setTitle(String title) { this.title = title;
> > }
> > 		public void setId(String id) { this.id = id; }
> > 		public void setDescription(String description) {
> > this.description = description; }
> > 	}
> > }
> > --------------------
> >
> >> KARR, DAVID (ATTCINW) wrote:
> >> >
> >> > I'm trying to set up a simple REST prototype running alongside
> some
> >> > other existing code.
> >> >
> >> > When I deploy, I appear to fall into the following "if" block in
> >> > "AbstractJAXRSFactoryBean.checkResources()":
> >> >
> >> > -----------------
> >> >         if (list.size() == 0) {
> >> >             org.apache.cxf.common.i18n.Message msg =
> >> >                 new
> >> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >> >                                                        BUNDLE);
> >> >             LOG.severe(msg.toString());
> >> >             throw new
> >> > WebApplicationException(Response.Status.NOT_FOUND);
> >> >         }
> >> > ---------------
> >> >
> >> > This list would be empty if
> >> "serviceFactory.getRealClassResourceInfo()"
> >> > returned an empty list.  What exactly would that indicate?
> >> >
> >> > My beans.xml is very simple right now, just:
> >> > -----------------------
> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> > 	xsi:schemaLocation="
> >> > http://www.springframework.org/schema/beans
> >> > http://www.springframework.org/schema/beans/spring-beans.xsd
> >> > http://cxf.apache.org/jaxws
> http://cxf.apache.org/schemas/jaxws.xsd
> >> > http://cxf.apache.org/jaxrs
> > http://cxf.apache.org/schemas/jaxrs.xsd">
> >> >
> >> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> > 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
> >> > />
> >> > 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> >> >
> >> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >> >         <jaxrs:serviceBeans>
> >> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >> >         </jaxrs:serviceBeans>
> >> >     </jaxrs:server>
> >> > </beans>
> >> > --------------------
> >> >
> >> > The "Catalog" class is also very primitive so far:
> >> > --------------------------
> >> > package com.att.ecom.catalog;
> >> >
> >> > import java.util.ArrayList;
> >> > import java.util.List;
> >> >
> >> > import javax.ws.rs.GET;
> >> > import javax.ws.rs.Path;
> >> > import javax.ws.rs.Produces;
> >> >
> >> > @Path("/catalog/")
> >> > @Produces("application/xml")
> >> > public class Catalog {
> >> >
> >> > 	@GET
> >> > 	@Path("/items")
> >> > 	public List<Item> getItems() {
> >> > 		ArrayList<Item>	result	= new ArrayList<Item>();
> >> > 		result.add(new Item());
> >> > 		return (result);
> >> > 	}
> >> >
> >> > 	public static class Item {
> >> > 		private String	title;
> >> > 		private String  description;
> >> >
> >> > 		public String getTitle() { return title; }
> >> > 		public String getDescription() { return description; }
> >> >
> >> > 		public void setTitle(String title) { this.title = title;
> >> > }
> >> > 		public void setDescription(String description) {
> >> > this.description = description; }
> >> > 	}
> >> > }
> >> > ----------------------------
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/getting-
> >> %22NO_RESOURCES_AVAILABLE%22-from-
> >> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> >> tp25120790p25123056.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25132223.html
> Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <se...@iona.com>.
I've tried this class & beans.xml in the system tests area, Catalog class was
recognized.

Can you please let me know a bit more about the way you load the (catalog)
application ?
Are you using Maven or Ant ? Is it Jetty or Tomcat ? Or is it a standalone
server which explicitly loads the beans.xml ?

thanks, Sergey


KARR, DAVID (ATTCINW) wrote:
> 
>> -----Original Message-----
>> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
>> Sent: Monday, August 24, 2009 1:13 PM
>> To: users@cxf.apache.org
>> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
>> "AbstractJAXRSFactoryBean.checkResources()"
>> 
>> 
>> Hi
>> 
>> Everything seems to be ok.
>> It appears the problem is to do with a missing import :
>> 
>> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>> binding.xml" />
>> 
>> can you add it please to your beans.xml ?
>> 
>> For some reasons Catalog class is not introspected. Perhaps due to the
>> fact
>> the above import is missing and thus no jaxrs-aware spring factory is
>> invoked
> 
> Nope, I'm afraid that didn't help.
> 
> The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-2.1.jar,
> jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar
> 
> My current XML and Java are this:
> -----beans.xml------
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>     xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemascore.xsd">
> 
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
> />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     <import
> resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
>     
>     <jaxrs:server name="restcatalogserver" address="/rest">
>         <jaxrs:features>
>             <cxf:logging/>
>         </jaxrs:features>
>         <jaxrs:serviceBeans>
>             <bean class="com.att.ecom.catalog.Catalog"/>
>         </jaxrs:serviceBeans>
>     </jaxrs:server>
> </beans>
> -------------------------
> -----Catalog.java-----
> package com.att.ecom.catalog;
> import java.util.ArrayList;
> import java.util.List;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.PathParam;
> import javax.ws.rs.Produces;
> import javax.xml.bind.annotation.XmlRootElement;
> 
> @Path("/catalog/")
> @Produces("application/xml")
> public class Catalog {
> 	@GET
> 	@Path("/item/{id}")
> 	public Item getItem(@PathParam("id") String id) {
> 		Item item	= new Item();
> 		item.setId(id);
> 		item.setTitle("abc");
> 		item.setDescription("def");
> 		return new Item();
> 	}
> 	@XmlRootElement(name = "Item")
> 	public static class Item {
> 		private String	id;
> 		private String	title;
> 		private String  description;
> 		
> 		public String getTitle() { return title; }
> 		public String getId() { return id; }
> 		public String getDescription() { return description; }
> 		
> 		public void setTitle(String title) { this.title = title;
> }
> 		public void setId(String id) { this.id = id; }
> 		public void setDescription(String description) {
> this.description = description; }
> 	}
> }
> --------------------
> 
>> KARR, DAVID (ATTCINW) wrote:
>> >
>> > I'm trying to set up a simple REST prototype running alongside some
>> > other existing code.
>> >
>> > When I deploy, I appear to fall into the following "if" block in
>> > "AbstractJAXRSFactoryBean.checkResources()":
>> >
>> > -----------------
>> >         if (list.size() == 0) {
>> >             org.apache.cxf.common.i18n.Message msg =
>> >                 new
>> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
>> >                                                        BUNDLE);
>> >             LOG.severe(msg.toString());
>> >             throw new
>> > WebApplicationException(Response.Status.NOT_FOUND);
>> >         }
>> > ---------------
>> >
>> > This list would be empty if
>> "serviceFactory.getRealClassResourceInfo()"
>> > returned an empty list.  What exactly would that indicate?
>> >
>> > My beans.xml is very simple right now, just:
>> > -----------------------
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <beans xmlns="http://www.springframework.org/schema/beans"
>> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> > 	xsi:schemaLocation="
>> > http://www.springframework.org/schema/beans
>> > http://www.springframework.org/schema/beans/spring-beans.xsd
>> > http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>> > http://cxf.apache.org/jaxrs
> http://cxf.apache.org/schemas/jaxrs.xsd">
>> >
>> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>> > 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
>> > />
>> > 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> >
>> >     <jaxrs:server name="restcatalogserver" address="/rest">
>> >         <jaxrs:serviceBeans>
>> >             <bean class="com.att.ecom.catalog.Catalog"/>
>> >         </jaxrs:serviceBeans>
>> >     </jaxrs:server>
>> > </beans>
>> > --------------------
>> >
>> > The "Catalog" class is also very primitive so far:
>> > --------------------------
>> > package com.att.ecom.catalog;
>> >
>> > import java.util.ArrayList;
>> > import java.util.List;
>> >
>> > import javax.ws.rs.GET;
>> > import javax.ws.rs.Path;
>> > import javax.ws.rs.Produces;
>> >
>> > @Path("/catalog/")
>> > @Produces("application/xml")
>> > public class Catalog {
>> >
>> > 	@GET
>> > 	@Path("/items")
>> > 	public List<Item> getItems() {
>> > 		ArrayList<Item>	result	= new ArrayList<Item>();
>> > 		result.add(new Item());
>> > 		return (result);
>> > 	}
>> >
>> > 	public static class Item {
>> > 		private String	title;
>> > 		private String  description;
>> >
>> > 		public String getTitle() { return title; }
>> > 		public String getDescription() { return description; }
>> >
>> > 		public void setTitle(String title) { this.title = title;
>> > }
>> > 		public void setDescription(String description) {
>> > this.description = description; }
>> > 	}
>> > }
>> > ----------------------------
>> >
>> >
>> 
>> --
>> View this message in context: http://www.nabble.com/getting-
>> %22NO_RESOURCES_AVAILABLE%22-from-
>> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
>> tp25120790p25123056.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/getting-%22NO_RESOURCES_AVAILABLE%22-from-%22AbstractJAXRSFactoryBean.checkResources%28%29%22-tp25120790p25132223.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Monday, August 24, 2009 1:13 PM
> To: users@cxf.apache.org
> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> 
> Hi
> 
> Everything seems to be ok.
> It appears the problem is to do with a missing import :
> 
> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> binding.xml" />
> 
> can you add it please to your beans.xml ?
> 
> For some reasons Catalog class is not introspected. Perhaps due to the
> fact
> the above import is missing and thus no jaxrs-aware spring factory is
> invoked

Nope, I'm afraid that didn't help.

The relevant jars I'm loading are: cxf-2.2.3.jar, jaxb-api-2.1.jar,
jsr311-api-1.0.jar, spring.jar, and wsdl4j.jar

My current XML and Java are this:
-----beans.xml------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:jaxrs="http://cxf.apache.org/jaxrs"
    xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemascore.xsd">

	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
/>
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <import
resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
    
    <jaxrs:server name="restcatalogserver" address="/rest">
        <jaxrs:features>
            <cxf:logging/>
        </jaxrs:features>
        <jaxrs:serviceBeans>
            <bean class="com.att.ecom.catalog.Catalog"/>
        </jaxrs:serviceBeans>
    </jaxrs:server>
</beans>
-------------------------
-----Catalog.java-----
package com.att.ecom.catalog;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.xml.bind.annotation.XmlRootElement;

@Path("/catalog/")
@Produces("application/xml")
public class Catalog {
	@GET
	@Path("/item/{id}")
	public Item getItem(@PathParam("id") String id) {
		Item item	= new Item();
		item.setId(id);
		item.setTitle("abc");
		item.setDescription("def");
		return new Item();
	}
	@XmlRootElement(name = "Item")
	public static class Item {
		private String	id;
		private String	title;
		private String  description;
		
		public String getTitle() { return title; }
		public String getId() { return id; }
		public String getDescription() { return description; }
		
		public void setTitle(String title) { this.title = title;
}
		public void setId(String id) { this.id = id; }
		public void setDescription(String description) {
this.description = description; }
	}
}
--------------------

> KARR, DAVID (ATTCINW) wrote:
> >
> > I'm trying to set up a simple REST prototype running alongside some
> > other existing code.
> >
> > When I deploy, I appear to fall into the following "if" block in
> > "AbstractJAXRSFactoryBean.checkResources()":
> >
> > -----------------
> >         if (list.size() == 0) {
> >             org.apache.cxf.common.i18n.Message msg =
> >                 new
> > org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >                                                        BUNDLE);
> >             LOG.severe(msg.toString());
> >             throw new
> > WebApplicationException(Response.Status.NOT_FOUND);
> >         }
> > ---------------
> >
> > This list would be empty if
> "serviceFactory.getRealClassResourceInfo()"
> > returned an empty list.  What exactly would that indicate?
> >
> > My beans.xml is very simple right now, just:
> > -----------------------
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://www.springframework.org/schema/beans"
> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> > 	xsi:schemaLocation="
> > http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans.xsd
> > http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> > http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
> >
> > 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> > 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
> > />
> > 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> >
> >     <jaxrs:server name="restcatalogserver" address="/rest">
> >         <jaxrs:serviceBeans>
> >             <bean class="com.att.ecom.catalog.Catalog"/>
> >         </jaxrs:serviceBeans>
> >     </jaxrs:server>
> > </beans>
> > --------------------
> >
> > The "Catalog" class is also very primitive so far:
> > --------------------------
> > package com.att.ecom.catalog;
> >
> > import java.util.ArrayList;
> > import java.util.List;
> >
> > import javax.ws.rs.GET;
> > import javax.ws.rs.Path;
> > import javax.ws.rs.Produces;
> >
> > @Path("/catalog/")
> > @Produces("application/xml")
> > public class Catalog {
> >
> > 	@GET
> > 	@Path("/items")
> > 	public List<Item> getItems() {
> > 		ArrayList<Item>	result	= new ArrayList<Item>();
> > 		result.add(new Item());
> > 		return (result);
> > 	}
> >
> > 	public static class Item {
> > 		private String	title;
> > 		private String  description;
> >
> > 		public String getTitle() { return title; }
> > 		public String getDescription() { return description; }
> >
> > 		public void setTitle(String title) { this.title = title;
> > }
> > 		public void setDescription(String description) {
> > this.description = description; }
> > 	}
> > }
> > ----------------------------
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25123056.html
> Sent from the cxf-user mailing list archive at Nabble.com.


RE: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by "KARR, DAVID (ATTCINW)" <dk...@att.com>.
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Monday, August 24, 2009 1:17 PM
> To: users@cxf.apache.org
> Subject: Re: getting "NO_RESOURCES_AVAILABLE" from
> "AbstractJAXRSFactoryBean.checkResources()"
> 
> 
> By the way, you might want to add @XmlRootElement to the Item class
> declaration - I'm not sure the explicit collection (List<Item>) will
be
> properly serialized otherwise, alternatively you may just want to set
a
> 'marshalAsJaxbElement' on a jaxb provider - if you'd like to avoid
> setting
> @XmlRootElement

Already done (added "@XMlRootElement", that is).  That was one of the
things I saw that was slightly different from other examples, in my
search to figure out why the heck this was happening.

Thanks.

I'm still testing the added import that you suggested.

> 
> cheers, Sergey
> 
> Sergey Beryozkin wrote:
> >
> > Hi
> >
> > Everything seems to be ok.
> > It appears the problem is to do with a missing import :
> >
> > <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> binding.xml"
> > />
> >
> > can you add it please to your beans.xml ?
> >
> > For some reasons Catalog class is not introspected. Perhaps due to
> the
> > fact the above import is missing and thus no jaxrs-aware spring
> factory is
> > invoked
> >
> > cheers, Sergey
> >
> >
> > KARR, DAVID (ATTCINW) wrote:
> >>
> >> I'm trying to set up a simple REST prototype running alongside some
> >> other existing code.
> >>
> >> When I deploy, I appear to fall into the following "if" block in
> >> "AbstractJAXRSFactoryBean.checkResources()":
> >>
> >> -----------------
> >>         if (list.size() == 0) {
> >>             org.apache.cxf.common.i18n.Message msg =
> >>                 new
> >> org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE",
> >>                                                        BUNDLE);
> >>             LOG.severe(msg.toString());
> >>             throw new
> >> WebApplicationException(Response.Status.NOT_FOUND);
> >>         }
> >> ---------------
> >>
> >> This list would be empty if
> "serviceFactory.getRealClassResourceInfo()"
> >> returned an empty list.  What exactly would that indicate?
> >>
> >> My beans.xml is very simple right now, just:
> >> -----------------------
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <beans xmlns="http://www.springframework.org/schema/beans"
> >> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> >>     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> >> 	xsi:schemaLocation="
> >> http://www.springframework.org/schema/beans
> >> http://www.springframework.org/schema/beans/spring-beans.xsd
> >> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> >> http://cxf.apache.org/jaxrs
> http://cxf.apache.org/schemas/jaxrs.xsd">
> >>
> >> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> >> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
> >> />
> >> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> >>
> >>     <jaxrs:server name="restcatalogserver" address="/rest">
> >>         <jaxrs:serviceBeans>
> >>             <bean class="com.att.ecom.catalog.Catalog"/>
> >>         </jaxrs:serviceBeans>
> >>     </jaxrs:server>
> >> </beans>
> >> --------------------
> >>
> >> The "Catalog" class is also very primitive so far:
> >> --------------------------
> >> package com.att.ecom.catalog;
> >>
> >> import java.util.ArrayList;
> >> import java.util.List;
> >>
> >> import javax.ws.rs.GET;
> >> import javax.ws.rs.Path;
> >> import javax.ws.rs.Produces;
> >>
> >> @Path("/catalog/")
> >> @Produces("application/xml")
> >> public class Catalog {
> >>
> >> 	@GET
> >> 	@Path("/items")
> >> 	public List<Item> getItems() {
> >> 		ArrayList<Item>	result	= new ArrayList<Item>();
> >> 		result.add(new Item());
> >> 		return (result);
> >> 	}
> >>
> >> 	public static class Item {
> >> 		private String	title;
> >> 		private String  description;
> >>
> >> 		public String getTitle() { return title; }
> >> 		public String getDescription() { return description; }
> >>
> >> 		public void setTitle(String title) { this.title = title;
> >> }
> >> 		public void setDescription(String description) {
> >> this.description = description; }
> >> 	}
> >> }
> >> ----------------------------
> >>
> >>
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/getting-
> %22NO_RESOURCES_AVAILABLE%22-from-
> %22AbstractJAXRSFactoryBean.checkResources%28%29%22-
> tp25120790p25123062.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Re: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <se...@iona.com>.
By the way, you might want to add @XmlRootElement to the Item class
declaration - I'm not sure the explicit collection (List<Item>) will be
properly serialized otherwise, alternatively you may just want to set a
'marshalAsJaxbElement' on a jaxb provider - if you'd like to avoid setting
@XmlRootElement 

cheers, Sergey

Sergey Beryozkin wrote:
> 
> Hi
> 
> Everything seems to be ok.
> It appears the problem is to do with a missing import :
> 
> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"
> />
> 
> can you add it please to your beans.xml ? 
> 
> For some reasons Catalog class is not introspected. Perhaps due to the
> fact the above import is missing and thus no jaxrs-aware spring factory is
> invoked
> 
> cheers, Sergey
> 
> 
> KARR, DAVID (ATTCINW) wrote:
>> 
>> I'm trying to set up a simple REST prototype running alongside some
>> other existing code.
>> 
>> When I deploy, I appear to fall into the following "if" block in
>> "AbstractJAXRSFactoryBean.checkResources()":
>> 
>> -----------------
>>         if (list.size() == 0) {
>>             org.apache.cxf.common.i18n.Message msg = 
>>                 new
>> org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE", 
>>                                                        BUNDLE);
>>             LOG.severe(msg.toString());
>>             throw new
>> WebApplicationException(Response.Status.NOT_FOUND);
>>         }
>> ---------------
>> 
>> This list would be empty if "serviceFactory.getRealClassResourceInfo()"
>> returned an empty list.  What exactly would that indicate?
>> 
>> My beans.xml is very simple right now, just:
>> -----------------------
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>>     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>> 	xsi:schemaLocation="
>> http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans.xsd
>> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
>> http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
>> 
>> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
>> />
>> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> 
>>     <jaxrs:server name="restcatalogserver" address="/rest">
>>         <jaxrs:serviceBeans>
>>             <bean class="com.att.ecom.catalog.Catalog"/>
>>         </jaxrs:serviceBeans>
>>     </jaxrs:server>
>> </beans>
>> --------------------
>> 
>> The "Catalog" class is also very primitive so far:
>> --------------------------
>> package com.att.ecom.catalog;
>> 
>> import java.util.ArrayList;
>> import java.util.List;
>> 
>> import javax.ws.rs.GET;
>> import javax.ws.rs.Path;
>> import javax.ws.rs.Produces;
>> 
>> @Path("/catalog/")
>> @Produces("application/xml")
>> public class Catalog {
>> 
>> 	@GET
>> 	@Path("/items")
>> 	public List<Item> getItems() {
>> 		ArrayList<Item>	result	= new ArrayList<Item>();
>> 		result.add(new Item());
>> 		return (result);
>> 	}
>> 	
>> 	public static class Item {
>> 		private String	title;
>> 		private String  description;
>> 		
>> 		public String getTitle() { return title; }
>> 		public String getDescription() { return description; }
>> 		
>> 		public void setTitle(String title) { this.title = title;
>> }
>> 		public void setDescription(String description) {
>> this.description = description; }
>> 	}
>> }
>> ----------------------------
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/getting-%22NO_RESOURCES_AVAILABLE%22-from-%22AbstractJAXRSFactoryBean.checkResources%28%29%22-tp25120790p25123062.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: getting "NO_RESOURCES_AVAILABLE" from "AbstractJAXRSFactoryBean.checkResources()"

Posted by Sergey Beryozkin <se...@iona.com>.
Hi

Everything seems to be ok.
It appears the problem is to do with a missing import :

<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />

can you add it please to your beans.xml ? 

For some reasons Catalog class is not introspected. Perhaps due to the fact
the above import is missing and thus no jaxrs-aware spring factory is
invoked

cheers, Sergey


KARR, DAVID (ATTCINW) wrote:
> 
> I'm trying to set up a simple REST prototype running alongside some
> other existing code.
> 
> When I deploy, I appear to fall into the following "if" block in
> "AbstractJAXRSFactoryBean.checkResources()":
> 
> -----------------
>         if (list.size() == 0) {
>             org.apache.cxf.common.i18n.Message msg = 
>                 new
> org.apache.cxf.common.i18n.Message("NO_RESOURCES_AVAILABLE", 
>                                                        BUNDLE);
>             LOG.severe(msg.toString());
>             throw new
> WebApplicationException(Response.Status.NOT_FOUND);
>         }
> ---------------
> 
> This list would be empty if "serviceFactory.getRealClassResourceInfo()"
> returned an empty list.  What exactly would that indicate?
> 
> My beans.xml is very simple right now, just:
> -----------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
>     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
> 
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
> />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> 
>     <jaxrs:server name="restcatalogserver" address="/rest">
>         <jaxrs:serviceBeans>
>             <bean class="com.att.ecom.catalog.Catalog"/>
>         </jaxrs:serviceBeans>
>     </jaxrs:server>
> </beans>
> --------------------
> 
> The "Catalog" class is also very primitive so far:
> --------------------------
> package com.att.ecom.catalog;
> 
> import java.util.ArrayList;
> import java.util.List;
> 
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> 
> @Path("/catalog/")
> @Produces("application/xml")
> public class Catalog {
> 
> 	@GET
> 	@Path("/items")
> 	public List<Item> getItems() {
> 		ArrayList<Item>	result	= new ArrayList<Item>();
> 		result.add(new Item());
> 		return (result);
> 	}
> 	
> 	public static class Item {
> 		private String	title;
> 		private String  description;
> 		
> 		public String getTitle() { return title; }
> 		public String getDescription() { return description; }
> 		
> 		public void setTitle(String title) { this.title = title;
> }
> 		public void setDescription(String description) {
> this.description = description; }
> 	}
> }
> ----------------------------
> 
> 

-- 
View this message in context: http://www.nabble.com/getting-%22NO_RESOURCES_AVAILABLE%22-from-%22AbstractJAXRSFactoryBean.checkResources%28%29%22-tp25120790p25123056.html
Sent from the cxf-user mailing list archive at Nabble.com.