ResourceConfig实例不包含任何根资源类

发布于 2024-10-06 22:21:54 字数 2416 浏览 0 评论 0原文

这里出了什么问题?

The ResourceConfig instance does not contain any root resource classes.
Dec 10, 2010 10:21:24 AM com.sun.jersey.spi.spring.container.servlet.SpringServlet initiate
SEVERE: Exception occurred when intialization
com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
        at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:103)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1182)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.access$600(WebApplicationImpl.java:161)
        at com.sun.jersey.server.impl.application.WebApplicationImpl$12.f(WebApplicationImpl.java:698)
        at com.sun.jersey.server.impl.application.WebApplicationImpl$12.f(WebApplicationImpl.java:695)
        at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:197)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:695)
        at com.sun.jersey.spi.spring.container.servlet.SpringServlet.initiate(SpringServlet.java:117)

过滤器:

<filter>
    <filter-name>JerseyFilter</filter-name>
    <filter-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</filter-class>

    <init-param>
        <param-name>com.sun.jersey.config.feature.Redirect</param-name>
        <param-value>true</param-value>
    </init-param>

    <init-param>
        <param-name>com.sun.jersey.config.property.JSPTemplatesBasePath</param-name>
        <param-value>/views/</param-value>
    </init-param>

    <init-param>
        <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
        <param-value>/(images|css|jsp)/.*</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>JerseyFilter</filter-name>
    <url-pattern>/myresource/*</url-pattern>
</filter-mapping>

代码:

@Path ("/admin")
public class AdminUiResource {

  @GET
  @Produces ("text/html")
  @Path ("/singup")
  public Viewable getSignUp () {
    return new Viewable("/public/signup", "Test");
  }
}

What's going wrong here?

The ResourceConfig instance does not contain any root resource classes.
Dec 10, 2010 10:21:24 AM com.sun.jersey.spi.spring.container.servlet.SpringServlet initiate
SEVERE: Exception occurred when intialization
com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
        at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:103)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1182)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.access$600(WebApplicationImpl.java:161)
        at com.sun.jersey.server.impl.application.WebApplicationImpl$12.f(WebApplicationImpl.java:698)
        at com.sun.jersey.server.impl.application.WebApplicationImpl$12.f(WebApplicationImpl.java:695)
        at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:197)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:695)
        at com.sun.jersey.spi.spring.container.servlet.SpringServlet.initiate(SpringServlet.java:117)

Filter:

<filter>
    <filter-name>JerseyFilter</filter-name>
    <filter-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</filter-class>

    <init-param>
        <param-name>com.sun.jersey.config.feature.Redirect</param-name>
        <param-value>true</param-value>
    </init-param>

    <init-param>
        <param-name>com.sun.jersey.config.property.JSPTemplatesBasePath</param-name>
        <param-value>/views/</param-value>
    </init-param>

    <init-param>
        <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
        <param-value>/(images|css|jsp)/.*</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>JerseyFilter</filter-name>
    <url-pattern>/myresource/*</url-pattern>
</filter-mapping>

Code:

@Path ("/admin")
public class AdminUiResource {

  @GET
  @Produces ("text/html")
  @Path ("/singup")
  public Viewable getSignUp () {
    return new Viewable("/public/signup", "Test");
  }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(25

玩物 2024-10-13 22:21:54

您是否尝试过添加

<init-param>
  <param-name>com.sun.jersey.config.property.packages</param-name>
  <param-value>my.package.name</param-value>
</init-param>

到 SpringServlet 定义中?显然,将 my.package.name 替换为 AdminUiResource 所在的包,并确保它位于类路径中。

Have you tried adding

<init-param>
  <param-name>com.sun.jersey.config.property.packages</param-name>
  <param-value>my.package.name</param-value>
</init-param>

to your SpringServlet definition? Obviously replace my.package.name with the package that AdminUiResource is in and make sure it is in the classpath.

不如归去 2024-10-13 22:21:54

我是泽西岛的新手 - 我遇到了同样的问题,但是当我删除“/”并仅使用 @path(“admin”) 时,它就起作用了。

@Path("admin")
public class AdminUiResource { ... }

I am new to Jersey - I had the same issue, But when I removed the "/" and just used the @path("admin") it worked.

@Path("admin")
public class AdminUiResource { ... }
浅浅 2024-10-13 22:21:54

您需要添加您的包裹名称

<init-param>
  <param-name>com.sun.jersey.config.property.packages</param-name>
  <param-value>your.package.name</param-value>
</init-param>

我还注意到一件愚蠢的事情,
我需要在 MAVEN BUILD 之后刷新我的项目,否则它会显示同样的错误。
如果您知道我们需要刷新项目的原因,请发表评论?

YOU NEED TO ADD YOUR PACKAGE NAME AT

<init-param>
  <param-name>com.sun.jersey.config.property.packages</param-name>
  <param-value>your.package.name</param-value>
</init-param>

ALSO ONE SILLY THING I HAVE NOTICED,
I Need to refresh my project after MAVEN BUILD else it show me same error.
Please comment If you know reason why we need to refresh project?

挽容 2024-10-13 22:21:54

这意味着,找不到任何可以作为 jersey RESTful Web 服务执行的类。

检查:

  • 是否为“com.sun.jersey.config.property.packages”你的中缺少
    web.xml。
  • 是否为“com.sun.jersey.config.property.packages”的值
    参数丢失或无效(提到的包不存在)。它应该是一个包,您可以在其中放置作为球衣服务运行的 POJO 类。
  • 是否存在至少一个 POJO 类,该类具有使用 @Path 属性注释的方法。

This means, it couldn't find any class which can be executed as jersey RESTful web service.

Check:

  • Whether 'com.sun.jersey.config.property.packages' is missing in your
    web.xml.
  • Whether value for 'com.sun.jersey.config.property.packages'
    param is missing or invalid (the mentioned package doesn't exists). It should be a package where you have put your POJO classes which runs as jersey services.
  • Whether there exists at least one POJO class, which has a method annotated with @Path attribute.
逆夏时光 2024-10-13 22:21:54

您的资源包应至少包含一个用 @Path 注解的 pojo,或者至少有一个用 @Path 注解的方法或请求方法指示符,例如 @GET@PUT@POST@DELETE。资源方法是用请求方法指示符注释的资源类的方法。这解决了我的问题...

Your resource package should contain at least one pojo which is either annotated with @Path or have at least one method annotated with @Path or a request method designator, such as @GET, @PUT, @POST, or @DELETE. Resource methods are methods of a resource class annotated with a request method designator. This resolved my issue...

笑脸一如从前 2024-10-13 22:21:54

我在 JBOSS EAP 6.1 中遇到了这个问题。我能够通过 eclipse 将代码部署到 JBOSS 服务器,但是当我尝试将文件作为 WAR 文件部署到 JBOSS 时,我开始收到此错误。

解决方案是通过允许两者一起工作来配置 web.xml 以便与 JBOSS 正常工作。

以下两行在 web.xml 中被注释掉,以允许 JBOSS 进行自己的配置

<!--  
    <init-param>
    <param-name>com.sun.jersey.config.property.packages</param-name>
    <param-value>com.your.package</param-value>
</init-param> -->

,然后添加以下上下文参数

<context-param>
    <param-name>resteasy.scan</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>resteasy.scan.resources</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>resteasy.scan.providers</param-name>
    <param-value>false</param-value>
</context-param>

I ran across this problem with JBOSS EAP 6.1. I was able to deploy my code through eclipse to the JBOSS server but once I attempted to deploy the file as a WAR file to JBOSS I started getting this error.

The solution was configuring the web.xml to work properly with JBOSS by allowing the two to work together.

The following two lines were commented out in web.xml to allow JBOSS to do it's own configurations

<!--  
    <init-param>
    <param-name>com.sun.jersey.config.property.packages</param-name>
    <param-value>com.your.package</param-value>
</init-param> -->

And then add the following context params after

<context-param>
    <param-name>resteasy.scan</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>resteasy.scan.resources</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>resteasy.scan.providers</param-name>
    <param-value>false</param-value>
</context-param>
任谁 2024-10-13 22:21:54

基本上我像下面这样纠正了它,一切正常。

<servlet>
    <servlet-name >MyWebApplication</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>com.sun.jersey.config.feature.Redirect</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>com.sun.jersey.config.property.JSPTemplatesBasePath</param-name>
        <param-value>/views/</param-value>
    </init-param>
    <init-param>
        <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
        <param-value>/(images|css|jsp)/.*</param-value>
    </init-param>
</servlet>

<servlet-mapping>
    <servlet-name>MyWebApplication</servlet-name>
    <url-pattern>/myapp/*</url-pattern>
</servlet-mapping>

Basically I corrected it like below and everything worked fine.

<servlet>
    <servlet-name >MyWebApplication</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>com.sun.jersey.config.feature.Redirect</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>com.sun.jersey.config.property.JSPTemplatesBasePath</param-name>
        <param-value>/views/</param-value>
    </init-param>
    <init-param>
        <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
        <param-value>/(images|css|jsp)/.*</param-value>
    </init-param>
</servlet>

<servlet-mapping>
    <servlet-name>MyWebApplication</servlet-name>
    <url-pattern>/myapp/*</url-pattern>
</servlet-mapping>
思念绕指尖 2024-10-13 22:21:54

由于 Web.xml 中缺少 ResourseConfig,我收到此异常。

添加:

<init-param>
    <param-name>com.sun.jersey.config.property.packages</param-name>
    <param-value>/* Name of Package where your service class exists */</param-value>
