13 Replies Latest reply on May 21, 2009 6:03 PM by Gábor Farkas

    error 404 invoking Seam Remote Servlet

    Xavier Boubés Newbie

      Hi,


      I'm trying to communicate my GWT (Google Web Toolkit) application with Seam Remote, my web.xml is properly configurated with:



         <servlet>
            <servlet-name>Seam Resource Servlet</servlet-name>
            <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
         </servlet>
          
         <servlet-mapping>
            <servlet-name>Seam Resource Servlet</servlet-name>
            <url-pattern>/seam/resource/*</url-pattern>
         </servlet-mapping>
      



      the web part of the application is running in a .war, and seam app is deployeded as an .ear.


      When I try to invoke the Remote Service Servlet I get a 404 error, and this log in the error.log:



      2008-03-02 15:22:04,860 DEBUG [org.ajax4jsf.webapp.BaseFilter] Filter start request processing at 02/03/08 15:22  for uri: /myapp/seam/resource/gwt
      2008-03-02 15:22:04,860 DEBUG [org.ajax4jsf.webapp.BaseFilter] Incoming request has Content-Type header with character encoding utf-8
      2008-03-02 15:22:04,860 DEBUG [org.ajax4jsf.webapp.BaseFilter] Filter request output to XML
      2008-03-02 15:22:04,860 DEBUG [org.ajax4jsf.webapp.BaseXMLFilter] XML filter service start processing request
      2008-03-02 15:22:04,860 DEBUG [org.ajax4jsf.webapp.BaseXMLFilter] create HTML/XML parser for content type: null
      2008-03-02 15:22:04,860 DEBUG [org.ajax4jsf.webapp.BaseXMLFilter] Parser not have support for the such content type, send response as-is
      2008-03-02 15:22:04,860 DEBUG [org.ajax4jsf.webapp.BaseFilter] Finished request processing total time 0ms for uri: /myapp/seam/resource/gwt
      



      I searched in the internet and forums a couple of days, but I can't find a solution for this.


      I think that my interfaces are ok.


      Thanks a lot for your time.


        • 1. Re: error 404 invoking Seam Remote Servlet
          Shane Bryzak Master

          Did you include jboss-seam-remoting.jar in your project?

          • 2. Re: error 404 invoking Seam Remote Servlet
            Xavier Boubés Newbie

            No, I added jboss-seam-remoting.jar to my lib and deployed ear project, but I'm getting a 404 error again.


            My jars in that ear are:


            antlr-runtime.jar 
            core.jar
            drools-compiler.jar
            drools-core.jar
            janino.jar
            jboss-el.jar
            jboss-seam-remoting.jar
            jbpm-jpdl.jar
            mvel14.jar
            richfaces-api.jar
            



            I need any other jar in?


            Thanks for your time.

            • 4. Re: error 404 invoking Seam Remote Servlet
              Xavier Boubés Newbie

              I added it too to my ear, but that doesn't solve the problem.


              I'm very confused with this error.


              Thanks for your interest Shane.


              • 5. Re: error 404 invoking Seam Remote Servlet
                Shane Bryzak Master

                Do you get the following line in your log file when you deploy?



                17:29:45,174 INFO  [Component] Component: org.jboss.seam.remoting.remoting, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.remoting.Remoting


                • 6. Re: error 404 invoking Seam Remote Servlet
                  Xavier Boubés Newbie

                  Yes I do, there is all the logs talking about 'Remoting':



                  .
                  .
                  .
                  23:50:09,097 INFO  [Initialization] Namespace: http://jboss.com/products/seam/remoting, package: org.jboss.seam.remoting, prefix: org.jboss.seam.remoting
                  .
                  .
                  .
                  
                  jar:file:/my_path_to_the_server/jboss-4.2.2.GA/server/default/tmp/deploy/tmp3263myapp.ear-contents/lib/jboss-seam-remoting.jar!/META-INF/components.xml
                  .
                  .
                  .
                  jar:file:/my_path_to_the_server/jboss-4.2.2.GA/server/default/tmp/deploy/tmp3263myapp.ear-contents/myapp-exp.war/WEB-INF/lib/jboss-seam-remoting.jar!/META-INF/components.xml
                  .
                  .
                  .
                  23:50:10,284 INFO  [Component] Component: org.jboss.seam.remoting.gwt.gwtToSeamAdapter, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.remoting.gwt.GWTToSeamAdapter
                  23:50:10,293 INFO  [Component] Component: org.jboss.seam.remoting.remoting, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.remoting.Remoting
                  .
                  .
                  .
                  




                  • 7. Re: error 404 invoking Seam Remote Servlet
                    Shane Bryzak Master

                    Hmm, you seem to be missing the gwtRemoteService component, you should also be getting this in your log also:



                    10:10:51,352 INFO  [Component] Component: org.jboss.seam.remoting.gwt.gwtRemoteService, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.remoting.gwt.GWT14Service



                    Where are you including the gwt-servlet.jar?  It should be in the /lib directory in your ear file.  I'm also assuming that you're using Seam 2.0.1.GA.

                    • 8. Re: error 404 invoking Seam Remote Servlet
                      Xavier Boubés Newbie

                      Yes, I have it


                      09:23:26,977 INFO  [Component] Component: org.jboss.seam.remoting.gwt.gwtRemoteService, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.remoting.gwt.GWT14Service
                      



                      And I'm using Seam 2.0.1.GA.

                      • 9. Re: error 404 invoking Seam Remote Servlet
                        Shane Bryzak Master

                        I would start by setting a breakpoint in GWTService.getResource(), just to make sure it's being hit when you make your remote request.  If it doesn't get hit, I'd then try SeamResourceServlet.doGet() to see what it's doing when it receives the request.  It should be passing the request off to GWTService.

                        • 10. Re: error 404 invoking Seam Remote Servlet
                          Xavier Boubés Newbie

                          Thanks a lot for your Help Shane!!


                          My war file was running the web application in a subdirectory like this:


                          warPackage.war/webapp


                          Then I modified my xml to map with this structure and SeamResourceServlet.doGet() catch the breakpoint correctly. Here's my new web.xml



                             <servlet>
                                <servlet-name>Seam Resource Servlet</servlet-name>
                                <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
                             </servlet>
                              
                             <servlet-mapping>
                                <servlet-name>Seam Resource Servlet</servlet-name>
                                <url-pattern>/webapp/seam/resource/*</url-pattern>
                             </servlet-mapping>
                          



                          But now I have this error:



                          java.lang.RuntimeException: No such component: org.macrosoft.client.MyService
                               at org.jboss.seam.remoting.gwt.GWTToSeamAdapter.callWebRemoteMethod(GWTToSeamAdapter.java:73)
                               at org.jboss.seam.remoting.gwt.GWTService.processCall(GWTService.java:246)
                               at org.jboss.seam.remoting.gwt.GWTService$1.process(GWTService.java:146)
                               at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
                               at org.jboss.seam.remoting.gwt.GWTService.getResource(GWTService.java:130)
                               at org.jboss.seam.servlet.SeamResourceServlet.doGet(SeamResourceServlet.java:75)
                               at org.jboss.seam.servlet.SeamResourceServlet.doPost(SeamResourceServlet.java:92)
                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                               at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                               at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                               at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                               at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                               at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                               at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                               at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                               at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                               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:230)
                               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                               at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                               at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                               at java.lang.Thread.run(Thread.java:595)




                          I followed the call execution and throws is launched in GWTToSeamAdapter class:



                                // Find the component we're calling
                                Component component = Component.forName(serviceIntfName);
                          
                                if (component == null)
                                   throw new RuntimeException("No such component: " + serviceIntfName);
                               
                          



                          serviceIntfName value is:


                          org.mycompany.client.MyService.



                          and there are my local interface:



                          package org.mycompany.myproject.services;
                          
                          import javax.ejb.Local;
                          
                          import org.jboss.seam.annotations.remoting.WebRemote;
                          
                          @Local
                          public interface MyService 
                          {
                                    @WebRemote
                                public String askIt(String question);
                                
                          }
                          



                          and my implementation class:



                          package org.mycompany.myproject.services;
                          
                          import javax.ejb.Stateless;
                          
                          import org.jboss.seam.annotations.Name;
                          
                          @Stateless 
                          @Name("org.mycompany.client.MyService")
                          public class ServiceImpl implements MyService
                          {
                            public String askIt(String question)
                            {
                              return "42. Its the real question that you seek now.";
                            }
                          }
                          
                          
                          



                          I understand that the server can't found my service. Is only required the name annottation to find the ServiceImpl class?


                          I can see this log when I deploy my app:



                          20:23:05,463 INFO  [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
                          20:23:05,463 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=myapp.ear,jar=myapp.jar,name=ServiceImpl,service=EJB3 with dependencies:
                          20:23:05,471 INFO  [EJBContainer] STARTED EJB: org.macrosoft.macroject.services.ServiceImpl ejbName: ServiceImpl
                          



                          I readed seam documentation and various information in the internet included this usefull entry in JIRA: http://jira.jboss.org/jira/browse/JBSEAM-2277.


                          I revised my code and I think it's correct.


                          Thanks a lot again for your help and sorry for my horrible level of english.











                          • 11. Re: error 404 invoking Seam Remote Servlet
                            Xavier Boubés Newbie

                            Solved!!


                            My build.xml was wrong. I added targets for my new packages and all works fine.


                            Anyway, thanks a lot for your help Shane.

                            • 12. Re: error 404 invoking Seam Remote Servlet
                              Ramazan YILDIRIM Newbie

                              If you get a 404/file not found error and if you have ui:includes in your xhtml file, possibly one of the included xhtml files is missing.

                              • 13. Re: error 404 invoking Seam Remote Servlet
                                Gábor Farkas Newbie

                                I had a similar error when this was missing from my application.xml:



                                    <module>
                                        <ejb>jboss-seam-remoting.jar</ejb>
                                    </module>
                                



                                And of course you have to have that jar there in your EAR root. You'll then have the line also mentioned above in your startup logs like this:



                                Component: org.jboss.seam.remoting.gwt.gwtToSeamAdapter, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.remoting.gwt.GWTToSeamAdapter
                                



                                Furthermore, it can also happen that your service impl class is not loaded because it misses some class dependencies, like RemoteService from gwt-servlet.jar, or your GWT client classes. You can see a line in the logs saying 'skipping class ...'.