2013-11-24 7 views
0

나는 자바 SE 환경 설정에의 Netty에 CDI/용접 및 JAX-RS/RESTEasy가 시도하지만, 내가 할 모든 다음과 같은 예외가 있습니다 :자원/RESTEasy가

javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8000/ 

내 프로젝트는 다음과 같은 종속성이 :

<dependency> 
    <groupId>org.jboss.resteasy</groupId> 
    <artifactId>resteasy-netty4</artifactId> 
    <version>3.0.5.Final</version> 
</dependency> 
<dependency> 
    <groupId>org.jboss.resteasy</groupId> 
    <artifactId>resteasy-cdi</artifactId> 
    <version>3.0.5.Final</version> 
</dependency> 
<dependency> 
    <groupId>io.netty</groupId> 
    <artifactId>netty-all</artifactId> 
    <version>4.0.12.Final</version> 
</dependency> 

은 내가 SRC/CDI를 활성화하는 메인/자원/META-INF 디렉토리에 beans.xml 환경 파일을 배치.

import javax.ws.rs.ApplicationPath; 
import javax.ws.rs.core.Application; 

@ApplicationPath("/") 
public class DemoApplication extends Application { 
    // empty 
} 
:이 모든 문제가 해결되지 않았기 때문에

@Path("/hi") // tried "/" too 
public class Index { 

    @GET 
    public String get() { 
    return "Hi!"; 
    } 
} 

, 내가 응용 프로그램 클래스를 추가 :

@Singleton 
public class App { 

    private static NettyJaxrsServer netty; 

    public void printHello(
      @Observes ContainerInitialized event, 
      @Parameters List<String> parameters) 
      throws Exception { 
    System.out.println("Starting Netty ..."); 
    ResteasyDeployment deployment = new ResteasyDeployment(); 
    netty = new NettyJaxrsServer(); 
    netty.setDeployment(deployment); 
    netty.setPort(8000); 
    netty.setRootResourcePath(""); 
    netty.setSecurityDomain(null); 
    netty.start(); 
    } 

예 리소스를 다음과 같습니다

코드는 그물코를 시작합니다

그러나 오류 메시지는 여전히 동일합니다.

무엇이 누락 되었습니까? 용접 및 RESTEasy를 어떻게 설정합니까?

답변