Hi
On 31/07/13 19:08, Tom Hartwell wrote:
I'm using CXF 2.6.6 for JAX-RS services. Because I would like to expose the
service interface to be usable by other webapps, I've separated the
serviceBean interface and implementation into 2 different jars:
service-api.jar and service.jar
In order for other webapps to utilize the api jar, I've deployed the jar to
tomcat/lib/my-libs and added an entry in catalina.properties:
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/lib/my-libs/*.jar
However this does not work when CXF/Spring try to load the XML definition
of my service. If I place the API jar into my webapp's lib directory there
is no problem, but that defeats the purpose of having an API jar that can
be shared across webapps.
What is not clear to me is why the failure occurs. Spring obviously
loads a service bean but JAXRSServerFactoryBean fails to recognize it as
a JAX-RS services, presumably because the interface with the annotations
is not in the same webapp.
But JAXRSServerFactoryBean deal with the loaded Object so it does not
matter really where API is located given that Spring loaded the actual
object.
I'm short of ideas. Can you create two simple jars (api + impl - latter
packaged in a war) and attach to JIRA ? Or may be a much simpler option
is to debug through CXF source ?
Cheers. Sergey
TIA for any input on the matter,
Tom
The following is the error in my startup logs:
2013-07-31 10:58:48,759 [main] ERROR
org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean - No resource classes found
2013-07-31 10:58:48,764 [main] ERROR
com.awarepoint.service.servlet.SpringApplicationContext - FAILURE invoking
create of
org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.awarepoint.service.servlet.SpringApplicationContext.invokeInitMethod(SpringApplicationContext.java:83)
at
com.awarepoint.service.servlet.SpringApplicationContext.refresh(SpringApplicationContext.java:70)
at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:194)
... 24 more
Caused by: javax.ws.rs.WebApplicationException
at
org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:315)
at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:144)
... 24 more
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com