</init-param>

服务类意味着:包含以下服务的类:@Path("/orders")

I am getting this exception, because of a missing ResourseConfig in Web.xml.

Add:

<init-param>
    <param-name>com.sun.jersey.config.property.packages</param-name>
    <param-value>/* Name of Package where your service class exists */</param-value>
</init-param>

Service class means: class which contains services like: @Path("/orders")

心安伴我暖 2024-10-13 22:21:54

我在尝试从 Eclipse 项目运行 Web 应用程序时遇到了同样的问题。当我将 .class 文件复制到 /WEB-INF/classes 时,它就完美地工作了。

I had the same issue with trying to run the webapp from an eclipse project. As soon I copied the .class files to /WEB-INF/classes it worked perfectly.

我一直都在从未离去 2024-10-13 22:21:54

我遇到了同样的问题,测试了一堆不同的示例,并尝试了所有可能的解决方案。最终让它为我工作的是当我在类行上添加一个 @Path("") 时,我把它遗漏了。

I had the same issue, testing a bunch of different examples, and tried all the possible solutions. What finally got it working for me was when I added a @Path("") over the class line, I had left that out.

此岸叶落 2024-10-13 22:21:54

遇到了同样的问题,发现这是我部署源代码的方式的问题。正如错误消息所示:“...不包含任何根资源类”。所以它在配置的包中找不到任何资源类。我只是错误地部署了类 - 这就是它没有拾取它的原因。

