You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WebSphere V7中JAX-RS服务访问出现Error 404: SRVE0190E错误求助

Troubleshooting 404 Errors for JAX-RS Services on WebSphere Application Server V7

Let’s break down why you’re hitting that Error 404: SRVE0190E: File not found when accessing your REST endpoints. Here are the most common fixes to try:

1. Add Proper JAX-RS Annotations to Your Resource Class

Your Conference class as shown doesn’t include any JAX-RS annotations—this is a critical missing piece. For WebSphere to recognize it as a REST resource, you need to add:

  • @Path at the class level to map to /Conference
  • HTTP method annotations (like @GET) on methods that handle requests
  • @PathParam if you’re capturing path variables (like the 1 in your second URL)

Example corrected class:

package co.ma.jaxrs;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

@Path("/Conference")
public class Conference {
    public final String name;
    public final String date;

    // Add your constructor(s) here

    @GET
    public String getAllConferences() {
        // Replace with your logic to return all conferences
        return "All conferences list";
    }

    @GET
    @Path("/{id}")
    public String getConferenceById(@PathParam("id") String id) {
        // Replace with your logic to fetch a single conference by ID
        return "Conference details for ID: " + id;
    }
}

2. Fix Your web.xml Configuration

WebSphere Application Server V7 uses Jersey 1.4 as its default JAX-RS implementation, so your web.xml needs to correctly map the Jersey servlet to your /resources/* path. Here’s a working configuration example:

<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
    <servlet>
        <servlet-name>JAX-RS Servlet</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <!-- Tell Jersey which packages to scan for resource classes -->
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>co.ma.jaxrs</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>JAX-RS Servlet</servlet-name>
        <url-pattern>/resources/*</url-pattern>
    </servlet-mapping>
</web-app>

Double-check that:

  • The url-pattern matches /resources/* (to align with your endpoint URLs)
  • The param-value for package scanning points to your resource class’s package (co.ma.jaxrs)

3. Avoid JAR Conflicts

If you’ve included external Jersey JARs in your WEB-INF/lib folder, this will conflict with WebSphere’s built-in Jersey implementation. Remove any Jersey-related JARs (like jersey-server.jar, jersey-core.jar) from your application—WAS 7 provides these out of the box.

4. Confirm Application Deployment Details

  • Make sure your app’s context root is set to Conference (this matches the http://localhost:9080/Conference/ part of your URLs). You can verify this in the WebSphere Administrative Console under Applications > Application Types > WebSphere enterprise applications > [Your App] > Context Root for Web Modules.
  • Restart the application after making configuration changes—WAS sometimes requires a restart to pick up JAX-RS updates.

Once you’ve applied these fixes, test your endpoints again. If you still run into issues, check the WebSphere SystemOut.log for more detailed error messages (they’ll often point to missing annotations or configuration mistakes).

内容的提问来源于stack exchange,提问作者S.Yassine

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 10:03:53