Hello,

I'm trying to run simple Spring web app with DispatcherServlet

web.xml

  <servlet>
      <servlet-name>resteasy</servlet-name>
      
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
   </servlet>

   <servlet-mapping>
      <servlet-name>resteasy</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>

----------------------------------------------------
resteasy-servlet.xml

  <!-- Import basic SpringMVC Resteasy integration -->
    <import resource="classpath:springmvc-resteasy.xml"/>

  <!-- the only @Path entity -->
    <bean class="com.xx.xx.xx.Devices"></bean>

----------------------------------------------------

I have

Caused by: java.lang.NullPointerException: null
        at 
org.jboss.resteasy.links.impl.RESTUtils.getServiceMethods(RESTUtils.java:85)
~[resteasy-links-2.2.0.GA.jar:na]
        at 
org.jboss.resteasy.links.impl.RESTUtils.addDiscovery(RESTUtils.java:52)
~[resteasy-links-2.2.0.GA.jar:na]
        at 
org.jboss.resteasy.links.impl.LinkDecorator$1.beforeMarshal(LinkDecorator.java:27)
~[resteasy-links-2.2.0.GA.jar:na]
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.fireBeforeMarshalEvents(XMLSerializer.java:752)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:586)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:320)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.serializeListBody(ArrayReferenceNodeProperty.java:114)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:152)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:332)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:699)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:152)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:189)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:315)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:322)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:72)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
~[jaxb-impl-2.1.12.jar:2.1.12]
        at 
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
~[na:1.6.0_24]
        at 
org.jboss.resteasy.plugins.providers.jaxb.CollectionProvider.writeTo(CollectionProvider.java:220)
~[resteasy-jaxb-provider-2.2.0.GA.jar:na]
        at 
org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:117)
~[resteasy-jaxrs-2.2.0.GA.jar:na]
        at 
org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.write(GZIPEncodingInterceptor.java:48)
~[resteasy-jaxrs-2.2.0.GA.jar:na]
        at 
org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:123)
~[resteasy-jaxrs-2.2.0.GA.jar:na]
        at 
org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:250)
~[resteasy-jaxrs-2.2.0.GA.jar:na]

AFAIget the core issue is the absence of Registry in a context map:

LinkDecorator.java
....
                        public void beforeMarshal(Object entity) {
                                UriInfo uriInfo = 
ResteasyProviderFactory.getContextData(UriInfo.class);
                                ResourceMethodRegistry registry = 
(ResourceMethodRegistry)
ResteasyProviderFactory.getContextData(Registry.class);
!!!!!!   registry==null here
                                // find all rest service classes and scan them
                                RESTUtils.addDiscovery(entity, uriInfo, 
registry);

Unfortunately I can't find the place where Registry should be inserted
into the context map.

But it's definitely not in org.jboss.resteasy.core.SynchronousDispatcher:441

   public void pushContextObjects(HttpRequest request, HttpResponse response)
   {
      Map contextDataMap = ResteasyProviderFactory.getContextDataMap();
      contextDataMap.put(HttpRequest.class, request);
      contextDataMap.put(HttpResponse.class, response);
      contextDataMap.put(HttpHeaders.class, request.getHttpHeaders());
      contextDataMap.put(UriInfo.class, request.getUri());
      contextDataMap.put(Request.class, new RequestImpl(request));

      contextDataMap.putAll(defaultContextObjects);
   }

Does anybody use DispatcherServlet?

Regards


-- 
Sincerely yours
Mikhail (Mike) Khludnev
Developer

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to