当调用部署在WebLogic Server web服务,我得到一个404 - 未找到错误。即使是在这样我wasn't能够找到一个解决办法寻找类似的问题后:REST Web服务找不到404
Rest Web services returning a 404
Java Restful Service eclipse tomcat HTTP Error 404
Restful Web Service returning 404, bad web.xml?
资源被正确部署在WebLogic Server,你可以看到来自以下图片:
我有以下代码:
ServicesREST.java
package pt.vdf.nc.webproxy;
@Path("/NCProxyServices")
public class ServicesREST {
public ServicesREST(){
WebProxy.getAllInstances();
}
@Path("ManageShortNumber/{MSISDN}/{DestinationNumber}")
@GET
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response manageShortNumberSMSIntegration(@PathParam("MSISDN") String terminal, @PathParam("DestinationNumber") Integer shortNumber) {
(...)
}
的application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
version="5">
<description>WebApp builder and deployer</description>
<display-name>ncwebproxy</display-name>
<module>
<web>
<web-uri>ncwebproxy.war</web-uri>
<context-root>/webproxy/</context-root>
</web>
</module>
<library-directory>lib</library-directory>
</application>
的web.xml
(...)
<security-constraint>
<display-name>Administrators</display-name>
<web-resource-collection>
<web-resource-name>webproxy</web-resource-name>
<url-pattern>/webproxy/*</url-pattern>
<http-method>GET</http-method>
</web-resource-collection>
</security-constraint>
(...)
个
和下面的罐:
[编辑] - >添加下面的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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>services-web</artifactId>
<packaging>war</packaging>
<name>services-web</name>
<description>Services Web - WAR</description>
<parent>
<groupId>pt.vdf.nc.services</groupId>
<artifactId>services</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../services</relativePath>
</parent>
<properties>
<war.phase>package</war.phase>
<install.phase>install</install.phase>
<weblogic.version>10.3.6</weblogic.version>
</properties>
<profiles>
<profile>
<id>env-loc-wl</id>
<properties>
<war.phase>package</war.phase>
<install.phase>install</install.phase>
</properties>
</profile>
<profile>
<id>env-loc-tc</id>
<properties>
<war.phase>none</war.phase>
<install.phase>none</install.phase>
</properties>
</profile>
<profile>
<id>env-dev-wl</id>
<properties>
<war.phase>package</war.phase>
<install.phase>install</install.phase>
</properties>
</profile>
<profile>
<id>env-tst-wl</id>
<properties>
<war.phase>package</war.phase>
<install.phase>install</install.phase>
</properties>
</profile>
<profile>
<id>env-ath-wl</id>
<properties>
<war.phase>none</war.phase>
<install.phase>none</install.phase>
</properties>
</profile>
<profile>
<id>env-prd-wl</id>
<properties>
<war.phase>package</war.phase>
<install.phase>install</install.phase>
</properties>
</profile>
</profiles>
<build>
<finalName>ncservices</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>cfg/services-cfg.properties</include>
<include>ctx/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>default-war</id>
<phase>${war.phase}</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>default-install</id>
<phase>${install.phase}</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<artifactId>services-common</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.timesten</groupId>
<artifactId>ttjdbc6</artifactId>
<version>11.2.1.6.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>wlclient</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-core_2.10</artifactId>
<version>1.3.11</version>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.9.0</version>
</dependency>
</dependencies>
</project>
我尝试了各种不同的URL模式的尝试,并调用成功的服务,但我不断收到错误404
http://localhost:7001/webproxy/NCProxyServices/ManageShortNumber/9842987982/97668/
http://localhost:7001/pt.vdf.nc.webproxy/webproxy/NCProxyServices/ManageShortNumber/9842987982/97668/
http://localhost:7001/NCProxyServices/ManageShortNumber/9842987982/97668/
劳驾点我在正确的方向顺利调用这个服务。
谢谢您的时间
我没有看到类,它扩展'javax.ws.rs.core.Application',没有配置泽西在web.xml呢? (编辑:删除参照'beans.xml',我看到春天时) – Gimby
在你的日志文件查看是否有部署问题 – Jens
@Gimby新泽西配置上,我加入到我的问题pom.xml中存在。不知道你的意思是“我看不出有什么类,它扩展javax.ws.rs.core.Application” –