RESTEASY003210:找不到完整路径的资源

时间:2018-11-19 08:18:35

标签: java angular rest service

我遇到了错误:

  

javax.ws.rs.NotFoundException:RESTEASY003210:找不到   完整路径的资源:   http://localhost:8070/SearchApp-1.0/users/authorizations         在org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:114)         在org.jboss.resteasy.core.registry.RootNode.match(RootNode.java:43)         在org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)         在org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:445)         在org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:257)         在org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:194)         在org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)         在org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)         在org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)         在javax.servlet.http.HttpServlet.service(HttpServlet.java:728)         在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)         在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)         在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)         在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)         在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)         在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)         在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)         在org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)         在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)         在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)         在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)         在org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:589)         在org.apache.tomcat.util.net.JIoEndpoint $ SocketProcessor.run(JIoEndpoint.java:312)         在java.util.concurrent.ThreadPoolExecutor.runWorker(未知来源)         在java.util.concurrent.ThreadPoolExecutor $ Worker.run(未知来源)         在java.lang.Thread.run(未知来源)

我的web.xml:

    <!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>Test Application</display-name>

    <context-param>
        <param-name>resteasy.resources</param-name>
        <param-value>ge.ufc.ws.SearchWs</param-value>
    </context-param>

    <context-param>
        <param-name>resteasy.servlet.mapping.prefix</param-name>
        <param-value>/</param-value>
    </context-param>

    <listener>
        <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
    </listener>

    <servlet>
        <servlet-name>resteasy-servlet</servlet-name>
        <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>resteasy-servlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

和pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>ge.ufc</groupId>
    <artifactId>SearchApp</artifactId>
    <packaging>war</packaging>
    <version>1.0</version>
    <name>testApp Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc7</artifactId>
            <version>12.1.0.2</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>3.0.16.Final</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson-provider</artifactId>
            <version>3.0.16.Final</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.7.4</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.7.4</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>SearchApp</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <version>2.10</version>
                    <configuration>
                        <projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
                        <wtpmanifest>true</wtpmanifest>
                        <wtpapplicationxml>true</wtpapplicationxml>
                        <wtpversion>2.0</wtpversion>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.2</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

服务代码为:

 @Path("/users")
 public class SearchWs {
 @GET
    @Path("/authorizations")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getAuthorizations() throws SQLException  {


      Authorization ath=JDBCConnection.LastHourAuthor();
       return Response.status(200)
                .entity("here is the success result")
                .build();

    }
}

我想从Angular调用此服务:

 pastHourInfo() {
        const url='/SearchApp-1.0/users/authorizations';
        return this.http.get(url).pipe(map((resultSet:any)=>resultSet));
    }

订阅如下:

   checkPasHourInfo() {
        this.searchService.pastHourInfo().subscribe(resultSet => {
            console.log("we got: ",resultSet);
            this.resultSet.push(resultSet);
        },
        error => {
          console.log("Error",error);

    },);

  }

我在ngOnInit()中调用订阅功能

ngOnInit() {
      this.checkPasHourInfo();
  } 

我正在使用Tomcat 7.0.35 ...

如何解决此问题?

0 个答案:

没有答案