I have a skeleton JAX-RS service (CXF 2.3.2).  When I test it with wget
or SoapUI, it correctly returns an empty object.  It's deployed in a WAR
inside an EAR in WebLogic 10.3.2.

I'm now copying over code from an older project that lets me test my
controller in a unit test.

This is my "startServer()" method, which was copied almost unchanged
from the older project:
---------------------    @BeforeClass
    public static void startServer() {
        JAXRSServerFactoryBean  sf  = new JAXRSServerFactoryBean();
        sf.setServiceBean(catalogContentController);
        sf.getInInterceptors().add(new LoggingInInterceptor());
        sf.getOutInterceptors().add(new LoggingOutInterceptor());
        sf.setProvider(new JacksonJsonProvider());
        
        sf.setAddress(BASE_SERVICE_URI);
        
        Map<Object, Object> mappings = new HashMap<Object, Object>();
        mappings.put("xml", "application/xml");
        mappings.put("json", "application/json");
        sf.setExtensionMappings(mappings);
        
        JacksonInit jacksonInit = new JacksonInit();
        ObjectMapper    objectMapper    = new ObjectMapper();
        jacksonInit.setObjectMapper(objectMapper);
        jacksonInit.setAnnotationIntrospector(new
AnnotationIntrospector.Pair(new JacksonAnnotationIntrospector(),
 
new JaxbAnnotationIntrospector()));
        jacksonInit.init();
        
        sf.create();
    }
---------------

Inside a test method, I have code like this:

---------------------
        WebClient   client  = WebClient.create(BASE_SERVICE_URI);
        client.path("/catalog/rootCategories");
        
        GetRootCategoriesResponse   response    = null;
        response    = client.get(GetRootCategoriesResponse.class);
        System.out.println("response[" + response + "]");
---------------------

When I run this, I'm seeing the following:
--------------------------
java.lang.NoSuchMethodError:
javax.servlet.http.HttpServletRequest.getLocalAddr()Ljava/lang/String;
        at
org.apache.cxf.transport.http.HttpServletRequestSnapshot.<init>(HttpServ
letRequestSnapshot.java:79)
        at
org.apache.cxf.transport.http.AbstractHTTPDestination$1.cacheInput(Abstr
actHTTPDestination.java:303)
        at
org.apache.cxf.transport.http.AbstractHTTPDestination.cacheInput(Abstrac
tHTTPDestination.java:519)
        at
org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(Abstr
actHTTPDestination.java:531)
        at
org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(Abstr
actHTTPDestination.java:524)
        at
org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputStrea
m.onFirstWrite(AbstractHTTPDestination.java:659)
        at
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutpu
tStream.java:42)
        at
org.apache.cxf.io.CacheAndWriteOutputStream.write(CacheAndWriteOutputStr
eam.java:68)
        at
com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.flushBuffer(UTF8XmlOutp
ut.java:401)
        at
com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.endDocument(UTF8XmlOutp
ut.java:132)
        at
com.sun.xml.bind.v2.runtime.XMLSerializer.endDocument(XMLSerializer.java
:837)
        at
com.sun.xml.bind.v2.runtime.MarshallerImpl.postwrite(MarshallerImpl.java
:379)
        at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:326
)
        at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:2
54)
        at
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshaller
Impl.java:75)
        at
org.apache.cxf.jaxrs.provider.JAXBElementProvider.marshalToOutputStream(
JAXBElementProvider.java:441)
--------------------------------

What is likely happening here?

Reply via email to