简体   繁体   中英

jee 6 jaxrs get file not found

I have a utility project having the source and the application

package com.x.framework.api;

import java.security.Principal;
import javax.annotation.Resource;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.csx.enterprise.webframework.security.LDAPUser;
import com.csx.enterprise.webframework.util.FrameworkThreadProperties;
import com.csx.enterprise.webframework.util.Log;
import com.csx.enterprise.webframework.util.WebFrameworkConstants;


@Stateless
@Path("/security")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public class SecurityResource {

   @Resource
   SessionContext ctx;

   @GET
   @Path("me")
   @Produces(MediaType.APPLICATION_JSON)
    public Response getMe() {
     ...
  }

package com.x.framework.api;

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

@ApplicationPath("/api")
public class JaxrsApplication extends Application{

}

I have a web project with web.xml

    <servlet>
        <servlet-name>javax.ws.rs.core.Application</servlet-name>
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>com.x.framework.api.JaxrsApplication</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
            <servlet-name>javax.ws.rs.core.Application</servlet-name>
        <url-pattern>/api/*</url-pattern>
    </servlet-mapping>

    <filter-mapping>
        <filter-name>CSXSecurityFilter</filter-name>
        <url-pattern>/api/*</url-pattern>
    </filter-mapping>

But when I hit the URL https://localhost:9443/webframework/api/security/me , I keeps getting Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /api/security/me. Any suggestions?

The coding is fine. I had to go to the installedApp directory and extracted the ear file and found the files were not updated accordingly by the Eclipse. So it's not a coding issue, but more of a publishing issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM