泽西岛:无法找到课堂上的语法元素

时间:2014-09-18 14:10:57

标签: java rest grails jersey jax-rs

我使用Grails和JaxRS 311 plugin。我和泽西岛一起使用。

我的应用程序在tomcat 7.0.55服务器上运行。我的服务器登录生产显示以下信息消息。我想知道为什么"无法找到课堂上的语法元素"是一个INFO日志。这是日志:

INFO: Couldn't find grammar element for class test.shared.dto.NotificationDtoCollection
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.UserDto
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.ItemDtoCollection
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.UploadItemDto
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.UploadItemDto
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.ItemDetailsDto
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class test.shared.dto.ItemDetailsDto
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes
INFO: Couldn't find grammar element for class boolean
Sep 09, 2014 3:01:03 AM com.sun.jersey.server.wadl.generators.AbstractWadlGeneratorGrammarGenerator attachTypes

我发现了以下问题但在我的案例中没有帮助:Jersey: what does "couldn't find grammar element" mean?A JSON object in a POST request for webserver with JERSEY

我的所有类都有一个公共默认构造函数,可能是第二个参数化构造函数:

class UserDto {

    String id
    String firstName
    String lastName

  public UserDto() { }

  public UserDto(User user, User currentUser) {
    ... 
  }

}

这些INFO日志消息的含义是什么?如何防止它们?

2 个答案:

答案 0 :(得分:1)

如果您在web.xml定义中的<servlet>内设置以下参数,那么这些消息就会消失:

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

重启你的serlvet容器才能生效。

答案 1 :(得分:0)

如果对类使用JAXB注释会有帮助吗?也许您可以将其用作教程:http://www.vogella.com/tutorials/JAXB/article.html