10 Replies Latest reply on May 6, 2013 10:36 AM by totempole

    Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0

    totempole

      Following the "ejb-security-interceptors" project in EAP quick-start, I intend to pass an application user(end user) principal from a remote EJB client running on JBoss Portal 2.6.5GA to the EJB hosted in EAP6.1.0.  The remote communication failed due to the error, "java.lang.RuntimeException: Operation failed with status WAITING". While the exact same code works just fine with AS7.1.0. With the same ear file on the server side, I tried two versions of jboss-client.jar from AS7.1.0 and EAP6.1.0, they don't make a difference. On the other hand, AS7.1.0 doesn't support the most desired "ejb-security-interceptors". It is practically a dead end. Really appreciate anyone who can shed the light on this problem.

       

      Totempole

        • 1. Re: Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0
          wdfink

          You need to post a bit more information how you try to connect the EJB and show how the EJB is registered at server side.

          • 2. Re: Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0
            wdfink

            Also I move the thread to the EAP6.1.Alpha forum

            • 3. Re: Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0
              totempole

              On the client side, the EJB client is proxied by Spring, like this,

              <jee:remote-slsb id="bpmTaskListServiceRemote"

                                  business-interface="***.***.***.BpmTaskListServiceRemote"

                                  jndi-name="***-services-ear/BpmTaskListService/remote" cache-home="false" lookup-home-on-startup="true" expose-access-context="true"

                                  resource-ref="false" refresh-home-on-connect-failure="true" environment-ref="jndiEnvironment" />

               

              <util:properties id="jndiEnvironment">

                          <prop key="java.naming.factory.initial">${Jndi.Context.BusTier.java.naming.factory.initial}</prop>

                          <prop key="java.naming.factory.url.pkgs">${Jndi.Context.BusTier.java.naming.factory.url.pkgs}</prop>

                  <prop key="java.naming.provider.url">${Jndi.Context.BusTier.java.naming.provider.url}</prop>

                  <prop key="jboss.naming.client.ejb.context">${Jndi.Context.BusTier.jboss.naming.client.ejb.context}</prop>

                  <prop key="java.naming.security.principal">${Jndi.Context.BusTier.java.naming.security.principal}</prop>

                  <prop key="java.naming.security.credentials">${Jndi.Context.BusTier.java.naming.security.credentials}</prop>

              </util:properties>

               

              In my jboss-ejb-client.properties file,

              remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

              remote.connections=default

              remote.connection.default.host=localhost

              remote.connection.default.port=4447

              remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

               

              Obviously, the same client works fine with the EAR deployed on AS7.1.0. While invoking the exact same EAR deployed on EAP6.1.0, I received the following error,

              ... nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.sprin

              gframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.b

              eans.factory.BeanCreationException: Error creating bean with name 'bpmTaskListServiceRemote': Invocation of init method failed; ne

              sted exception is javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException

              : Operation failed with status WAITING]

               

              Note it is the exact same client on JBoss Portal 2.6.5GA, and the same EAR deployed to AS7.1.0 and EAP6.1.0. Tried different jboss-client.jar from AS7.1.0 and EAP6.1.0, I don't see any difference in the outcome. To rule out possible configuration issues, I tested a remote EJB client example in EAP quick start projects, and it worked with no issues. I didn't even tried "ejb-security-interceptors" in the above test case.

               

              Any help will be greatly appreciated.

              • 4. Re: Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0
                ctomc

                Hi,

                 

                change should be in xnio-*.jar and jboss-remoting.jar not in jboss-client.jar

                 

                check if this ones are newer / match the newer version of server.

                 

                 

                --

                tomaz

                • 5. Re: Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0
                  totempole

                  Thanks for the insight.

                  I tried declaring "jboss-as-ejb-client-bom" as a maven dependency, which ended up as a bunch of JARs including xnio-*.jar and jboss-remoting.jar. Later on, I realized that the holistic jboss-client.jar has everything inside, including the same xnio-*.jar and jboss-remoting.jar packages. However, despite how I swapped these JARs from AS7.1.0 and EAP6.1.0, the results are always the same error message.


                  • 6. Re: Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0
                    totempole

                    More findings to share with the community,

                     

                    1. java.lang.IllegalStateException: No EJB receiver available for handling.

                    This error suggests a missing jboss-ejb-client.properties file. This thread discusses how to avoid the properties file, https://community.jboss.org/message/745410#745410.

                     

                    2. Operation Failed with status WAITING

                    This message suggests a mismatch of Jboss remoting jars. It happened to me when I used AS7.1.0 jboss-client.jar to invoke ejbs on EAP6.1.0.

                     

                    3. Failed to connect to any server. Servers tried: [remote://localhost:4447]

                    This error gave me a real hard time. I am not sure the exact cause of the error. However, it appears that the jboss-client.jar coming along with EAP6.1.0 only takes requests with "org.jboss.ejb.client.naming", meaning the jndi name must have an "ejb:/" prefix. I received the above vague message when "ejb:/" prefix is not specified. In the case that "org.jboss.ejb.client.naming" is not provided in the properties of InitialContext, I always received the same error, despite the ejb prefix was added or not. Is this a bug in EAP6.1.0?

                    • 7. Re: Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0
                      wdfink

                      totempole schrieb:

                       

                      3. Failed to connect to any server. Servers tried: [remote://localhost:4447]

                      This error gave me a real hard time. I am not sure the exact cause of the error. However, it appears that the jboss-client.jar coming along with EAP6.1.0 only takes requests with "org.jboss.ejb.client.naming", meaning the jndi name must have an "ejb:/" prefix. I received the above vague message when "ejb:/" prefix is not specified. In the case that "org.jboss.ejb.client.naming" is not provided in the properties of InitialContext, I always received the same error, despite the ejb prefix was added or not. Is this a bug in EAP6.1.0?

                       

                      There are several options to lookup the proxy.

                      The remote-naming (which I do not recomend to use fro ejb's) use the lookup name without 'ejb:' prefix and is initialized with InitialContext properties only. ProviderURL start with 'remote:'

                       

                      Other posibility is to use the jboss-ejb-client.properties or the scoped-context which is initialized with InitialContext properies. Both need to have the "org.jboss.ejb.client.naming" property and the 'ejb:' prefix for lookup.

                       

                      I think this is not a bug.

                      • 8. Re: Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0
                        totempole

                         

                        There are several options to lookup the proxy.

                        The remote-naming (which I do not recomend to use fro ejb's) use the lookup name without 'ejb:' prefix and is initialized with InitialContext properties only. ProviderURL start with 'remote:'

                         

                        Other posibility is to use the jboss-ejb-client.properties or the scoped-context which is initialized with InitialContext properies. Both need to have the "org.jboss.ejb.client.naming" property and the 'ejb:' prefix for lookup.

                         

                        I think this is not a bug.

                         

                         

                        The test is extremely simple. I took the "RemoteCalculator" example from jboss-eap-6.1.0.Alpha1-quickstarts projects. The sample standalone client makes use of "org.jboss.ejb.client.naming" with "ejb:/" jndi prefix, and it works with the ejb deployed on EAP6.1.0. Below is the code snippet to create the InitialContext,

                         

                            private static RemoteCalculator lookupRemoteStatelessCalculator() throws NamingException

                            {

                                final Hashtable jndiProperties = new Hashtable();

                                jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                                jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

                                jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");

                                jndiProperties.put(Context.SECURITY_PRINCIPAL, "vwcadmin");

                                jndiProperties.put(Context.SECURITY_CREDENTIALS, "vwc@admin1");

                                //  jndiProperties.put("jboss.naming.client.ejb.context", "true");       

                                final Context context = new InitialContext(jndiProperties);

                         

                               return (RemoteCalculator) context.lookup(

                                 "ejb:/jboss-as-ejb-remote-server-side/CalculatorBean!" + RemoteCalculator.class.getName()

                              );

                            }

                         

                            Here is the jboss-ejb-client.properties file inside the client jar "jboss-as-ejb-remote-client.jar".

                                  remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

                                  remote.connections=default

                                  remote.connection.default.host=localhost

                                  remote.connection.default.port=4447

                                  remote.connection.default.username=vwcadmin

                                  remote.connection.default.password=vwc@admin1

                                  remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

                         

                        To make use of "remote-naming", I made the following changes, and received the error "Failed to connect to any server. Servers tried: [remote://localhost:4447]"

                         

                            private static RemoteCalculator lookupRemoteStatelessCalculator() throws NamingException

                            {

                                final Hashtable jndiProperties = new Hashtable();

                                //  jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");  

                                jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

                                jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");

                                jndiProperties.put(Context.SECURITY_PRINCIPAL, "vwcadmin");

                                jndiProperties.put(Context.SECURITY_CREDENTIALS, "vwc@admin1");

                                //  jndiProperties.put("jboss.naming.client.ejb.context", "true");       

                                final Context context = new InitialContext(jndiProperties);

                         

                               return (RemoteCalculator) context.lookup(

                                 "jboss-as-ejb-remote-server-side/CalculatorBean!" + RemoteCalculator.class.getName()

                              );

                            }

                           

                             No changes were made to the jboss-ejb-client.properties file.

                         

                        Any thought?

                        • 9. Re: Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0
                          totempole

                          totempole wrote:

                           

                           

                          There are several options to lookup the proxy.

                          The remote-naming (which I do not recomend to use fro ejb's) use the lookup name without 'ejb:' prefix and is initialized with InitialContext properties only. ProviderURL start with 'remote:'

                           

                          Other posibility is to use the jboss-ejb-client.properties or the scoped-context which is initialized with InitialContext properies. Both need to have the "org.jboss.ejb.client.naming" property and the 'ejb:' prefix for lookup.

                           

                          I think this is not a bug.

                           

                           

                          The test is extremely simple. I took the "RemoteCalculator" example from jboss-eap-6.1.0.Alpha1-quickstarts projects. The sample standalone client makes use of "org.jboss.ejb.client.naming" with "ejb:/" jndi prefix, and it works with the ejb deployed on EAP6.1.0. Below is the code snippet to create the InitialContext,

                           

                              private static RemoteCalculator lookupRemoteStatelessCalculator() throws NamingException

                              {

                                  final Hashtable jndiProperties = new Hashtable();

                                  jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                                  jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

                                  jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");

                                  jndiProperties.put(Context.SECURITY_PRINCIPAL, "vwcadmin");

                                  jndiProperties.put(Context.SECURITY_CREDENTIALS, "vwc@admin1");

                                  //  jndiProperties.put("jboss.naming.client.ejb.context", "true");       

                                  final Context context = new InitialContext(jndiProperties);

                           

                                 return (RemoteCalculator) context.lookup(

                                   "ejb:/jboss-as-ejb-remote-server-side/CalculatorBean!" + RemoteCalculator.class.getName()

                                );

                              }

                           

                              Here is the jboss-ejb-client.properties file inside the client jar "jboss-as-ejb-remote-client.jar".

                                    remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

                                    remote.connections=default

                                    remote.connection.default.host=localhost

                                    remote.connection.default.port=4447

                                    remote.connection.default.username=vwcadmin

                                    remote.connection.default.password=vwc@admin1

                                    remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

                           

                          To make use of "remote-naming", I made the following changes, and received the error "Failed to connect to any server. Servers tried: [remote://localhost:4447]"

                           

                              private static RemoteCalculator lookupRemoteStatelessCalculator() throws NamingException

                              {

                                  final Hashtable jndiProperties = new Hashtable();

                                  //  jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");  

                                  jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

                                  jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");

                                  jndiProperties.put(Context.SECURITY_PRINCIPAL, "vwcadmin");

                                  jndiProperties.put(Context.SECURITY_CREDENTIALS, "vwc@admin1");

                                  //  jndiProperties.put("jboss.naming.client.ejb.context", "true");       

                                  final Context context = new InitialContext(jndiProperties);

                           

                                 return (RemoteCalculator) context.lookup(

                                   "jboss-as-ejb-remote-server-side/CalculatorBean!" + RemoteCalculator.class.getName()

                                );

                              }

                             

                               No changes were made to the jboss-ejb-client.properties file.

                           

                          Any thought?

                           

                          Interesting enough, the second test case now works with EAP6.1.0 Beta, which was just released today!

                          What I did is deploying the exact same app jboss-as-ejb-remote-server-side.jar to EAP6.1.0 Beta, and there is no touch on the client side whatsoever.

                          • 10. Re: Remote EJB connection failed after migrating from AS7.1.0 to EAP6.1.0
                            totempole

                            Nailed down the problem eventually. The highlighted element was missing from our standalone.xml file. Once added back, the problem is gone.

                             

                                      <subsystem xmlns="urn:jboss:domain:naming:1.2">

                                             <remote-naming/>

                                    </subsystem>

                             

                            However, AS7.1.1Final doesn't seem to be affected by the missing <remote-naming/> element at all. It simply works without the <remote-naming/>.

                             

                            Thanks