我忘记将我的类文件部署在 WAR 的 /WEB-INF/classes 目录中 - 最初我只是将它直接放在 WAR 文件的根目录中。因此,当它查找资源类时,它没有找到它们 - 因为它们存在于不同的(错误的)位置。

Had the same issue and found out it was a problem with the way I deployed my source code. As the error message says: "...does not contain any root resource classes". So it couldn't find any resource classes in the configured package. I just deployed the classes wrong - that's why it didn't pick it up.

I forgot to deploy my class files in the /WEB-INF/classes directory of the WAR - initially I just had it directly in the root of the WAR file. So when it looked for resource classes it didn't find them - because they existed in a different (wrong) location.

断桥再见 2024-10-13 22:21:54

同样的问题 - web.xml 看起来像这样:

<servlet>
    <servlet-name>JerseyServlet</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>javax.ws.rs.Application</param-name>
        <param-value>com.mystuff.web.JerseyApplication</param-value>
    </init-param>
...

提供自定义应用程序会覆盖任何配置的 XML 自动检测类。您需要实现正确的方法来编写自己的代码来连接类。请参阅 javadoc。

Same issue - web.xml looked like this:

<servlet>
    <servlet-name>JerseyServlet</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>javax.ws.rs.Application</param-name>
        <param-value>com.mystuff.web.JerseyApplication</param-value>
    </init-param>
...

Providing a custom application overrides any XML configured auto detection of classes. You need to implement the right methods to write your own code to wire up the classes. See the javadocs.

落日海湾 2024-10-13 22:21:54

导致此错误的另一个可能原因是您忘记将 /WEBINF/lib 文件夹中已有的库添加到构建路径(例如,在导入 .war 时) -file 并且在向导中询问时不检查库)。刚刚发生在我身上。

Another possible cause of this error is that you have forgotten to add the libraries that are already in the /WEBINF/lib folder to the build path (e.g. when importing a .war-file and not checking the libraries when asked in the wizard). Just happened to me.

德意的啸 2024-10-13 22:21:54

当我部署 main.jar 时,我就发生了这种情况,而没有选中 Eclipseexport jar 菜单中的 adddirectory items 框。

It happened to me when I deployed my main.jar, without checking the add directory entries box in the export jar menu in Eclipse.

断舍离 2024-10-13 22:21:54

另一件需要检查的事情是先前条目的组合,

您可以在 web.xml 文件中包含以下内容:

