1

我在 JBoss Seam 应用程序中使用 RestEasy,但我得到了一个奇怪的异常,它的信息量不是很大。我的 Seam 2.2.2.GA 应用程序中有以下 jar:

  • jaxrs-api-2.2.0.GA.jar
  • resteasy-jaxrs-2.2.0.GA.jar
  • jboss-seam-resteasy-2.2.0.GA.jar

我已经设置了我的资源的路径,如下所示:

@Path("/chartSvc")
@Stateless
@Name("chartAction")
@Scope(ScopeType.CONVERSATION)
public class ChartAction implements Serializable, ChartActionLocal{

public ChartAction() {}

@GET
@Path("/populateChart")
@Produces("text/plain")
public String populateChart() {
String chartData = generateDummyChartData();
return chartData;
}

现在,当我尝试在 /seam/resource/svc/chartSvc/populateChart 访问我的 URL 时,我得到了这个异常:

javax.servlet.ServletException: Servlet execution threw an exception
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
    org.jboss.seam.web.RewriteFilter.doFilter(RewriteFilter.java:63)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
    org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
    org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
    org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
root cause

java.lang.NoSuchMethodError: org.jboss.resteasy.specimpl.PathSegmentImpl.parseSegments(Ljava/lang/String;)Ljava/util/List;
    org.jboss.seam.resteasy.ResteasyResourceAdapter.extractUriInfo(ResteasyResourceAdapter.java:198)
    org.jboss.seam.resteasy.ResteasyResourceAdapter$1.process(ResteasyResourceAdapter.java:128)
    org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
    org.jboss.seam.resteasy.ResteasyResourceAdapter.getResource(ResteasyResourceAdapter.java:121)
    org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
    org.jboss.seam.web.RewriteFilter.doFilter(RewriteFilter.java:63)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
    org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
    org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
    org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
    org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)

我的资源从未被触及,这表明这可能与我的设置有关,但我不知道从哪里开始调试,因为我确信我拥有所有正确版本的库。谁能帮我开始调试这个?这是我的第一个接缝应用程序。

4

1 回答 1

2

这个问题原来是 rest easy-jaxrs.jar 和 jboss-seam-resteasy.jar 之间的版本不兼容。jboss-seam-resteasy.jar 是 2.2.0.GA,其余的 easy-jaxrs.jar 也是如此。但是,您需要 resteasy-jaxrs.jar-1.1-RC2.jar 才能使用 jboss-seam-resteasy-2.2.0.GA.jar。更换罐子解决了我的问题。

于 2013-01-13T11:15:40.297 回答