12 Replies Latest reply on Aug 12, 2014 11:27 AM by jaikiran pai Branched to a new discussion.

    EJB3 marshalling compression

    Marc Anthony Puca Newbie

      Hello

       

      Can anybody point me in the right direction for enabling EJB 3.0 marshalling compression on AS 7, I am about to migrate from  JBoss 4.2.1 GA

       

      thanks

       

      Marc

        • 1. Re: EJB3 marshalling compression
          jaikiran pai Master

          There's no support for that in AS 7 but WildFly 8 has it. Are you interested in upgrading to WildFly?

          • 2. Re: EJB3 marshalling compression
            Marc Anthony Puca Newbie

            Hi Jaikiran

             

            I am willing to try, but does it support EJB 2.0 entity beans?

             

            thanks

             

            Marc

            • 3. Re: EJB3 marshalling compression
              Wolf-Dieter Fink Master

              No EJB2 entity bean support is removed from WildFly according to the EJB3 spec which mark this as optional.

              If you still use EntityBeans you need to have AS7.2, EAP6.1.0.Alpha or even EAP6.1 if you have a subscription.

               

              But I recommend to migrate the Entities to JPA, also you can migrate the SLSB to EJB3. From my experience it will be a bit work to do that but you will save time later as the application should be focus on business and not on technical code as this was with EJB2.

              You can still ship EJB2 interfaces to be support old EJB2 clients.

              • 4. Re: EJB3 marshalling compression
                Marc Anthony Puca Newbie

                Hi Jaikiran

                 

                I will migrate my entitiy beans, how would I go about enabling compression marshalling

                 

                thanks

                 

                Marc

                • 5. Re: EJB3 marshalling compression
                  jaikiran pai Master

                  Here's a testcase which illustrates how to do it https://github.com/wildfly/wildfly/blob/master/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/compression/CompressionTestCase.java.

                   

                  The summary of what needs to be done is explained here https://github.com/jbossas/jboss-ejb-client/pull/40. Give it a try and if you have any questions or run into problems, feel free to post here. Just to reiterate, this requires any of the released WildFly versions http://wildfly.org/download/

                  • 6. Re: EJB3 marshalling compression
                    jaikiran pai Master

                    jaikiran pai wrote:

                     

                    Here's a testcase which illustrates how to do it https://github.com/wildfly/wildfly/blob/master/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/compression/CompressionTestCase.java.

                     

                    By the way, in that test you'll see this:

                     

                            System.setProperty("org.jboss.ejb.client.view.annotation.scan.enabled", "true");

                    you can set that system property outside the code by passing it as a JVM argument.

                    • 7. Re: EJB3 marshalling compression
                      Ulrich Scholz Newbie

                      Hi Jaikiran,

                       

                      I am trying to enable EJB 3.0 marshalling compression in a Wildfly-8.1.0.final environment and am rather sure of having followed your instructions given in this thread. However, it seems to me that compression is working only in one direction. The EJB 3 client is able to detect the compression hints, it is able to send a compressed request to the server, the server is able to detect and decompress the request, but never sends a compressed response back to the client. Looking into the source code I haven't found any clues indicating that data passed to the OutboundMessage MessageOutputStream would ever get a chance of being compressed on its way to the client.

                       

                      Am I missing something, or is this feature really not fully implemented yet? Your kind advice would be very appreciated.

                       

                      Thanks,

                      Uli

                      • 8. Re: EJB3 marshalling compression
                        jaikiran pai Master

                        What does your @CompressHint annotation look like on your remote bean interface and what does the calling client code look like?

                        • 9. Re: EJB3 marshalling compression
                          Andreas Capellmann Newbie

                          Hello Ulrich,

                           

                          did you somehow manage to activate the response compression? I am currently observing exactly the same problem. I start my remote client with -Dorg.jboss.ejb.client.view.annotation.scan.enabled=true and the remote interface of my stateless session bean is annotated correctly with @CompressionHint. When I debug through the remote invocation, I can see that the EJB client compresses the request, but the response is not beeing compressed by the server as one can easily see with a network sniffer (I am using WireShark).

                           

                          Thanks for your help!

                           

                          Andreas

                          • 10. Re: EJB3 marshalling compression
                            Ulrich Scholz Newbie

                            Hello Jaikiran,

                             

                            thank you very much for your reply.

                             

                            I use CompressableDataBean and MethodOverrideDataCompressionRemoteView exactly as given in https://github.com/wildfly/wildfly/tree/master/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/compression plus slightly modified client code in order to use a PropertiesBasedEJBClientConfiguration as follows:

                             

                            public static void testCompressedInvocation() throws Exception {
                                // set the system property which enables annotation scan on the client view
                                System.setProperty("org.jboss.ejb.client.view.annotation.scan.enabled", "true");
                                try {
                                    // create a proxy for invocation
                                    final Properties props = new Properties();
                                   
                                    props.put("endpoint.name", "client-endpoint");
                                    props.put("remote.connections", "default");
                                    props.put("remote.connection.default.port", "8080");
                                    props.put("remote.connection.default.host", "localhost");
                                   
                                    props.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
                                    props.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
                                   
                                    EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(props);
                                    ContextSelector contextSelector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration);
                                    EJBClientContext.setSelector(contextSelector);
                                   
                                    Properties properties = new Properties();
                                    properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
                                    final Context jndiCtx = new InitialContext(properties);

                             

                                   
                                    final MethodOverrideDataCompressionRemoteView bean = (MethodOverrideDataCompressionRemoteView) jndiCtx.lookup("ejb:" + APP_NAME + "/" + MODULE_NAME + "/" + "" + "/CompressableDataBean!" + MethodOverrideDataCompressionRemoteView.class.getName());
                                    final String message = "some message";

                             

                                    // only request compression
                                    final String echoWithRequestCompressed = bean.echoWithRequestCompress(message);

                             

                                    // only response compressed
                                    final String echoWithResponseCompressed = bean.echoWithResponseCompress(message);

                             

                                    // both request and response compressed based on the annotation at the view class level
                                    final String echoWithRequestAndResponseCompressed = bean.echoWithNoExplicitDataCompressionHintOnMethod(message);
                                } finally {
                                    // remove the system property which enables annotation scan on the client view
                                    System.getProperties().remove("org.jboss.ejb.client.view.annotation.scan.enabled");
                                }
                            }

                             

                            When I step through this code with a debugger and watch the network traffic with a sniffer, I make the same observations as described by Andreas Capellmann on Aug 9th and also by me in my first post: the server's response is never being compressed.

                             

                            Kind regards,

                            Uli

                            • 11. Re: EJB3 marshalling compression
                              Ulrich Scholz Newbie

                              Hello Andreas,

                               

                              thank you for sharing your experience concerning the usage of compression hints. As I have stated today, I observe exactly the same behaviour as you did.

                               

                              However, I must admit that I haven't investigated the compression issue any deeper. Mainly this is because there is an even worse drawback for us concerning the new EJB Remoting: it seems that traffic passed via the HTTP Upgrade mechanism won't pass neither a HTTP nor a reverse proxy, and there are scenarios in which we can't avoid this. Maybe you'll want to have a look at https://community.jboss.org/thread/239770 which unfortunately hasn't been answered up to now. For this reason we have dropped the new EJB Remoting and decided to continue using a proprietary tunneling servlet solution as a start.

                               

                              Kind regards and good luck,

                              Uli

                              • 12. Re: EJB3 marshalling compression
                                jaikiran pai Master

                                Could one you of please file a JIRA for this at WildFly - JBoss Issue Tracker so that someone can take a look at it?