Announcement Announcement Module
Collapse
No announcement yet.
Spring Roo RestEasy Integration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Roo RestEasy Integration

    I have created a project using Spring Roo which works well, but I have tried to add RestEasy to the mix and can't seem to make heads or tails of why things aren't working. Does anyone have any experience with this? I followed the RestEasy documentation @ http://jboss.org/file-access/default...ng_Integration but when I try to hit one of my restful URLs I get this error

    Code:
    Mapping [/rest/concept] to handler '[email protected]c4d5'
    Exception thrown in getLastModified
    javax.servlet.ServletException: No adapter for handler [[email protected]c4d5]: Does your handler implement a supported interface like Controller?
    	at org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:992)
    	at org.springframework.web.servlet.DispatcherServlet.getLastModified(DispatcherServlet.java:864)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:613)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
    	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    	at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
    	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
    	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
    	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
    	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:71)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:57)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:379)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:619)

  • #2
    I have never tried using RestEasy, and since their integration point seems to fail I guess you should ask there. Maybe their integration is not compatible with Spring 3.0 yet? I don't see how this is a Roo specific problem though since all Roo does is make use of Spring @MVC.

    Can I ask why you would use RestEasy when Roo generated applications do already offer support for RESTful controllers out of the box by leveraging the new Spring MVC features?

    -Stefan

    Comment


    • #3
      I was actually able to get this working, the issue is that Spring Roo uses a UrlRewriteFilter in which I needed to setup a rule to ignore a specific end point.

      In regards to RESTful support built into Spring 3.0 I saw a post about this (http://blog.springsource.com/2009/03...-spring-3-mvc/) but as I am new to Spring MVC I did not know where to start. I also saw (http://blog.springsource.com/2009/03...-rest-support/) but the structure of the program is much more simple than that of a project generated by Spring Roo. If there was documentation on how to do this in a Spring Roo project I would definitely be interested in taking a closer look, are you aware of any or able to provide some pointers as to where to start for a project like this?

      Comment


      • #4
        So I gave this a whirl....from spring roo I did

        controller class ~.web.MyController

        which maps to /my/**

        but, when I tried to access http://localhost:8080/test/my via the web browser I get

        Code:
        Oct 24, 2009 9:44:45 PM org.apache.catalina.core.ApplicationDispatcher invoke
        SEVERE: Servlet.service() for servlet ddf threw exception
        javax.servlet.ServletException: Could not resolve view with name 'term' in servlet with name 'ddf'
        	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1054)
        	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:808)
        	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:726)
        	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:636)
        	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:545)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
        	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
        	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
        	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
        	at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
        	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
        	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
        	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
        	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:71)
        	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:57)
        	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
        	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
        	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:379)
        	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        	at java.lang.Thread.run(Thread.java:619)
        Is there something else that needs to be done in Spring roo for this to work properly?

        Comment


        • #5
          Hi,

          From what you shared here I am having a hard time reproducing your issue. Keep in mind that all artifacts that Roo generates and maintains are stock standard Spring MVC. So you can take a look at the reference documentation for Spring 3: http://static.springsource.org/sprin...html/ch15.html

          Also in your previous message you asked for documentation on the Spring MVC 3.0 features that allow you to develop RESTful controllers I would also encourage you to take a look at the reference documentation as linked above. Maybe you can also ask in the Web forum about your specific problems you outlined above. You would definetely need to share a little more of what exactly you are doing though.

          Furthermore I have also written a few blog posts on Spring MVC REST integration: http://stsmedia.net/spring-finance-p...t-integration/ as well as another post on content negotiation: http://stsmedia.net/spring-finance-p...and-xml-views/


          Cheers,
          Stefan
          I hope this gets you started

          Comment


          • #6
            This is great! Thanks for the pointers.

            Is there a way to download the sample project in it's entirety?

            Comment


            • #7
              I am actually having some issues running this. I updated my pom.xml file as was indicated at

              http://spring-finance-manager.google.../trunk/pom.xml

              but I keep getting Missing artificat org.codehaus.jackson:com.springsource.org.codehaus .jackson:jar:1.0.0:compile

              Is there something else I need to do? (sorry new to maven as well).

              Comment


              • #8
                This was actually a typo...I have a basic example working fine.

                Is there documentation on how to marshal a data type passed in this way? For instance if I have

                @RequestMapping("/", method = RequestMethod.Post)
                public XmlObject addObject(XmlObject value) {
                ...
                }
                where XmlObject is my Jaxb annotated class to be added to the collection.

                Also I don't see any documentation detailing how to get at QueryParameters (JAX-RS has a @QueryParam annotation). Is there something similar in this?

                Comment

                Working...
                X