8 Replies Latest reply on Jul 20, 2015 1:18 PM by ganeshment

    Wildfly 8.2 http port 8080 remote access problem with Invalid response code 200

    ganeshment

      We have deployed Wildfly 8.2 server on one machine and configured it to use 8080 as http port.

       

      Trying to access the server from a remote machine using the test case attached is giving the exceptions below. If we use ANY other port or run the test case on the same machine then the issue is not observed.

       

      java.lang.RuntimeException: org.xnio.http.UpgradeFailedException: Invalid response code 200

        at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:92)

        at demo.RemoteEJBClient.main(RemoteEJBClient.java:76)

      Caused by: org.xnio.http.UpgradeFailedException: Invalid response code 200

        at org.xnio.http.HttpUpgrade$HttpUpgradeState$UpgradeResultListener.handleEvent(HttpUpgrade.java:471)

        at org.xnio.http.HttpUpgrade$HttpUpgradeState.flushUpgradeChannel(HttpUpgrade.java:369)

      2015-06-24 08:17:12,078 [main] TRACE org.jboss.remoting.resource (AbstractHandleableCloseable.java:136) - Closing endpoint "default" <2f375701> synchronously

        at org.xnio.http.HttpUpgrade$HttpUpgradeState.access$900(HttpUpgrade.java:165)

        at org.xnio.http.HttpUpgrade$HttpUpgradeState$ConnectionOpenListener.handleEvent(HttpUpgrade.java:340)

        at org.xnio.http.HttpUpgrade$HttpUpgradeState$ConnectionOpenListener.handleEvent(HttpUpgrade.java:320)

        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

        at org.xnio.nio.WorkerThread$ConnectHandle.handleReady(WorkerThread.java:324)

        at org.xnio.nio.WorkerThread.run(WorkerThread.java:539)

        at ...asynchronous invocation...(Unknown Source)

        at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:272)

        at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:253)

        at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:351)

        at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:335)

        at demo.RemoteEJBClient.main(RemoteEJBClient.java:74)

       

      Test Case Details

       

      It first makes a HTTP call and gets the response code.

      Then tries to create a remote EJB connection.

       

       

      private static void makeHTTPCall(){

          HttpURLConnection connection = null;

          try {

               URL url = new URL("http://xxx.xxx.xx.xx:" + "8080");

               connection = (HttpURLConnection) url.openConnection();

        

               int httpCode = connection.getResponseCode();

               System.out.println("*** Response Code *** " + httpCode);

          } catch(Exception e){

        

          } finally {

               if(connection != null)

                    connection.disconnect();

          }

      }

       

      public static void main(String[] args) {

        

          makeHTTPCall();

              try {

                       endpoint = Remoting.createEndpoint("default", OptionMap.EMPTY);

                       endpoint.addConnectionProvider("http-remoting", new HttpUpgradeConnectionProviderFactory(),

                           OptionMap.create(Options.SSL_ENABLED, Boolean.FALSE, Options.SASL_SERVER_AUTH,

                                            Boolean.FALSE));

                       MyCallbackHandler callbackhndlr = new MyCallbackHandler(USER_LOGIN_NAME, USER_PASSWORD);

                       // open a connection

                       URI uri = new URI("http-remoting://xxx.xxx.xx.xx:" + "8080");

       

                       Builder bld = OptionMap.builder();

                       bld.set(Options.SASL_POLICY_NOPLAINTEXT, Boolean.FALSE);

                      bld.set(Options.SASL_POLICY_NOANONYMOUS, Boolean.FALSE);

                      bld.set(RemotingOptions.HEARTBEAT_INTERVAL, 600000);

           

                       final IoFuture<Connection> futureConnection = endpoint.connect(uri, bld.getMap(), callbackhndlr);

        

                       connection = IoFutureHelper.get(futureConnection,5L, TimeUnit.SECONDS);

             } catch (Exception e) {

                  e.printStackTrace();

                  close();

                  return;

             }

             

              ejbClientContext = EJBClientContext.create();

              ejbClientContext.registerConnection(connection);

              @SuppressWarnings("unused")

              final ContextSelector<EJBClientContext> previousSelector = EJBClientContext.setConstantContext(ejbClientContext);

              // setting up something for transactions

              final EJBClientTransactionContext localUserTxContext = EJBClientTransactionContext.createLocal();

              EJBClientTransactionContext.setGlobalContext(localUserTxContext);

              close();

          }

       

      trace.log contains the output of the test case with TRACE log messages.


      Can you please suggest how to fix this issue.