0 Replies Latest reply on Jul 30, 2017 8:35 PM by gberish

    What causes elusive: NoSuchMethodError: org.jboss.remoting3.Remoting.createEndpoint()?

    gberish

      Many people have asked for help with this error:

       

      javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.NoSuchMethodError: org.jboss.remoting3.Remoting.createEndpoint(Ljava/lang/String;Lorg/xnio/OptionMap;)Lorg/jboss/remoting3/Endpoint;]

          at

      org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:51)

        at

      org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:152)

        at

      javax.naming.spi.NamingManager.getInitialContext(Unknown Source)

      ...

       

      But no request I can find ever provides a conclusive answer. Just suggestions to tinker with jars.

       

      I believe that’s because there’s an inconsistency among all the many org.jboss.remoting3 packages included in different jars. (I know that's supposed to be impossibe, but I think it is. Can anyone confirm or correct that?

       

      Here’s my code that throws the above error: (Note: I do NOT believe the error has anything to do with the Properties values.  Because until execution gets past the NoSuchMenthodError above those I don't think those are even read.)

       

      My code is really just one line in one of my classes constuctor method.

       

      constructor: {Context ctx = new InitialContext(this.env);}

      // static member

      final private Properties env = new Properties() {

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

        put(Context.PROVIDER_URL, "http-remoting://localhost:9990");

        put(Context.SECURITY_PRINCIPAL, "myID"); 

        put(Context.SECURITY_CREDENTIALS, "myPassword");

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

        }

      };

      /****************************************************

      * myID & myPassword open the Admin GUI for wildfly *

      * on localhost:9990                                *

      ****************************************************/

       

      Because there were so many discussions about jars being the problem, I removed all jars from the Build path.

      Then I ran my program till all ClassNotFoundException were gone.

       

      First Error

      java.lang.ClassNotFoundException:

      org.jboss.naming.remote.client.InitialContextFactory]

      Added jboss-remote-naming-1.0.7.final.jar to class path

       

      Second Error

      java.lang.NoClassDefFoundError:

      org/jboss/logging/Logger

      Added jboss-logging.jar

       

      Third Error

      java.lang.NoClassDefFoundError:

      org/xnio/Options

      Added xnio-api-3.0.7.ga.jar

       

      Fourth Error

      java.lang.NoClassDefFoundError:

      org/jboss/remoting3/spi/ConnectionProviderFactory

      Added jboss-remoting-3.jar

       

      Fifth Error

      java.lang.NoClassDefFoundError:

      org/jboss/ejb/client/EJBClientContextIdentifier

      Added jboss-ejb-client-1.0.19.final.jar

       

      FINAL AND FATAL ERROR

      (Note: All NoClassDefFoundError have been cleared. Now it is a NoSuchMethodError)

      java.lang.NoSuchMethodError: org.jboss.remoting3.Remoting.createEndpoint(Ljava/lang/String;Lorg/xnio/OptionMap;)Lorg/jboss/remoting3/Endpoint;]

       

      Using Eclipse’s Project Explorer I verified:

       

      1. jboss-remoting3.jar has the org.jboss.remoting3.Remoting Class.

       

      2. And that Remoting Class has this Method:

      public Endpoint createEndpoint (String, Executor, OptionMap)

      Note: 3 parameter signature.

       

      BUT the FINAL FATAL ERROR above calls

      public Endpoint createEndpoint (String, OptionMap)

      I.e. it calls for createEndpoint() with a 2-parameters signature. Hence the NoSuchMethodError.

       

      Looking at the top lines in the stack trace, I guess

      org.jboss.naming.remote.client.InitialContextFactory.getInitialContext() is trying to call org.jboss.remoting3.Remoting.createEndpoint() using 2 parameters, but org.jboss.remoting3.Remoting only defines a createEndpoint() method with a 3-paramater signature.

       

      Is that supposed to even be possible?

       

      I mean to have one jar with the org.jboss.remoting3 package whose Remoting class has a createEndpoint() method with a 3-parameter signature, and another jar with the org.jboss.remoting3 package whose Remoting class has another createEndpoint() method with a 2-parameter signature?

       

      HELP!

       

      I mean do I need to look through every org.jboss.remoting3 package to find one whose Remoting class has a 2 parameter createEnpoint() method?

       

      Or am I missing something important.

       

      It seems like a good reason why there are so many questions posted about this error:

       

      javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.NoSuchMethodError: org.jboss.remoting3.Remoting.createEndpoint(Ljava/lang/String;Lorg/xnio/OptionMap;)Lorg/jboss/remoting3/Endpoint;]

       

      And why there is never a conclusive explanation or solution.

       

      I mean getting an InitialContext from WildFly running on the same PC as the Java program should be pretty trivial.  And it hasn’t been.