7 Replies Latest reply on Jan 21, 2014 2:54 PM by Ian Auty

    TransactionRecoveryContextInitializer not found - Client error EAP 6.2

    Ian Auty Newbie

      Hello all,

       

      I'm really hoping someone here can help me with an error I'm receiving on my EJB project. I feel I have covered all areas required to call a remote method using EJB but must be missing something. The stack trace below is coming from the Client application, no errors are seen on the server when

      deploying the ejb jar or when calling the remote method.

       

      Exception in thread "AWT-EventQueue-0" java.util.ServiceConfigurationError: org.jboss.ejb.client.EJBClientContextInitializer: Provider org.jboss.ejb.client.TransactionRecoveryContextInitializer not found
          at java.util.ServiceLoader.fail(Unknown Source)
          at java.util.ServiceLoader.access$300(Unknown Source)
          at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
          at java.util.ServiceLoader$1.next(Unknown Source)
          at org.jboss.ejb.client.EJBClientContext.init(EJBClientContext.java:108)
          at org.jboss.ejb.client.EJBClientContext.create(EJBClientContext.java:164)
          at org.jboss.ejb.client.EJBClientContext.create(EJBClientContext.java:145)
          at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.<init>(ConfigBasedEJBClientContextSelector.java:70)
          at org.jboss.ejb.client.EJBClientContext.<clinit>(EJBClientContext.java:77)
          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:120)
          at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
          at $Proxy0.checkUserPassword(Unknown Source)
          at com.tribalgroup.client.ui.LoginScreen.actionPerformed(LoginScreen.java:179)
          at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
          at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
          at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
          at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
          at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
          at java.awt.Component.processMouseEvent(Unknown Source)
          at javax.swing.JComponent.processMouseEvent(Unknown Source)
          at java.awt.Component.processEvent(Unknown Source)
          at java.awt.Container.processEvent(Unknown Source)
          at java.awt.Component.dispatchEventImpl(Unknown Source)
          at java.awt.Container.dispatchEventImpl(Unknown Source)
          at java.awt.Component.dispatchEvent(Unknown Source)
          at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
          at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
          at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
          at java.awt.Container.dispatchEventImpl(Unknown Source)
          at java.awt.Window.dispatchEventImpl(Unknown Source)
          at java.awt.Component.dispatchEvent(Unknown Source)
          at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
          at java.awt.EventQueue.access$200(Unknown Source)
          at java.awt.EventQueue$3.run(Unknown Source)
          at java.awt.EventQueue$3.run(Unknown Source)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
          at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
          at java.awt.EventQueue$4.run(Unknown Source)
          at java.awt.EventQueue$4.run(Unknown Source)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
          at java.awt.EventQueue.dispatchEvent(Unknown Source)
          at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
          at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
          at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
          at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
          at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
          at java.awt.EventDispatchThread.run(Unknown Source)
      
      

       

      I've tried debugging the client to see if any variables are null before calling the method and I can't see any, the proxy object is created as expected. Could this be due to the server configuration?

       

      Please can you let me know what areas of the project you would like me to provide for you?

       

      Thanks!

      Ian

        • 1. Re: TransactionRecoveryContextInitializer not found - Client error EAP 6.2
          Wolf-Dieter Fink Master

          Could you share the client configuration and relevant code?

          • 2. Re: TransactionRecoveryContextInitializer not found - Client error EAP 6.2
            Ian Auty Newbie

            Hi Wolf,

             

            Thanks for getting back to me. Of course, please see below:

             

            Client application classes:

             

            public class ClientUtility {
            
                private static Context initialContext;
            
                public static Context getInitialContext() throws NamingException {
            
                    if (initialContext == null) {
            
                        Properties properties = new Properties();
            
                        properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
            
                        properties.put("jboss.naming.client.ejb.context", true);
            
                        initialContext = new InitialContext(properties);
            
                    }
            
                    return initialContext;
            
                }
            
            }
            
            private UserOperationsRemote remoteUserOperations;
            
                public LoginScreen()
                {
            
                    super(new MigLayout(), new Dimension(600, 400), "");     
            
                    remoteUserOperations = doLookupRemoteUserOperations();
            
                    System.out.println("Create Remote User Operations");
            
                    if(remoteUserOperations == null)
                    {
                        System.err.println("null");
                    }
                 
                    createMainPane();
            
                }
            
            private static UserOperationsRemote doLookupRemoteUserOperations() {
            
                    Context context = null;
            
                    UserOperationsRemote bean = null;
            
                    try {
            
                        // 1. Obtaining Context
            
                        context = ClientUtility.getInitialContext();
                     
                        // 2. Generate JNDI Lookup name
            
                        String lookupName = getLookupNameRemoteUserOperations();
            
                        System.out.println(lookupName);
            
                        // 3. Lookup and cast
            
                        bean = (UserOperationsRemote) context.lookup(lookupName);
            
                    } catch (NamingException e) {
            
                        e.printStackTrace();
            
                    }
            
                    return bean;
            
                }
            
               private static String getLookupNameRemoteUserOperations() {
            
                    /*
            
                    The app name is the EAR name of the deployed EJB without .ear suffix.
            
                    Since we haven't deployed the application as a .ear,
            
                    the app name for us will be an empty string
            
                    */
            
                            String appName = "";      
            
                            /* The module name is the JAR name of the deployed EJB
            
                            without the .jar suffix.
            
                            */
            
                            String moduleName = "TribalSupportDesk";      
            
                    /*AS7 allows each deployment to have an (optional) distinct name.
            
                    This can be an empty string if distinct name is not specified.
            
                    */
            
                            String distinctName = "";      
            
                            // The EJB bean implementation class name
            
                            String beanName = UserOperations.class.getSimpleName();      
            
                            // Fully qualified remote interface name
            
                            final String interfaceName = UserOperationsRemote.class.getName();
                  
                            // Create a look up string name
            
                            String name = "ejb:" + appName + "/" + moduleName + "/" + beanName + "!" + interfaceName;            
            
                            return name;
            
                }
            
            @Override
            
                public void actionPerformed(ActionEvent e) {
            
                    if(e.getSource().equals(login))
                    {
            
                        if(!userNameField.getText().isEmpty())
                        {
                            MD5 md5 = new MD5();
            
                            try {
            
                                md5.Update(userNameField.getText(), null);
            
                            } catch (UnsupportedEncodingException e1) {
            
                                e1.printStackTrace();
            
                            }
            
                            String hash = md5.asHex();
            
                            if(remoteUserOperations.checkUserPassword(hash)) //Remote method called
                            {
                                System.out.println("Yay");
                            }
                            else
                            {
                                System.out.println("Nay");
                            }
                        }
            
                    }
            
                    else if(e.getSource().equals(cancel))
                    {
                    }
                    else if(e.getSource().equals(logoButton))
                    {
                    }
            
                }
            
            

             

            My ejb-jar.xml is as follows:

             

            <?xml version="1.0" encoding="UTF-8"?>
            
            <ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" version="3.1">
            
              <display-name>TribalSupportDesk</display-name>
            
            </ejb-jar>
            
            
            
            
            
            

             

             

             

             

             

            jboss-ejb-client.properties

             

            endpoint.name=client-endpoint
            
            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
            
            remote.connection.default.username=ejbuser
            
            remote.connection.default.password=ejbuser123!
            
            
            
            
            
            
            
            
            

             

            Server remote interface:

             

            @Remote
            
            
            public interface UserOperationsRemote{
            
            
              
            
            
                public User findUser(int userId);
            
            
              
            
            
                public int saveNew(User u);
            
            
               public int update(User u);
            
            
                public ArrayList findAll();
            
            
                public User returnUser(String username, String password);
            
            
              
            
            
                public ArrayList userPasswordCheck(String password);
            
            
                public boolean checkUserPassword(String md5);
            
            
            }
            
            
            
            
            

            Please let me know if there is anything else I can provide for you.

             

            Thanks,

            Ian

            • 3. Re: TransactionRecoveryContextInitializer not found - Client error EAP 6.2
              Wolf-Dieter Fink Master

              You use the PROVIDER_URL and jboss-ejb-client.properties for the ejb-client approach.

              But also add the property "jboss.naming.client.ejb.context" which is the remote-naming approach.


              I've seen many weird issues mixing that, could you remove this extra property and check whether you are able to invoke the EJB?

              See EJB invocations from a remote client using JNDI

              1 of 1 people found this helpful
              • 4. Re: TransactionRecoveryContextInitializer not found - Client error EAP 6.2
                Ian Auty Newbie

                Hi Wolf,

                 

                Thanks for your help so far. Unfortunately removing the extra property hasn't made a difference - I'm sure it will have fixed another issue I was surely going to run into though! Do you have any other suggestions? My server configuration is default except for adding the relevant management user and app user using add-user.bat. Are there any additional JAR files I need to add to the client or server's classpath?

                 

                In my client I have included jboss-client.jar and in the server jboss-modules.jar.

                 

                Thanks,

                Ian

                • 5. Re: TransactionRecoveryContextInitializer not found - Client error EAP 6.2
                  Ian Auty Newbie

                  Hi Wolf,

                   

                  I've created a new project and pulled the code through from the example you provided in the link. The new project works absolutely fine! I'm struggling to understand what part of my code is making this happen, I've began to simplify so the area which invokes the EJB looks almost identical to the tutorial example. I guess it's a case of reducing everything and going through with a fine tooth comb!

                   

                  Thanks,

                  Ian

                  • 6. Re: TransactionRecoveryContextInitializer not found - Client error EAP 6.2
                    Wolf-Dieter Fink Master

                    Strange, you might add your findings and mark the thread as "answered" to help others

                    • 7. Re: TransactionRecoveryContextInitializer not found - Client error EAP 6.2
                      Ian Auty Newbie

                      Hi Wolf,

                       

                      It sure is strange. I have a feeling that there may have been something wrong with the project I had set up. After creating a new one, I began migrating my code across and have managed to invoke the EJB, which although is only a small step, it's very good to see!

                       

                      Thanks again for your help!

                      Ian