CXF
  1. CXF
  2. CXF-3022

Integrating Spring 3 + GenericDAO (Don't repeat the DAO!) + CXF JAX-RS (JAXB Databinding) with a Generic Service Interface

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.2.10
    • Fix Version/s: 2.2.12, 2.3.1, 2.4
    • Component/s: JAX-RS
    • Labels:
      None
    • Environment:

      Spring 3.03, CXF 2.2.10, Apache Tomcat 6.0.26...

    • Estimated Complexity:
      Unknown

      Description

      Hello everyone,

      I'm trying to use a generic interface implementation as a JAX-RS service in order to accomplish basic rest operations for all model data (in the same way that the pattern GenericDAO.

      The interface:

      IRestService.java
      public interface IRestService<T, PK extends Long>
      {
          T getById(PK id);
      
          PK add(T instance);
      }
      

      The generic service implementation:

      GenericRestServiceImpl.java
      public class GenericRestServiceImpl<T, PK extends Long> implements IRestService<T, PK>
      {
          private IGenericDAO<T, PK> iDAO;
      
          public void setiDAO(IGenericDAO<T, PK> iDAO)
          {
              this.iDAO = iDAO;
          }
      
          public T getById(PK id)
          {
              return iDAO.read(id);
          }
      
          public PK add(T instance)
          {
              return iDAO.create(instance);
          }
      

      The simple POJO I want to send and receive:

      MobilityUser.java
      @XmlRootElement(name="MobilityUser")
      public class MobilityUser implements Serializable
      {
          private Long id;
          private String login;
          private String nif;
      
          public MobilityUser()
          {
          }
      
      	// Setters & getters omitted...
      }
      

      The most relevant section of Spring context configuration (applicationContext.xml):

          <!-- DAO Configuration  (SessionFactory, DataSource, etc. omitted) --> 
          <bean id="abstractDAO" class="org.springframework.aop.framework.ProxyFactoryBean" abstract="true" />
      	
          <bean id="abstractDaoTarget" class="com.ica.mobility.persistence.dao.genericdao.GenericDAOHibernate" abstract="true">
              <property name="sessionFactory">
                  <ref bean="mobilitySessionFactory"/>
              </property>
          </bean>
      	
          <bean id="userDAO" parent="abstractDAO">
              <property name="proxyInterfaces">
                  <value>com.ica.mobility.persistence.dao.genericdao.IGenericDAO</value>
              </property>
              <property name="target">
                  <bean id="userBean" parent="abstractDaoTarget">
                      <constructor-arg>
                          <value>com.ica.mobility.model.bean.MobilityUser</value>
                      </constructor-arg>
                  </bean>
              </property>
          </bean>
      	
          <!-- CXF Configuration -->
          <jaxrs:server id="genericServer" modelRef="classpath:/WEB-INF/model/resources.xml" abstract="true">
              <jaxrs:features>
                  <cxf:logging/>
              </jaxrs:features>
          </jaxrs:server>
      	
          <bean id="userServer" parent="genericServer">
              <property name="address" value="/user" />
              <property name="serviceBeans">
                  <bean id="userService" class="com.ica.mobility.mobile.service.GenericRestServiceImpl">
                      <property name="iDAO">
                          <ref bean="userDAO"></ref>
                      </property>
                  </bean>
              </property>
          </bean>
      

      The JAX-RS model (resources.xml):

      <model xmlns="http://cxf.apache.org/jaxrs">
          <resource name="com.ica.mobility.mobile.service.IRestService" path="/" consumesType="application/xml" producesType="application/xml">
              <operation name="getById" verb="GET">
                  <param name="id" type="QUERY"/>
              </operation>
              <operation name="add" verb="POST" path="/add">
                  <param name="instance" type="REQUEST_BODY" />
              </operation>
          </resource>
      </model>
      

      There is no problem with GET operation (getById method). However, a runtime exception (NullPointerException) occurs when a POST request is performed.

      Server log with StackTrace:

      server log
      04-oct-2010 11:43:17 org.apache.cxf.interceptor.LoggingInInterceptor logging
      INFO: Inbound Message
      ----------------------------
      ID: 3
      Address: /MobilityServer/mobile/user/add
      Encoding: ISO-8859-1
      Content-Type: application/xml
      Headers: {content-type=[application/xml], host=[localhost:8080], Content-Length=[90], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[application/xml]}
      Payload: <MobilityUser>
      
         <id>5</id>
      
         <login>Login</login>
      
         <nif>Nif</nif>
      
      </MobilityUser>
      --------------------------------------
      Listening for transport dt_shmem at address: tomcat_shared_memory_id
      04-oct-2010 11:46:52 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
      ADVERTENCIA: Interceptor for {http://service.mobile.mobility.ica.com/}IRestService has thrown exception, unwinding now
      java.lang.NullPointerException
              at java.lang.Class.isAssignableFrom(Native Method)
              at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:554)
              at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:960)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:575)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:540)
              at com.ica.mobility.util.CustomInInterceptor.processRequest(CustomInInterceptor.java:242)
              at com.ica.mobility.util.CustomInInterceptor.handleMessage(CustomInInterceptor.java:77)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:244)
              at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
              at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
              at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:423)
              at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:139)
              at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
              at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
              at java.lang.Thread.run(Thread.java:619)
      04-oct-2010 11:46:52 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
      ADVERTENCIA: Interceptor for {http://service.mobile.mobility.ica.com/}IRestService has thrown exception, unwinding now
      org.apache.cxf.interceptor.Fault
              at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:293)
              at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
              at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
              at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:423)
              at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:139)
              at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
              at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NullPointerException
              at java.lang.Class.isAssignableFrom(Native Method)
              at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:554)
              at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:960)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:575)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:540)
              at com.ica.mobility.util.CustomInInterceptor.processRequest(CustomInInterceptor.java:242)
              at com.ica.mobility.util.CustomInInterceptor.handleMessage(CustomInInterceptor.java:77)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:244)
              ... 28 more
      04-oct-2010 11:46:52 org.apache.cxf.phase.PhaseInterceptorChain unwind
      ADVERTENCIA: Exception in handleFault on interceptor org.apache.cxf.binding.xml.interceptor.XMLFaultOutInterceptor@d445e2
      org.apache.cxf.interceptor.Fault
              at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:293)
              at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
              at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
              at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:423)
              at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:139)
              at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
              at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NullPointerException
              at java.lang.Class.isAssignableFrom(Native Method)
              at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:554)
              at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:960)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:575)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:540)
              at com.ica.mobility.util.CustomInInterceptor.processRequest(CustomInInterceptor.java:242)
              at com.ica.mobility.util.CustomInInterceptor.handleMessage(CustomInInterceptor.java:77)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:244)
              ... 28 more
      04-oct-2010 11:46:52 org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver onMessage
      GRAVE: Error occurred during error handling, give up!
      org.apache.cxf.interceptor.Fault
              at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:293)
              at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
              at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
              at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:423)
              at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:139)
              at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
              at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
              at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NullPointerException
              at java.lang.Class.isAssignableFrom(Native Method)
              at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:554)
              at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269)
              at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:960)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:575)
              at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:540)
              at com.ica.mobility.util.CustomInInterceptor.processRequest(CustomInInterceptor.java:242)
              at com.ica.mobility.util.CustomInInterceptor.handleMessage(CustomInInterceptor.java:77)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:244)
              ... 28 more
      

      I hope you have all the information you need.

      Cheers,

      Ivan

      1. WebApplication1_v2.rar
        8.71 MB
        Ivan Vitoria
      2. SampleGenericCXFApplication_v2.rar
        9.33 MB
        Ivan Vitoria
      3. SampleGenericCXFApplication_v2.part2.rar
        7.78 MB
        Ivan Vitoria
      4. SampleGenericCXFApplication_v2.part1.rar
        9.54 MB
        Ivan Vitoria
      5. WebApplication1 (WAR).rar
        9.19 MB
        Ivan Vitoria
      6. SampleGenericCXFApplication_v1.part2.rar
        7.79 MB
        Ivan Vitoria
      7. SampleGenericCXFApplication_v1.part1.rar
        9.54 MB
        Ivan Vitoria

        Activity

        Hide
        Sergey Beryozkin added a comment -

        Hi Ivan

        I'm sorry it took me few days to investigate this issue. It looks complex enough so I opted for looking at the issues for which
        I could find some time and solve fast...

        I've tried a basic test with a concrete implementation extending IRestService and I could not get this NPE.
        It does look like that as far as the application of the external model is concerned it works fine. that is the correct methods are invoked.

        I'm kind of missing a bit how GenericRestServiceImpl<T, PK extends Long> is instantiated.
        Besides, I'm bit puzzled by

        java.lang.NullPointerException
        at java.lang.Class.isAssignableFrom(Native Method)
        at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:554)
        at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89)
        at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457)
        at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425)
        at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269)
        at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279)
        at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:960)
        at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:575)
        at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:540)
        at com.ica.mobility.util.CustomInInterceptor.processRequest(CustomInInterceptor.java:242)

        do you extend JAXRSInInterceptor ?

        By the way, here is the signature of isReadable :

        public boolean isReadable(Class<?> type, Type genericType, Annotation[] anns, MediaType mt) {}

        so the first argument, 'Class type' is null - which is very strange...

        If you could either debug or attach a test project then it would be the fastest way...I'd like to get rid of this NPE asap but
        I'll need your help

        thanks, Sergey

        Show
        Sergey Beryozkin added a comment - Hi Ivan I'm sorry it took me few days to investigate this issue. It looks complex enough so I opted for looking at the issues for which I could find some time and solve fast... I've tried a basic test with a concrete implementation extending IRestService and I could not get this NPE. It does look like that as far as the application of the external model is concerned it works fine. that is the correct methods are invoked. I'm kind of missing a bit how GenericRestServiceImpl<T, PK extends Long> is instantiated. Besides, I'm bit puzzled by java.lang.NullPointerException at java.lang.Class.isAssignableFrom(Native Method) at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:554) at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89) at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457) at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425) at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269) at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279) at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:960) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:575) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:540) at com.ica.mobility.util.CustomInInterceptor.processRequest(CustomInInterceptor.java:242) do you extend JAXRSInInterceptor ? By the way, here is the signature of isReadable : public boolean isReadable(Class<?> type, Type genericType, Annotation[] anns, MediaType mt) {} so the first argument, 'Class type' is null - which is very strange... If you could either debug or attach a test project then it would be the fastest way...I'd like to get rid of this NPE asap but I'll need your help thanks, Sergey
        Hide
        Ivan Vitoria added a comment -

        Hi Sergey,

        When I saw that 'Class type' was null I decided to open this JIRA...

        Attached please find a NetBeans 6.9 Sample Project which has been splitted in two files.

        I use SQL Server 2008 as DBMS but let me know if you need i adapt the application for another DBMS (like MySQL).

        If you try to make either GET (http://localhost:8080/WebApplication1/sample-servlet/sample?id=1) or POST (http://localhost:8080/WebApplication1/sample-servlet/sample/addworks) request, there is no exception. However, if you try to make a POST using a method with generic parameter (http://localhost:8080/WebApplication1/sample-servlet/sample/add) a NPE is thrown.

        As you can see, I don't extend JAXRSInInterceptor.

        Thanks for your reply,

        Ivan

        Show
        Ivan Vitoria added a comment - Hi Sergey, When I saw that 'Class type' was null I decided to open this JIRA... Attached please find a NetBeans 6.9 Sample Project which has been splitted in two files. I use SQL Server 2008 as DBMS but let me know if you need i adapt the application for another DBMS (like MySQL). If you try to make either GET ( http://localhost:8080/WebApplication1/sample-servlet/sample?id=1 ) or POST ( http://localhost:8080/WebApplication1/sample-servlet/sample/addworks ) request, there is no exception. However, if you try to make a POST using a method with generic parameter ( http://localhost:8080/WebApplication1/sample-servlet/sample/add ) a NPE is thrown. As you can see, I don't extend JAXRSInInterceptor. Thanks for your reply, Ivan
        Hide
        Sergey Beryozkin added a comment -

        Hi Ivan

        thanks for attaching the project.

        I'm just wondering, can you have NetBeans to create a war for you so that I can just drop it Tomcat ?
        Also - would it be possible to have only a single method on IRestService and GenericRestServiceImpl ?

        public class GenericRestServiceImpl<T, PK extends Long> implements IRestService<T, PK>
        {
        public PK add(T instance)

        { return null; }

        }

        and have all the DB dependencies removed from the test project ?

        This is because NPE is happening before this method is invoked.
        If you could do it during the next couple of hours then I might be able to squeeze a fix in before the release is done...

        thanks, Sergey

        Show
        Sergey Beryozkin added a comment - Hi Ivan thanks for attaching the project. I'm just wondering, can you have NetBeans to create a war for you so that I can just drop it Tomcat ? Also - would it be possible to have only a single method on IRestService and GenericRestServiceImpl ? public class GenericRestServiceImpl<T, PK extends Long> implements IRestService<T, PK> { public PK add(T instance) { return null; } } and have all the DB dependencies removed from the test project ? This is because NPE is happening before this method is invoked. If you could do it during the next couple of hours then I might be able to squeeze a fix in before the release is done... thanks, Sergey
        Hide
        Ivan Vitoria added a comment -

        This is war file without DDBB dependencies. Also, it only has the "add method" as you suggested. Tell me if source code which has been modified is needed.

        Show
        Ivan Vitoria added a comment - This is war file without DDBB dependencies. Also, it only has the "add method" as you suggested. Tell me if source code which has been modified is needed.
        Hide
        Sergey Beryozkin added a comment -

        I'm on it - Dan - please hold off the release till 14.00 your time, if possible

        Show
        Sergey Beryozkin added a comment - I'm on it - Dan - please hold off the release till 14.00 your time, if possible
        Hide
        Sergey Beryozkin added a comment -

        I haven't managed to fix it so far, I'm afraid I'll have to investigate after the release.

        What I've found so far though is that there's no any concrete type information associated with T.
        In all my tests I have static information available in concrete implementations extending generic classes
        or implementing generic interfaces.

        This is exactly the reason why I suspect you have methods with PK parameters invoked successfully. Because PK extends Long
        and this is what CXF manages to get to...

        Can you please for the sake of the test, have

        <T extends MobilityUser, PK extends Long> ?

        lets see if it works and if yes then we can try to figure out how to fix it...

        Show
        Sergey Beryozkin added a comment - I haven't managed to fix it so far, I'm afraid I'll have to investigate after the release. What I've found so far though is that there's no any concrete type information associated with T. In all my tests I have static information available in concrete implementations extending generic classes or implementing generic interfaces. This is exactly the reason why I suspect you have methods with PK parameters invoked successfully. Because PK extends Long and this is what CXF manages to get to... Can you please for the sake of the test, have <T extends MobilityUser, PK extends Long> ? lets see if it works and if yes then we can try to figure out how to fix it...
        Hide
        Ivan Vitoria added a comment -

        Hi,

        Extending T from SampleBean, another exception is thrown (may InvalidCastException be??):

        Server Log
        
        08-oct-2010 9:33:32 org.apache.cxf.interceptor.LoggingInInterceptor logging
        INFO: Inbound Message
        ----------------------------
        ID: 3
        Address: /WebApplication1/sample-servlet/sample/add
        Encoding: ISO-8859-1
        Content-Type: application/xml
        Headers: {content-type=[application/xml], host=[localhost:8080], Content-Length=[135], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[application/xml]}
        Payload: <SampleBean>
                <id>1</id>
                <name>Name</name>
                <surnames>Surnames</surnames>
                <address>Address</address>
                <city>City</city>
        </SampleBean>
        --------------------------------------
        08-oct-2010 9:33:32 org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
        ADVERTENCIA: WebApplicationException has been caught : sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class
        08-oct-2010 9:33:32 org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
        INFO: Outbound Message
        ---------------------------
        ID: 3
        Response-Code: 500
        Content-Type: text/xml
        Headers: {Date=[Fri, 08 Oct 2010 07:33:32 GMT]}
        --------------------------------------
        

        Any idea?

        Ivan

        Show
        Ivan Vitoria added a comment - Hi, Extending T from SampleBean, another exception is thrown (may InvalidCastException be??): Server Log 08-oct-2010 9:33:32 org.apache.cxf.interceptor.LoggingInInterceptor logging INFO: Inbound Message ---------------------------- ID: 3 Address: /WebApplication1/sample-servlet/sample/add Encoding: ISO-8859-1 Content-Type: application/xml Headers: {content-type=[application/xml], host=[localhost:8080], Content-Length=[135], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[application/xml]} Payload: <SampleBean> <id>1</id> <name>Name</name> <surnames>Surnames</surnames> <address>Address</address> <city>City</city> </SampleBean> -------------------------------------- 08-oct-2010 9:33:32 org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse ADVERTENCIA: WebApplicationException has been caught : sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang. Class 08-oct-2010 9:33:32 org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose INFO: Outbound Message --------------------------- ID: 3 Response-Code: 500 Content-Type: text/xml Headers: {Date=[Fri, 08 Oct 2010 07:33:32 GMT]} -------------------------------------- Any idea? Ivan
        Hide
        Benson Margulies added a comment -

        As I recall, I was the guy who originally trucked around the JAX-RS code trying to wire up all the additional reflection needed to make generic work (when it was possible). The intent of the spec was somewhat unclear to me as to what they expected to work, given type erasure.

        Given a clear test case I can eventually find some time to help Sergey with this.

        Show
        Benson Margulies added a comment - As I recall, I was the guy who originally trucked around the JAX-RS code trying to wire up all the additional reflection needed to make generic work (when it was possible). The intent of the spec was somewhat unclear to me as to what they expected to work, given type erasure. Given a clear test case I can eventually find some time to help Sergey with this.
        Hide
        Ivan Vitoria added a comment -

        Thanks Benson. I'm sure your experience will be very helpful. Find attached the simplest test I've done, which is source code of previous war.

        Let me know if you need anything else.

        Ivan

        Show
        Ivan Vitoria added a comment - Thanks Benson. I'm sure your experience will be very helpful. Find attached the simplest test I've done, which is source code of previous war. Let me know if you need anything else. Ivan
        Hide
        Sergey Beryozkin added a comment -

        Hi Ivan

        I think in the previous war the type information is really not available for T - Benson may prove me wrong but I think the fact you have a parameterized
        GenericServiceImpl does not mean the actual type info will be available at runtime if we have Spring instantiating it, etc...

        I'm surprised though you;re seeing a class cast exception when you have
        <T extends SampleBean, PK extends Long>

        given that you do not see it for PK...
        But it is probably a bug...

        Show
        Sergey Beryozkin added a comment - Hi Ivan I think in the previous war the type information is really not available for T - Benson may prove me wrong but I think the fact you have a parameterized GenericServiceImpl does not mean the actual type info will be available at runtime if we have Spring instantiating it, etc... I'm surprised though you;re seeing a class cast exception when you have <T extends SampleBean, PK extends Long> given that you do not see it for PK... But it is probably a bug...
        Hide
        Benson Margulies added a comment -

        We're probably indeed out of luck here.

        Erasure throws away all the generic type info. Outside of Spring, there's the possibility of reflecting into, say, a field declared with the same type, and thus obtaining the information in the form of a Type reference. Unless Spring has gotten into the business of creating and handing out full Type references, it will all be gone by the time we get there. However, it will be some days before I can really look at this.

        Show
        Benson Margulies added a comment - We're probably indeed out of luck here. Erasure throws away all the generic type info. Outside of Spring, there's the possibility of reflecting into, say, a field declared with the same type, and thus obtaining the information in the form of a Type reference. Unless Spring has gotten into the business of creating and handing out full Type references, it will all be gone by the time we get there. However, it will be some days before I can really look at this.
        Hide
        Ivan Vitoria added a comment -

        Sorry guys, I've been out a few days. Do you think I should ask a solution in spring forum?

        At the moment, the workaround is not to use generic types. However, this is not the solution which i would like to have.

        Thanks,

        Ivan

        Show
        Ivan Vitoria added a comment - Sorry guys, I've been out a few days. Do you think I should ask a solution in spring forum? At the moment, the workaround is not to use generic types. However, this is not the solution which i would like to have. Thanks, Ivan
        Hide
        Sergey Beryozkin added a comment -

        hi, I committed some fixes yesterday evening.
        So

        <T extends SampleBean, PK extends Long>

        really has to work now with the latest snapshots.

        But

        <T, PK extends Long>

        probably will not - please ask at the Spring forum - if it is possible that for this case at some point of time Spring is able to provide some type information ?

        but

        <T extends SampleBean, PK extends Long>

        should work now...

        Show
        Sergey Beryozkin added a comment - hi, I committed some fixes yesterday evening. So <T extends SampleBean, PK extends Long> really has to work now with the latest snapshots. But <T, PK extends Long> probably will not - please ask at the Spring forum - if it is possible that for this case at some point of time Spring is able to provide some type information ? but <T extends SampleBean, PK extends Long> should work now...
        Hide
        Ivan Vitoria added a comment -

        hi,

        I've opened a new thread at spring forum ( http://forum.springsource.org/showthread.php?p=324092#post324092 ). As you can see, I'm still waiting for someone to answer me...

        Show
        Ivan Vitoria added a comment - hi, I've opened a new thread at spring forum ( http://forum.springsource.org/showthread.php?p=324092#post324092 ). As you can see, I'm still waiting for someone to answer me...
        Hide
        Sergey Beryozkin added a comment -

        Hi Ivan

        I'm going to close this issue given that

        <T extends SampleBean, PK extends Long>

        must work in 2.2.11 and 2.3.

        There's really nothing we can do if the root resource class
        is annotated with <T, PK extends Long> as there's no type info for T is available at runtime.

        Please reopen this issue if

        <T extends SampleBean, PK extends Long>

        does not work with 2.2.11/2.3

        thanks

        Show
        Sergey Beryozkin added a comment - Hi Ivan I'm going to close this issue given that <T extends SampleBean, PK extends Long> must work in 2.2.11 and 2.3. There's really nothing we can do if the root resource class is annotated with <T, PK extends Long> as there's no type info for T is available at runtime. Please reopen this issue if <T extends SampleBean, PK extends Long> does not work with 2.2.11/2.3 thanks
        Hide
        Ivan Vitoria added a comment -

        Hi guys,

        I've tried GenericRestServiceImpl<T extends SampleBean, PK extends Long> implements IRestService<T, PK> with the latest version (2.3) and it still not working... The same exception was thrown.

        Server Log
        08-nov-2010 10:49:15 org.apache.cxf.interceptor.AbstractLoggingInterceptor log
        INFO: Inbound Message
        ----------------------------
        ID: 2
        Address: /WebApplication1/sample-servlet/sample/add
        Encoding: ISO-8859-1
        Content-Type: application/xml
        Headers: {content-type=[application/xml], host=[localhost:8080], Content-Length=[170], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[application/xml]}
        Payload: <SampleBean>
                <id>1</id>
                <name>Name</name>
                <surnames>Surnames</surnames>
                <address>Address</address>
                <city>City</city>
        </SampleBean>
        --------------------------------------
        08-nov-2010 10:49:15 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
        ADVERTENCIA: Interceptor for {http://service.sample.ica.com/}IRestService has thrown exception, unwinding now
        java.lang.NullPointerException
                at java.lang.Class.isAssignableFrom(Native Method)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:558)
                at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:966)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:576)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:541)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
                at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
                at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
                at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146)
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
                at java.lang.Thread.run(Thread.java:619)
        08-nov-2010 10:49:15 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
        ADVERTENCIA: Interceptor for {http://service.sample.ica.com/}IRestService has thrown exception, unwinding now
        org.apache.cxf.interceptor.Fault
                at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303)
                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
                at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
                at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
                at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146)
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
                at java.lang.Thread.run(Thread.java:619)
        Caused by: java.lang.NullPointerException
                at java.lang.Class.isAssignableFrom(Native Method)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:558)
                at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:966)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:576)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:541)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
                ... 28 more
        08-nov-2010 10:49:15 org.apache.cxf.phase.PhaseInterceptorChain unwind
        ADVERTENCIA: Exception in handleFault on interceptor org.apache.cxf.binding.xml.interceptor.XMLFaultOutInterceptor@aa064a
        org.apache.cxf.interceptor.Fault
                at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303)
                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
                at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
                at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
                at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146)
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
                at java.lang.Thread.run(Thread.java:619)
        Caused by: java.lang.NullPointerException
                at java.lang.Class.isAssignableFrom(Native Method)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:558)
                at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:966)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:576)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:541)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
                ... 28 more
        08-nov-2010 10:49:15 org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver onMessage
        GRAVE: Error occurred during error handling, give up!
        org.apache.cxf.interceptor.Fault
                at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303)
                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
                at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
                at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
                at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146)
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
                at java.lang.Thread.run(Thread.java:619)
        Caused by: java.lang.NullPointerException
                at java.lang.Class.isAssignableFrom(Native Method)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:558)
                at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269)
                at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:966)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:576)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:541)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
                ... 28 more
        

        Ivan

        Show
        Ivan Vitoria added a comment - Hi guys, I've tried GenericRestServiceImpl<T extends SampleBean, PK extends Long> implements IRestService<T, PK> with the latest version (2.3) and it still not working... The same exception was thrown. Server Log 08-nov-2010 10:49:15 org.apache.cxf.interceptor.AbstractLoggingInterceptor log INFO: Inbound Message ---------------------------- ID: 2 Address: /WebApplication1/sample-servlet/sample/add Encoding: ISO-8859-1 Content-Type: application/xml Headers: {content-type=[application/xml], host=[localhost:8080], Content-Length=[170], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[application/xml]} Payload: <SampleBean> <id>1</id> <name>Name</name> <surnames>Surnames</surnames> <address>Address</address> <city>City</city> </SampleBean> -------------------------------------- 08-nov-2010 10:49:15 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging ADVERTENCIA: Interceptor for {http: //service.sample.ica.com/}IRestService has thrown exception, unwinding now java.lang.NullPointerException at java.lang. Class .isAssignableFrom(Native Method) at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:558) at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89) at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457) at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425) at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269) at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279) at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:966) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:576) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:541) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang. Thread .run( Thread .java:619) 08-nov-2010 10:49:15 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging ADVERTENCIA: Interceptor for {http: //service.sample.ica.com/}IRestService has thrown exception, unwinding now org.apache.cxf.interceptor.Fault at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang. Thread .run( Thread .java:619) Caused by: java.lang.NullPointerException at java.lang. Class .isAssignableFrom(Native Method) at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:558) at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89) at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457) at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425) at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269) at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279) at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:966) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:576) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:541) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247) ... 28 more 08-nov-2010 10:49:15 org.apache.cxf.phase.PhaseInterceptorChain unwind ADVERTENCIA: Exception in handleFault on interceptor org.apache.cxf.binding.xml.interceptor.XMLFaultOutInterceptor@aa064a org.apache.cxf.interceptor.Fault at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang. Thread .run( Thread .java:619) Caused by: java.lang.NullPointerException at java.lang. Class .isAssignableFrom(Native Method) at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:558) at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89) at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457) at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425) at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269) at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279) at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:966) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:576) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:541) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247) ... 28 more 08-nov-2010 10:49:15 org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver onMessage GRAVE: Error occurred during error handling, give up! org.apache.cxf.interceptor.Fault at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang. Thread .run( Thread .java:619) Caused by: java.lang.NullPointerException at java.lang. Class .isAssignableFrom(Native Method) at org.apache.cxf.jaxrs.utils.InjectionUtils.isSupportedCollectionOrArray(InjectionUtils.java:558) at org.apache.cxf.jaxrs.provider.JAXBElementProvider.isReadable(JAXBElementProvider.java:89) at org.apache.cxf.jaxrs.provider.ProviderFactory.matchesReaderCriterias(ProviderFactory.java:457) at org.apache.cxf.jaxrs.provider.ProviderFactory.chooseMessageReader(ProviderFactory.java:425) at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:269) at org.apache.cxf.jaxrs.provider.ProviderFactory.createMessageBodyReader(ProviderFactory.java:279) at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:966) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:576) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:541) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247) ... 28 more Ivan
        Hide
        Sergey Beryozkin added a comment -

        Hmm...

        This NPE should've been fixed.

        I have this test resources which are properly introspected :

        @Path("/books")
        public class GenericEntityImpl2<T extends Book> implements GenericEntity2 {

        private T book;

        @POST
        public void postEntity(T object)

        { book = object; }

        public T getEntity()

        { return book; }

        }

        public interface GenericEntity2<T extends Book> {
        }

        This works if I do

        public class GenericEntityImpl2<T extends Book> implements GenericEntity2<T> as well...

        Are you sure no 2.2.10 or old 2.3-SNAPSHOT is visible ?

        I know you've attached quite a few attachements , but if it is still an issue then please attach a simple war (no DB dependencies) :
        resource class and the interface, plus a SampleBean class, and the source for them as well

        thanks, Sergey

        Show
        Sergey Beryozkin added a comment - Hmm... This NPE should've been fixed. I have this test resources which are properly introspected : @Path("/books") public class GenericEntityImpl2<T extends Book> implements GenericEntity2 { private T book; @POST public void postEntity(T object) { book = object; } public T getEntity() { return book; } } public interface GenericEntity2<T extends Book> { } This works if I do public class GenericEntityImpl2<T extends Book> implements GenericEntity2<T> as well... Are you sure no 2.2.10 or old 2.3-SNAPSHOT is visible ? I know you've attached quite a few attachements , but if it is still an issue then please attach a simple war (no DB dependencies) : resource class and the interface, plus a SampleBean class, and the source for them as well thanks, Sergey
        Hide
        Ivan Vitoria added a comment -

        Hi,

        The NPE has been fixed. However, a WebApplicationException is thrown... (and caught)

        Server Log
        08-nov-2010 13:24:25 org.apache.cxf.interceptor.AbstractLoggingInterceptor log
        INFO: Inbound Message
        ----------------------------
        ID: 1
        Address: /WebApplication1/sample-servlet/sample/add
        Encoding: ISO-8859-1
        Content-Type: application/xml
        Headers: {content-type=[application/xml], host=[localhost:8080], Content-Length=[170], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[application/xml]}
        Payload: <SampleBean>
                <id>1</id>
                <name>Name</name>
                <surnames>Surnames</surnames>
                <address>Address</address>
                <city>City</city>
        </SampleBean>
        --------------------------------------
        08-nov-2010 13:24:25 org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
        ADVERTENCIA: WebApplicationException has been caught : sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class
        08-nov-2010 13:24:25 org.apache.cxf.interceptor.AbstractLoggingInterceptor log
        INFO: Outbound Message
        ---------------------------
        ID: 1
        Response-Code: 500
        Content-Type: text/xml
        Headers: {Date=[Mon, 08 Nov 2010 12:24:25 GMT]}
        

        I've attached the war/sources with no DDBB dependencies and only the necessary libraries.

        As you can see, I use XML model resources instead of annotations.

        Thanks!

        Ivan

        Show
        Ivan Vitoria added a comment - Hi, The NPE has been fixed. However, a WebApplicationException is thrown... (and caught) Server Log 08-nov-2010 13:24:25 org.apache.cxf.interceptor.AbstractLoggingInterceptor log INFO: Inbound Message ---------------------------- ID: 1 Address: /WebApplication1/sample-servlet/sample/add Encoding: ISO-8859-1 Content-Type: application/xml Headers: {content-type=[application/xml], host=[localhost:8080], Content-Length=[170], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[application/xml]} Payload: <SampleBean> <id>1</id> <name>Name</name> <surnames>Surnames</surnames> <address>Address</address> <city>City</city> </SampleBean> -------------------------------------- 08-nov-2010 13:24:25 org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse ADVERTENCIA: WebApplicationException has been caught : sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang. Class 08-nov-2010 13:24:25 org.apache.cxf.interceptor.AbstractLoggingInterceptor log INFO: Outbound Message --------------------------- ID: 1 Response-Code: 500 Content-Type: text/xml Headers: {Date=[Mon, 08 Nov 2010 12:24:25 GMT]} I've attached the war/sources with no DDBB dependencies and only the necessary libraries. As you can see, I use XML model resources instead of annotations. Thanks! Ivan
        Hide
        Sergey Beryozkin added a comment -

        Ok, hopefully it is really fixed - can you please verify it with 2.4.0-SNAPSHOT ?

        many thanks

        Show
        Sergey Beryozkin added a comment - Ok, hopefully it is really fixed - can you please verify it with 2.4.0-SNAPSHOT ? many thanks
        Hide
        Ivan Vitoria added a comment -

        I've just checked it with 2.4.0-SNAPSHOT. Now the POST method works properly! However, the GET method throws a RuntimeException (may be something that not works with PK extends Long...)

        Server Log
        18-nov-2010 9:56:41 org.apache.cxf.interceptor.AbstractLoggingInterceptor log
        INFO: Inbound Message
        ----------------------------
        ID: 4
        Address: /WebApplication1/sample-servlet/sample/1
        Content-Type: 
        Headers: {host=[localhost:8080], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[null]}
        --------------------------------------
        18-nov-2010 9:56:41 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
        ADVERTENCIA: Interceptor for {http://service.sample.ica.com/}GenericRestServiceImpl has thrown exception, unwinding now
        java.lang.RuntimeException: No type can be found at position 1
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getType(InjectionUtils.java:222)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:210)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:217)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getSuperType(InjectionUtils.java:130)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:536)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
                at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
                at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461)
                at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
                at java.lang.Thread.run(Thread.java:619)
        18-nov-2010 9:56:41 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
        ADVERTENCIA: Interceptor for {http://service.sample.ica.com/}GenericRestServiceImpl has thrown exception, unwinding now
        org.apache.cxf.interceptor.Fault: No type can be found at position 1
                at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303)
                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
                at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
                at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461)
                at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
                at java.lang.Thread.run(Thread.java:619)
        Caused by: java.lang.RuntimeException: No type can be found at position 1
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getType(InjectionUtils.java:222)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:210)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:217)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getSuperType(InjectionUtils.java:130)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:536)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
                ... 24 more
        18-nov-2010 9:56:41 org.apache.cxf.phase.PhaseInterceptorChain unwind
        ADVERTENCIA: Exception in handleFault on interceptor org.apache.cxf.binding.xml.interceptor.XMLFaultOutInterceptor@120e870
        org.apache.cxf.interceptor.Fault: No type can be found at position 1
                at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303)
                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
                at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
                at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461)
                at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
                at java.lang.Thread.run(Thread.java:619)
        Caused by: java.lang.RuntimeException: No type can be found at position 1
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getType(InjectionUtils.java:222)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:210)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:217)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getSuperType(InjectionUtils.java:130)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:536)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
                ... 24 more
        18-nov-2010 9:56:41 org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver onMessage
        GRAVE: Error occurred during error handling, give up!
        org.apache.cxf.interceptor.Fault: No type can be found at position 1
                at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303)
                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
                at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
                at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461)
                at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
                at java.lang.Thread.run(Thread.java:619)
        Caused by: java.lang.RuntimeException: No type can be found at position 1
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getType(InjectionUtils.java:222)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:210)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:217)
                at org.apache.cxf.jaxrs.utils.InjectionUtils.getSuperType(InjectionUtils.java:130)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:536)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
                ... 24 more
        

        I feel we are very close to the solution. Sergey good job!

        Show
        Ivan Vitoria added a comment - I've just checked it with 2.4.0-SNAPSHOT. Now the POST method works properly! However, the GET method throws a RuntimeException (may be something that not works with PK extends Long...) Server Log 18-nov-2010 9:56:41 org.apache.cxf.interceptor.AbstractLoggingInterceptor log INFO: Inbound Message ---------------------------- ID: 4 Address: /WebApplication1/sample-servlet/sample/1 Content-Type: Headers: {host=[localhost:8080], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[ null ]} -------------------------------------- 18-nov-2010 9:56:41 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging ADVERTENCIA: Interceptor for {http: //service.sample.ica.com/}GenericRestServiceImpl has thrown exception, unwinding now java.lang.RuntimeException: No type can be found at position 1 at org.apache.cxf.jaxrs.utils.InjectionUtils.getType(InjectionUtils.java:222) at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:210) at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:217) at org.apache.cxf.jaxrs.utils.InjectionUtils.getSuperType(InjectionUtils.java:130) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:536) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang. Thread .run( Thread .java:619) 18-nov-2010 9:56:41 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging ADVERTENCIA: Interceptor for {http: //service.sample.ica.com/}GenericRestServiceImpl has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: No type can be found at position 1 at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang. Thread .run( Thread .java:619) Caused by: java.lang.RuntimeException: No type can be found at position 1 at org.apache.cxf.jaxrs.utils.InjectionUtils.getType(InjectionUtils.java:222) at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:210) at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:217) at org.apache.cxf.jaxrs.utils.InjectionUtils.getSuperType(InjectionUtils.java:130) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:536) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247) ... 24 more 18-nov-2010 9:56:41 org.apache.cxf.phase.PhaseInterceptorChain unwind ADVERTENCIA: Exception in handleFault on interceptor org.apache.cxf.binding.xml.interceptor.XMLFaultOutInterceptor@120e870 org.apache.cxf.interceptor.Fault: No type can be found at position 1 at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang. Thread .run( Thread .java:619) Caused by: java.lang.RuntimeException: No type can be found at position 1 at org.apache.cxf.jaxrs.utils.InjectionUtils.getType(InjectionUtils.java:222) at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:210) at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:217) at org.apache.cxf.jaxrs.utils.InjectionUtils.getSuperType(InjectionUtils.java:130) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:536) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247) ... 24 more 18-nov-2010 9:56:41 org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver onMessage GRAVE: Error occurred during error handling, give up! org.apache.cxf.interceptor.Fault: No type can be found at position 1 at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:67) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:303) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang. Thread .run( Thread .java:619) Caused by: java.lang.RuntimeException: No type can be found at position 1 at org.apache.cxf.jaxrs.utils.InjectionUtils.getType(InjectionUtils.java:222) at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:210) at org.apache.cxf.jaxrs.utils.InjectionUtils.getActualType(InjectionUtils.java:217) at org.apache.cxf.jaxrs.utils.InjectionUtils.getSuperType(InjectionUtils.java:130) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:536) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247) ... 24 more I feel we are very close to the solution. Sergey good job!
        Hide
        Sergey Beryozkin added a comment -

        Hi - thanks for the fast feedback.
        I was absolutely sure the exception you are reporting was also addressed - I did see it during the testing and I have a test doing GET,

        see

        http://svn.apache.org/viewvc?rev=1036258&view=rev

        Let me verify it again on my end and please double check on your end as well

        cheers, Sergey

        Show
        Sergey Beryozkin added a comment - Hi - thanks for the fast feedback. I was absolutely sure the exception you are reporting was also addressed - I did see it during the testing and I have a test doing GET, see http://svn.apache.org/viewvc?rev=1036258&view=rev Let me verify it again on my end and please double check on your end as well cheers, Sergey
        Hide
        Sergey Beryozkin added a comment -

        It definitely works on my side. The problem is that the 2.4.0-SNAPSHOT build did not finish yesterday.
        Can you try and checkout the trunk source and just do
        'mvn -Pfastinstall' then go to distribution/bundles/jaxrs and build and cp it into your webapp lib ? You'd need to remove a soap import in
        the application-context.xml though. This will take just 15 mins max

        thanks, Sergey

        Show
        Sergey Beryozkin added a comment - It definitely works on my side. The problem is that the 2.4.0-SNAPSHOT build did not finish yesterday. Can you try and checkout the trunk source and just do 'mvn -Pfastinstall' then go to distribution/bundles/jaxrs and build and cp it into your webapp lib ? You'd need to remove a soap import in the application-context.xml though. This will take just 15 mins max thanks, Sergey
        Hide
        Ivan Vitoria added a comment -

        Hi Sergey,

        Currently I have several fronts that keep me busy. As soon as possible, I'll go for it...

        cheers,

        Ivan

        Show
        Ivan Vitoria added a comment - Hi Sergey, Currently I have several fronts that keep me busy. As soon as possible, I'll go for it... cheers, Ivan
        Hide
        Ivan Vitoria added a comment -

        Hi!

        I've followed your instructions and i've checked again with the resulting jar.GET and POST methods both work properly with T extends SampleBean. However, if we try to use T extends GenericBean while SampleBean extends GenericBean, a JAXB exception is throwed.

        Unable to find source-code formatter for language: genericrestserviceimpl.java. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
        public class GenericRestServiceImpl<T extends GenericBean, PK extends Long> implements IRestService<T, PK>
        {
        
            private T entity = null;
        
            @Override
            public T getById(PK id)
            {
                return this.entity;
            }
        
            @Override
            public PK add(T instance)
            {
                this.entity = instance;
                return null;
            }
        
            // Other methos omitted
        }
        
        Unable to find source-code formatter for language: samplebean.java. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
        @XmlRootElement
        public class SampleBean extends GenericBean
        {
            private String city;
        
            public SampleBean()
            {
            }
        
            public String getCity()
            {
                return city;
            }
        
            public void setCity(String city)
            {
                this.city = city;
            }
        }
        
        Unable to find source-code formatter for language: genericbean.java. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
        @XmlRootElement
        public class GenericBean implements Serializable
        {
            private Long id;
            private String name;
            private String surnames;
            private String address;
        
            public String getAddress()
            {
                return address;
            }
        
            public void setAddress(String address)
            {
                this.address = address;
            }
        
            public Long getId()
            {
                return id;
            }
        
            public void setId(Long id)
            {
                this.id = id;
            }
        
            public String getName()
            {
                return name;
            }
        
            public void setName(String name)
            {
                this.name = name;
            }
        
            public String getSurnames()
            {
                return surnames;
            }
        
            public void setSurnames(String surnames)
            {
                this.surnames = surnames;
            }
        
        }
        
        Unable to find source-code formatter for language: server log. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
        19-nov-2010 15:04:46 org.apache.cxf.interceptor.AbstractLoggingInterceptor log
        INFO: Inbound Message
        ----------------------------
        ID: 6
        Address: /WebApplication1/sample-servlet/sample/
        Encoding: ISO-8859-1
        Content-Type: application/xml
        Headers: {content-type=[application/xml], host=[localhost:8080], Content-Length=[145], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[application/xml]}
        Payload: <sampleBean>
           <address>Address</address>
           <id>2</id>
           <name>Name</name>
           <surnames>Surnames</surnames>
           <city>City</city>
        </sampleBean>
        --------------------------------------
        19-nov-2010 15:04:46 org.apache.cxf.jaxrs.provider.AbstractJAXBProvider handleJAXBException
        ADVERTENCIA: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"sampleBean"). Expected elements are <{}genericBean>
                at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:642)
                at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:254)
                at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:249)
                at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116)
                at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1049)
                at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:478)
                at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:459)
                at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:148)
                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103)
                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
                at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
                at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:211)
                at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:184)
                at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
                at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
                at org.apache.cxf.jaxrs.provider.JAXBElementProvider.unmarshalFromInputStream(JAXBElementProvider.java:224)
                at org.apache.cxf.jaxrs.provider.JAXBElementProvider.doUnmarshal(JAXBElementProvider.java:195)
                at org.apache.cxf.jaxrs.provider.JAXBElementProvider.readFrom(JAXBElementProvider.java:166)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:981)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:581)
                at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:546)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230)
                at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
                at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
                at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461)
                at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)
                at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
                at java.lang.Thread.run(Thread.java:619)
        
        19-nov-2010 15:04:46 org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
        ADVERTENCIA: WebApplicationException has been caught : unexpected element (uri:"", local:"sampleBean"). Expected elements are <{}genericBean>
        19-nov-2010 15:04:46 org.apache.cxf.interceptor.AbstractLoggingInterceptor log
        INFO: Outbound Message
        ---------------------------
        ID: 6
        Response-Code: 500
        Content-Type: text/plain
        Headers: {Content-Type=[text/plain], Date=[Fri, 19 Nov 2010 14:04:46 GMT]}
        Payload: JAXBException occurred : unexpected element (uri:"", local:"sampleBean"). Expected elements are <{}genericBean>. 
        --------------------------------------
        

        thanks,

        Ivan

        Show
        Ivan Vitoria added a comment - Hi! I've followed your instructions and i've checked again with the resulting jar.GET and POST methods both work properly with T extends SampleBean. However, if we try to use T extends GenericBean while SampleBean extends GenericBean, a JAXB exception is throwed. Unable to find source-code formatter for language: genericrestserviceimpl.java. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml public class GenericRestServiceImpl<T extends GenericBean, PK extends Long > implements IRestService<T, PK> { private T entity = null ; @Override public T getById(PK id) { return this .entity; } @Override public PK add(T instance) { this .entity = instance; return null ; } // Other methos omitted } Unable to find source-code formatter for language: samplebean.java. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml @XmlRootElement public class SampleBean extends GenericBean { private String city; public SampleBean() { } public String getCity() { return city; } public void setCity( String city) { this .city = city; } } Unable to find source-code formatter for language: genericbean.java. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml @XmlRootElement public class GenericBean implements Serializable { private Long id; private String name; private String surnames; private String address; public String getAddress() { return address; } public void setAddress( String address) { this .address = address; } public Long getId() { return id; } public void setId( Long id) { this .id = id; } public String getName() { return name; } public void setName( String name) { this .name = name; } public String getSurnames() { return surnames; } public void setSurnames( String surnames) { this .surnames = surnames; } } Unable to find source-code formatter for language: server log. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml 19-nov-2010 15:04:46 org.apache.cxf.interceptor.AbstractLoggingInterceptor log INFO: Inbound Message ---------------------------- ID: 6 Address: /WebApplication1/sample-servlet/sample/ Encoding: ISO-8859-1 Content-Type: application/xml Headers: {content-type=[application/xml], host=[localhost:8080], Content-Length=[145], user-agent=[Jakarta Commons-HttpClient/3.1], accept-encoding=[gzip,deflate], Content-Type=[application/xml]} Payload: <sampleBean> <address>Address</address> <id>2</id> <name>Name</name> <surnames>Surnames</surnames> <city>City</city> </sampleBean> -------------------------------------- 19-nov-2010 15:04:46 org.apache.cxf.jaxrs.provider.AbstractJAXBProvider handleJAXBException ADVERTENCIA: javax.xml.bind.UnmarshalException: unexpected element (uri: "", local:" sampleBean"). Expected elements are <{}genericBean> at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:642) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:254) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:249) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1049) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:478) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:459) at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:211) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:184) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184) at org.apache.cxf.jaxrs.provider.JAXBElementProvider.unmarshalFromInputStream(JAXBElementProvider.java:224) at org.apache.cxf.jaxrs.provider.JAXBElementProvider.doUnmarshal(JAXBElementProvider.java:195) at org.apache.cxf.jaxrs.provider.JAXBElementProvider.readFrom(JAXBElementProvider.java:166) at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:981) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:581) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:546) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:230) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang. Thread .run( Thread .java:619) 19-nov-2010 15:04:46 org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse ADVERTENCIA: WebApplicationException has been caught : unexpected element (uri: "", local:" sampleBean"). Expected elements are <{}genericBean> 19-nov-2010 15:04:46 org.apache.cxf.interceptor.AbstractLoggingInterceptor log INFO: Outbound Message --------------------------- ID: 6 Response-Code: 500 Content-Type: text/plain Headers: {Content-Type=[text/plain], Date=[Fri, 19 Nov 2010 14:04:46 GMT]} Payload: JAXBException occurred : unexpected element (uri: "", local:" sampleBean"). Expected elements are <{}genericBean>. -------------------------------------- thanks, Ivan
        Hide
        Sergey Beryozkin added a comment -

        Thanks Ivan. I'm closing this JIRA now.

        The issue you are reporting is entirely in the JAXB domain.
        Please add either @XmlSeeAlso(

        {list of classes}

        ) to GenericBean or may be introduce a JAXB ObjectFactory - the latter option is probably better

        cheers, Sergey

        Show
        Sergey Beryozkin added a comment - Thanks Ivan. I'm closing this JIRA now. The issue you are reporting is entirely in the JAXB domain. Please add either @XmlSeeAlso( {list of classes} ) to GenericBean or may be introduce a JAXB ObjectFactory - the latter option is probably better cheers, Sergey
        Hide
        Ivan Vitoria added a comment -

        I really apreciate your work. Will this issue be included in 2.3.1? If not, could you tell me when the 2.4.0 have been planned to be released?

        Many thanks Sergey!

        cheers,

        Ivan

        Show
        Ivan Vitoria added a comment - I really apreciate your work. Will this issue be included in 2.3.1? If not, could you tell me when the 2.4.0 have been planned to be released? Many thanks Sergey! cheers, Ivan
        Hide
        Sergey Beryozkin added a comment -

        Hi Ivan - yes, the relevant fixes have also been merged to 2.3.1-SNAPSHOT and 2.2.12-SNAPSHOT.

        By the way what you are working upon seems like a very interesting project. If you could update us on how it is going in some time
        or blog about it then it would be perfect.

        thanks, Sergey

        Show
        Sergey Beryozkin added a comment - Hi Ivan - yes, the relevant fixes have also been merged to 2.3.1-SNAPSHOT and 2.2.12-SNAPSHOT. By the way what you are working upon seems like a very interesting project. If you could update us on how it is going in some time or blog about it then it would be perfect. thanks, Sergey

          People

          • Assignee:
            Sergey Beryozkin
            Reporter:
            Ivan Vitoria
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 168h
              168h
              Remaining:
              Remaining Estimate - 168h
              168h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development