Я получаю сообщение об ошибке:
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 (RootClassNode0core.SynchronousDispatcher.invoke (SynchronousDispatcher.java:194) по адресу org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service (ServletContainerDispatcher.java:221) по адресу org.jboss.server.pisserser.pserслужба (HttpServletDispatcher.java:56) в org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service (HttpServletDispatcher.java:51) в javax.servlet.http.HttpServlet.) в org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:222) в org.apache.catalina.core.invoke (AuthenticatorBase.java:472) в org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:171) в org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java.ache at99).catalina.valves.: 407) at 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 ...
Как я могу решить эту проблему?