4 Replies Latest reply on Oct 10, 2007 7:40 PM by ron_sigal

    ejb3 and NO_THROW_ON_ERROR, how can it be set.

    rino_salvade

      We would like to use ejb3 with http. So far things work fine but we get a problem with exceptions.
      The problem is that we would like to use the same code to connect with http and rmi. This can be done with the proper configuration on the server side.
      In the http case we get WebServerException where in the rmi configuration we get the proper excpetions that the code can handle. So far based on the documentation and other postings we found out that the NO_THROW_ON_ERROR parameter could be the solution to the dilema. To my understanding this has to be set in the metadata map on the client side. And here comes the problem. To my understanding the client side ejb3 stubs are generated on the server side and transferred to the client. So we do not have direct influence on the invoke method in the remoting package.
      Is there a solution to set the parameter as a startup property or in the server side configuration?

        • 1. Re: ejb3 and NO_THROW_ON_ERROR, how can it be set.
          itsme

          We have the same problem using ejb3 over http with jboss-remoting coming along with jboss4.2.0.

          We also get the right exception when making calls over rmi but getting UndeclaredThrowable caused WebServerError when making the same calls using http as transport.

          Any solutions to this? Is there a configuration needed on the server side?

          regards
          /sandor/

          • 2. Re: ejb3 and NO_THROW_ON_ERROR, how can it be set.
            rino_salvade

            So far we didn't find a solution to set the property. They we understand the documentation it is the proper remoting behaviour to use WebServerError if you use servlet as transport (which we do). The appropriate http headers indicate this as well as a 500 message.
            This caused additional problems for use because we're connecting through a reverse proxy which wraps http 500 messages additionally with its own html error page. So we got a complete mess up.
            We changed the code off the remoting library for testing purposes to ensure that exceptions are as well sent back as http 200 and get proper encoded (as in the standard case). This works but I do not feel too comfortable with this solution-

            • 3. Re: ejb3 and NO_THROW_ON_ERROR, how can it be set.
              mputz

              this is now scheduled for the Remoting 2.4.0 release:
              http://jira.jboss.com/jira/browse/JBREM-804

              • 4. Re: ejb3 and NO_THROW_ON_ERROR, how can it be set.
                ron_sigal

                 


                We changed the code off the remoting library for testing purposes to ensure that exceptions are as well sent back as http 200 and get proper encoded (as in the standard case). This works but I do not feel too comfortable with this solution-


                After further consideration, I came to the same conclusion and implemented a fix for JBREM-813 "ServletServerInvoker should return an exception instead of just an error message" (http://jira.jboss.com/jira/browse/JBREM-813).

                The fix is available in Remoting release 2.2.2.SP2, which is available in the repository (http://repository.jboss.com/jboss/remoting/).

                I tested the solution with the example in the wiki page "Accessing_EJB3s_over_HTTP_HTTPS" (http://wiki.jboss.org/wiki/Wiki.jsp?page=Accessing_EJB3s_over_HTTP_HTTPS), and it works, with a couple of amendments:

                1. The JBREM-813 page discusses the need to add to the Connector configuration the parameter "return-exception" set to "true".

                2. There seems to be a typo in the wiki example. In particular, CalcluatorHttpBean uses the annotation

                @RemoteBinding(clientBindUrl="http://localhost:8080/servlet-invoker/ServerInvokerServlet")
                


                which should be changed to

                @RemoteBinding(clientBindUrl="servlet://localhost:8080/servlet-invoker/ServerInvokerServlet")
                


                That is, the transport is the servlet transport rather than the http transport.