2014-11-03 1 views
1

apache cxf를 사용하여 restfull webservice를 구현하려고합니다.CXF 휴식 서비스에서 클래스에 대한 리소스를 찾을 수 없음

Tomcat에 war 파일을 배포하는 중 'Analysis'라는 이름의 Bean을 생성하는 중 오류가 발생했습니다. init 메소드 호출에 실패했습니다. 상자의 예외는 org.apache.cxf.service.factory.ServiceConstructionException

다음
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/cxf.xml] 
03-Nov-2014 17:03:40 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons 
INFO: Pre-instantiating singletons in org.s[email protected]12f41a5: defining beans [/Analysis/,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,Analysis,AnalysisResponse,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy 
03-Nov-2014 17:03:40 org.apache.cxf.jaxrs.utils.ResourceUtils checkMethodDispatcher 
WARNING: No resource methods have been found for resource class com.bt.ws.pointsystem.pojo.AnalysisResponse 
03-Nov-2014 17:03:40 org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean checkResources 
SEVERE: No resource classes found 
03-Nov-2014 17:03:40 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons 
INFO: Destroying singletons in org.s[email protected]12f41a5: defining beans [/Analysis/,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,Analysis,AnalysisResponse,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy 
03-Nov-2014 17:03:40 org.springframework.web.context.ContextLoader initWebApplicationContext 
SEVERE: Context initialization failed 

입니다 cxf.xml :

<beans default-autowire="byName" xmlns="http://www.springframework.org/schema/beans" 
xmlns:jaxrs="http://cxf.apache.org/jaxrs" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:tx="http://www.springframework.org/schema/tx" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-3.0.xsd 
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 
http://cxf.apache.org/jaxrs 
http://cxf.apache.org/schemas/jaxrs.xsd"> 

    <context:component-scan base-package="com.bt.ws.pointsystem,com.bt.ws.pointsystem.pojo" /> 


    <jaxrs:server address="/" id="Analysis"> 
    <jaxrs:serviceBeans> 
       <ref bean="AnalysisResponse" /> 

    </jaxrs:serviceBeans> 
    <jaxrs:extensionMappings> 
    <entry key="xml" value="application/xml"> 
    </entry> 
    </jaxrs:extensionMappings> 
    </jaxrs:server> 
    <bean class="com.bt.ws.pointsystem.pojo.AnalysisResponse" id="AnalysisResponse"> 
    </bean> 
</beans> 

의 web.xml :

<?xml version="1.0"?> 
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
"http://java.sun.com/dtd/web-app_2_3.dtd"> 

<web-app> 
    <display-name>PointSystemService</display-name> 

    <context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>WEB-INF/cxf.xml</param-value> 
    </context-param> 
    <listener> 

    <listener-class> 
    org.springframework.web.context.ContextLoaderListener 
    </listener-class> 
    </listener> 
    <servlet> 
    <servlet-name>CXFServlet</servlet-name> 

    <servlet-class> 
    org.apache.cxf.transport.servlet.CXFServlet 
    </servlet-class> 
    </servlet> 
    <servlet-mapping> 
    <servlet-name>CXFServlet</servlet-name> 

    <url-pattern>/services/*</url-pattern> 
    </servlet-mapping> 
</web-app> 

클래스 정의 :

package com.bt.ws.pointsystem.pojo; 

public class AnalysisResponse { 
    private String UserId; 
    private String AnalysisType; 
    public String getUserId() { 
     return UserId; 
    } 
    public void setUserId(String userId) { 
     UserId = userId; 
    } 
    public String getAnalysisType() { 
     return AnalysisType; 
    } 
    public void setAnalysisType(String analysisType) { 
     AnalysisType = analysisType; 
    } 





} 

그밖에 내가 무엇입니까? 여기에?

TIA

+0

가능한 복제본 [cxf 서블릿에서 찾을 수없는 리소스 클래스] (http://stackoverflow.com/questions/5244112/no-resource-classes-found-on-a-cxf-servlet) – kolossus

+0

경우에 따라 추적 로그를 활성화하고 다음과 같은 [오류] (http://stackoverflow.com/questions/33023730/jax-rs-method-has-no-path-or-http-method-annotations)를 보았습니다. –

답변

0

은 내가 인터페이스가 아닌 서비스 클래스에있을 필요가 @WebService 주석을 수정하면 사라 유사한 문제가 발생했습니다.

0

이 문제의 또 다른 일반적인 원인은 public 대신 @Path protected으로 주석이 달린 메소드를 갖는 것입니다.

관련 문제