cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "sylvek (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-1762) The JAXRS mapping of Java methods without method parameter not working.
Date Thu, 06 Nov 2008 23:41:45 GMT

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

sylvek commented on CXF-1762:
-----------------------------

tested with cxf 2.1.2:

my PlayerRestService:

@Path("/player/{uuid}/")
@ProduceMime("application/json")
public class PlayerServiceDefault extends AbstractService implements
		PlayerService {

	private ConcurrentMap<String, AsyncPlayer> players;

	public void setPlayers(ConcurrentMap<String, AsyncPlayer> players) {
		this.players = players;
	}

	@GET
	@Path("/error")
	@NotNullChecker
	public String getError(@PathParam("uuid") String uuid) throws BusinessException {
		return getPlayer(uuid).getLastError().getMessage();
	}
	
	@GET
	@Path("/fatal")
	@NotNullChecker
	public String getFatal(@PathParam("uuid") String uuid) throws BusinessException {
		return getPlayer(uuid).getFatal().getMessage();
	}

	@GET
	@Path("/state")
	@NotNullChecker
	public String getState(@PathParam("uuid") String uuid) throws BusinessException {
		return getPlayer(uuid).getCurrentState().value();
	}
}

my app-context file:
beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:jaxrs="http://cxf.apache.org/jaxrs"
	xsi:schemaLocation="
	http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
	http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd 
	http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"
	default-lazy-init="true">
	<import resource="classpath:META-INF/cxf/cxf.xml" />
<!--	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />-->
	<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
	<bean id="PlayerService" class="fr.sokaris.poker.services.impl.PlayerServiceDefault">
		<property name="players">
			<ref bean="Players" />
		</property>
	</bean>
	<jaxrs:server id="PlayerRestService" address="/rest/">
		<jaxrs:serviceBeans>
			<ref bean="PlayerService" />
		</jaxrs:serviceBeans>
	</jaxrs:server>
<!--	<jaxws:endpoint id="PlayerWebService" implementor="#PlayerService"-->
<!--		implementorClass="fr.sokaris.poker.services.impl.PlayerServiceDefault"-->
<!--		address="/PlayerService" />-->

my web.xml file :
<servlet>
    <servlet-name>CXFServlet</servlet-name>
    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>

and my error :
7 nov. 2008 00:35:28 org.apache.cxf.jaxrs.JAXRSServiceFactoryBean checkMethodDispatcher
ATTENTION: No resource methods found for resource class org.apache.cxf.jaxrs.model.ClassResourceInfo
INFO  DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1bfc9d:
defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.jaxrs.JAXRSBindingFactory,org.apache.cxf.transport.servlet.ServletTransportFactory,PlayerService,PlayerRestService,GameService,GameRestService,GameFindService,GameFindRestService,GamePlayerService,GamePlayerRestService,GameAdminService,GameAsminRestService,PlayerAdminService,PlayerAdminRestService,RegistrationService,RegistrationRestService,ActionService,ActionRestService,BetService,BetRestService,Players,Games,UidService,ConfigurationService,Rules,RefreshGamble,DistributeCards,ThePreFlop,ThePreFlopActionsState,TheDefaultActionsState,TheFlop,TheTurn,TheRiver,TheShutdown,ThePot,ShowTheWinners,MakeABreak,Croupier,PotManager,NotNullInterceptor,org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator,LoggerInterceptor,org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator,TaskExecutor,GameThreadFactory];
root of factory hierarchy
ERROR ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PlayerRestService':
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 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:585)


> 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