<init-param>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>com.acme.rest</param-value>
</init-param>

并且可以拥有

<context-param>
    <param-name>resteasy.scan</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>resteasy.scan.providers</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>resteasy.scan.resources</param-name>
    <param-value>false</param-value>
</context-param>

,但不能同时拥有两者,否则会出现此类错误。在这种情况下的修复方法是注释掉其中一个(可能第一个代码片段将被注释掉)

Another thing to check is a combination of previous entries

You can have in your web.xml file this:

<init-param>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>com.acme.rest</param-value>
</init-param>

and you can have

<context-param>
    <param-name>resteasy.scan</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>resteasy.scan.providers</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>resteasy.scan.resources</param-name>
    <param-value>false</param-value>
</context-param>

but you cannot have both or you get this sort of error. The fix in this case would be to comment out one or the other (probably the first code snippet would be commented out)

姜生凉生 2024-10-13 22:21:54

嗯,回复有点晚了。我遇到了同样的问题,我的谷歌搜索是徒劳的。然而,我设法找到了问题所在。出现此错误的原因可能有很多,但我由于以下原因而出现了错误,我想与我的开发人员同事分享这一点。

  1. 我以前使用过 Jersey 1.3,但遇到了这个错误。但是当我将 jars 升级到 Jersey 的最新版本时,这个问题就得到了解决。
  2. 我遇到此错误的另一个实例是当我尝试通过构建 war 文件将服务部署到 JBoss 中时。我犯了一个错误,即在 .war 中包含 Java 文件而不是 java 类。

Well, it's a little late to reply. I have faced the same problem and my Google searches were in vain. However, I managed to find what the problem was. There might be many reasons for getting this error but I got the error due to the following and I wanted to share this with my fellow developers.

  1. I previously used Jersey 1.3 and I was getting this error. But when I upgraded the jars to the latest version of Jersey, this issue was resolved.
  2. Another instance in which I got this error was when I was trying to deploy my service into JBoss by building a war file. I made the mistake of including the Java files in the .war instead of java classes.
不一样的天空 2024-10-13 22:21:54

我必须在 @path 的末尾添加一个尾部正斜杠

@Path ("/admin/") 

I had to add a trailing forward slash to the end of @path

@Path ("/admin/") 
别闹i 2024-10-13 22:21:54

好吧...对我来说工作正常,只需将“servlet-class”分配给 com.sum.jersey.spi.container.servlet.ServletContainer,我正在使用 IDE (Eclipse Mars),

<servlet>
        <servlet-name>Jersey Web Application</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/frontend/*</url-pattern>
    </servlet-mapping>

但由于某种原因我不得不重新启动计算机为了在我的本地主机上工作。如果还不行?您必须在 web.xml 中的“servlet”标记之间添加此代码。

<init-param>
  <param-name>com.sun.jersey.config.property.packages</param-name>
  <param-value>the.package.name</param-value>
</init-param>

“the.package.name”是您的类所在的包名称。如果您使用 IDE,请刷新项目并在 Tomcat 中再次运行。还是不行?重新启动计算机即可工作。

Ok... For me work fine just only assigning the "servlet-class" to com.sum.jersey.spi.container.servlet.ServletContainer, I am using IDE (Eclipse Mars)

<servlet>
        <servlet-name>Jersey Web Application</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/frontend/*</url-pattern>
    </servlet-mapping>

but for some reason I had to reboot my computer in order to work in my localhost. If still not work? You have to add in your web.xml this code in between "servlet" tag.

<init-param>
  <param-name>com.sun.jersey.config.property.packages</param-name>
  <param-value>the.package.name</param-value>
</init-param>

"the.package.name" is the package name where you have your classes. If you are using IDE, refresh the project and run again in Tomcat. still not work? reboot your computer and will work.

甜点 2024-10-13 22:21:54

是的,添加 com.sun.jersey.config.property.packages 的 init 参数为我解决了这个问题。

正在将球衣休息服务合并到基于 Maven 的 Spring 应用程序中,并收到此错误。

yes adding the init param for com.sun.jersey.config.property.packages fixed this issue for me.

was merging a jersey rest services into maven based spring application and got this error.

音盲 2024-10-13 22:21:54

我也遇到这样的错误,请注意xml中的配置。

我写
com.sun.jersey.comfig.property.packages

而不是
com.sun.jersey.config.property.packages

更正后即可正常工作。

I also got this kind of error, please take care of the configurations in xml.

I wrote
com.sun.jersey.comfig.property.packages

Instead of
com.sun.jersey.config.property.packages

After correction it's working.

罗罗贝儿 2024-10-13 22:21:54

这个问题是因为泽西岛找不到供您休息的依赖包
声明的服务

检查您的项目包分发并断言它等于您的 web.xml 参数值

that issue is because jersey can't find a dependecy package for your rest
service declarated

check your project package distribution and assert that is equals to your web.xml param value

无畏 2024-10-13 22:21:54

可能为时已晚,但这就是我解决此错误的方法。

如果此解决方案不起作用,

<init-param>
    <param-name>com.sun.jersey.config.property.packages</param-name>
    <param-value>/* Name of Package where your service class exists */</param-value>
