cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-1762) The JAXRS mapping of Java methods without method parameter not working.
Date Fri, 17 Oct 2008 17:18:44 GMT

    [ https://issues.apache.org/jira/browse/CXF-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640586#action_12640586
] 

Sergey Beryozkin commented on CXF-1762:
---------------------------------------

Frank,

can you please confirm it's still an issue with 2.1.2 ?

I can't confirm it.

Here's my test case.

1. Server impl

@Path("/bookstore/")
public class BookStoreSpring {

    private Map<Long, Book> books = new HashMap<Long, Book>();
    private Long mainId = 123L;
        
    public BookStoreSpring() {
        init();
        System.out.println("----books: " + books.size());
    }
    
    @GET
    @Path("/books/{id}")
    @ProduceMime("application/json")
    public Book getBookById(@PathParam("id") Long id) {
        return books.get(id);
    }

    @GET
    @ProduceMime("application/json")
    public Book getDefaultBook() {
        return books.get(mainId);
    }

    
    // init()
}

this is equivalent to the class sample you provided, just the names are different.

2. beans.xml

<jaxrs:server id="bookservice"
address="/">
    <jaxrs:serviceBeans>
      <bean class="org.apache.cxf.systest.jaxrs.BookStoreSpring" />
    </jaxrs:serviceBeans>
  </jaxrs:server>

The server is started ok , both methods can be executed

The only difference is that Jetty is used....

> The JAXRS mapping of Java methods without method parameter not working.
> -----------------------------------------------------------------------
>
>                 Key: CXF-1762
>                 URL: https://issues.apache.org/jira/browse/CXF-1762
>             Project: CXF
>          Issue Type: Bug
>          Components: Resources
>    Affects Versions: 2.1.2
>         Environment: Windows XP,
> jdk 1.6.0_07
>            Reporter: Frank Ittermann
>            Priority: Minor
>
> Hello everybody,
> I implemented a REST resource that has a java method without method parameter's.
> @Path("/service")
> @ConsumeMime({ "application/json;charset=UTF-8", "application/xml;charset=UTF-8" })
> @ProduceMime({ "application/json;charset=UTF-8", "application/xml;charset=UTF-8" })
> public class RestService {
>     @GET
>     @Path("/id/{id}")
>     public SomeThingElse getSomeThingElse(@PathParam("id")int id) {
>         return new SomeThingElse();
>     }
>     @GET
>     public SomeThing getSomeThing() {
>         return new SomeThing();
>     }
> }
> If you call the rest uri /service the following error occur 
> SCHWERWIEGEND: .No operation matching request path /adspaces/ is found, ContentT
> ype : */*, Accept : text/xml,application/xml,application/xhtml+xml,text/html;q=0
> .9,text/plain;q=0.8,image/png,*/*;q=0.5.
> I changed the method getSomeThing and add a method parameter than it works.
> any suggestions
> And a other strange behavior is if you remove the method getSomeThingElse from the code
than an error by creating the service occur. 
> Here the error log: 
> ERROR main org.springframework.web.context.ContextLoader - Context initialization failed
>  org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'xmlserviceserver': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property
'serviceBeans' threw exception; nested exception is java.lang.NullPointerException
> Caused by: 
> org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException
details (1) are:
> PropertyAccessException 1:
> org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception;
nested exception is java.lang.NullPointerException
> Caused by: 
> java.lang.NullPointerException
> 	at org.apache.cxf.jaxrs.JAXRSServiceFactoryBean.setResourceClassesFromBeans(JAXRSServiceFactoryBean.java:144)
> 	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setServiceBeans(JAXRSServerFactoryBean.java:265)
> 	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setServiceBeans(JAXRSServerFactoryBean.java:260)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:821)
> 	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
> 	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
> 	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
> 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
> 	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
> 	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
> 	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
> 	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
> 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
> 	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
> 	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
> 	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
> 	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:829)
> 	at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:718)
> 	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
> 	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)
> 	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
> 	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
> 	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
> 	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> 	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
> 	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
> 	at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> 	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message