When invoking a webservice deployed in a weblogic server I get a 404 - Not found error. Even after searching for similar questions in SO i wasn´t able to find a solution:
Rest Web services returning a 404
Java Restful Service eclipse tomcat HTTP Error 404
Restful Web Service returning 404, bad web.xml?
The resources are correctly deployed in the weblogic server as you can see from the following image:
I have the following code:
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>
(...)
[EDIT] -> Added pom.xml below:
<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>
I tried a variety of different url patterns to try and invoke the service successfully but i keep getting the error 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/
Would you kindly point me in the right direction to successfully invoke this service.
Thank you for your time