</init-param>

在 Eclipse 中:

右键单击您的项目或选择项目并按Alt +输入在打开的窗口的左侧找到Java构建路径

从右侧选项卡面板中选择库:如果有任何内容已损坏或在罐子顶部显示十字标记,删除并再次添加相同的 jar

应用并关闭

重建您的项目

Probably too late but this is how I resolved this error.

If this solution is not working,

<init-param>
    <param-name>com.sun.jersey.config.property.packages</param-name>
    <param-value>/* Name of Package where your service class exists */</param-value>
</init-param>

In eclipse:

RightClick on your Project Or Select Project and press Alt + Enter On the left-hand side of the opened window find Java Build Path

Select Libraries from the right tab panel: If there is anything which is corrupted or showing cross mark on top of the jars, remove and add the same jar again

Apply and Close

Rebuild your project

我为君王 2024-10-13 22:21:54

就我而言,从 war 导入后,我在构建路径中添加了两次 jar。
显示错误部署描述符错误页面的额外 jar 后,它工作正常

删除

<init-param>
          <param-name>com.sun.jersey.config.property.packages</param-name>
          <param-value>service.package.name</param-value>
</init-param>

In my case I have added the jars twice in build path after importing from war.
It worked fine after removing the extra jars which was showing error deployment descriptor error pages

adding

<init-param>
          <param-name>com.sun.jersey.config.property.packages</param-name>
          <param-value>service.package.name</param-value>
</init-param>
巷子口的你 2024-10-13 22:21:54

也遇到过这个问题,两次都是因为不同的原因。第一次我忘记包含

<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>my.package.name</param-value>
</init-param>

之前评论中所述的内容,一旦我这样做了,它就开始工作了。

然而...另一天,我启动了 Eclipse,希望从中断的地方继续,但我的程序没有正常工作,而是再次显示了完全相同的错误。我开始检查是否意外进行了一些更改并保存了损坏的文件,但没有发现此类错误,并且该文件看起来与我的示例一模一样,一切都按顺序进行。由于前一天它工作正常,经过一些初步搜索后,我想,好吧,也许这是 Eclipse 或 Tomcat 故障或其他问题,所以让我们尝试进行一些更改,看看它是否有反应。所以,我在 web.xml 文件中做了一个空格+退格键,只是为了欺骗 Eclipse 文件已更改,然后保存它。下一步是重新启动 Tomcat 服务器(从 Eclipse IDE),瞧,它又可以工作了!

也许有更广泛经验的人可以解释这一切背后的真正问题是什么?

Also came accross this problem, twice for different reasons. The first time I forgot to include

<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>my.package.name</param-value>
</init-param>

as described in previous comments, and once I did that, it started working.

Yet... another day I started Eclipse, expecting to continue where I left off, and instead of having my program working, it showed the very same error once again. I started checking if I accidentally had made some changes and saved corrupted file, but could find no such error and the file looked exactly like examples I have, all in order. Since it worked the day before, after some initial searching, I thought, well, maybe it's a Eclipse, or Tomcat glitch or something, so let's just try to make some changes and see if it reacts. So, I did a space + backspace in web.xml file, just to fool Eclipse that the file is changed, and saved it then. The next step was restarting Tomcat server (from Eclipse IDE) and voila, it works again!

Maybe someone with broader experience could explain what the problem really was behind all of this?

泡沫很甜 2024-10-13 22:21:54

造成此异常的主要原因是:

您在使用 @Path 时没有给出正确的包名称,或者忘记在 web.xml / 配置文件中进行配置(Rest API 类文件包名称,您的类包名称)

检查 内的此配置

Main cause of this Exception is:

You have not given the proper package name where you using the @Path or forgot to configure in web.xml / Configuration file(Rest API Class File package Name, Your Class Package Name)

Check this Configuration inside <init-param>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文