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:[email protected]] >>> Sent: Monday, August 24, 2009 1:13 PM >>> To: [email protected] >>> 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.
