> -----Original Message----- > From: Sergey Beryozkin [mailto:[email protected]] > Sent: Tuesday, August 25, 2009 1:02 PM > To: [email protected] > 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:[email protected]] > >> Sent: Tuesday, August 25, 2009 10:06 AM > >> To: [email protected] > >> 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:[email protected]] > >> >> Sent: Tuesday, August 25, 2009 7:18 AM > >> >> To: [email protected] > >> >> 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:[email protected]] > >> >> >> Sent: Tuesday, August 25, 2009 3:54 AM > >> >> >> To: [email protected] > >> >> >> 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:[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- > >> >> >> 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.
