0

I've got a simple stateless EJB with a method that takes a basic enum as an argument and returns the same enum.

@Stateless
@LocalBean
public class SerialBean implements RemoteSerial {
    @Override
    public Whatever enumTest(Whatever type) {
        return type;
    }
}

Here's the simple enum:

public enum Whatever {
    TEST,
    CONNECT_TEST
}

And a simple client:

Properties jndiProps = new Properties();
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
jndiProps.put("jboss.naming.client.ejb.context", true);

try {
    Context ctx = new InitialContext(jndiProps);
    RemoteSerial serial = (RemoteSerial)ctx.lookup("rmi_test/rmi_ejb/SerialBean!test.RemoteSerial");
    System.out.println(serial.enumTest(Whatever.TEST));
    System.out.println(serial.enumTest(Whatever.CONNECT_TEST));
} catch (NamingException ex) {
    ex.printStackTrace();
}

When I run this code, the client successfully connects to WildFly and returns the first result (TEST). However, the client then freezes when performing the second method call (CONNECT_TEST). No response is received.

If I change the name of CONNECT_TEST to something that doesn't have CONNECT in it, the code works. I can even change CONNECT to cONNECT and that works.

I've tried this in both 10.0 and 10.1 on Windows 7 using jdk1.8.0_102 and 121.

What could possibly be going on here?

Mike Digdon
  • 21
  • 1
  • 4
  • I've been doing some testing with a variety of platforms. The following combinations have worked as they should: * Linux to Linux * Linux to Win7 desktop (the desktop where I'm experiencing this problem) * Win10 desktop (a different machine) to Linux * Win10 desktop to Win7 desktop A packet trace shows that the Win7 desktop isn't sending the problematic data at all. This all works fine with JBoss 6.1, so there's obviously some strange thing going on with my desktop and WildFly 10 client stuff. – Mike Digdon Jan 23 '17 at 19:48
  • I eventually figured out what was happening - Kaspersky was freaking out over content in the data stream. As soon as I disabled Kaspersky, everything began to work as expected. Indeed, Kaspersky and WildFly don't get along particularly well at all. – Mike Digdon Dec 21 '18 at 18:34

1 Answers1

0

I was unable to reproduce your results. For comparison, here's my code, in full.

Server (ejb module rmi_test):

TestEnum.java

package com.example.rmitest;

public enum TestEnum {
    TEST, CONNECT_TEST
}

SerialBean.java

package com.example.rmitest;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;

@Stateless
@LocalBean
public class SerialBean implements RemoteSerial {

    @Override
    public TestEnum enumTest(TestEnum input) {
        return input;
    }

}

RemoteSerial.java

package com.example.rmitest;

import javax.ejb.Remote;

@Remote
public interface RemoteSerial {
    TestEnum enumTest(TestEnum input);
}

Client (standalone JSE app, with wildfly-10.1.0.Final/bin/client/jboss-client.jar on it's classpath):

Client.java

package com.example.rmitest;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class Client {

    public static void main(String... args) {
        RemoteSerial remoteSerial = lookupRemoteService();
        System.out.println(remoteSerial.enumTest(TestEnum.TEST));
        System.out.println(remoteSerial.enumTest(TestEnum.CONNECT_TEST));
    }
    
    private static RemoteSerial lookupRemoteService() {
        try {
            return (RemoteSerial) jndiConnect().lookup("/rmi_ejb/SerialBean!com.example.rmitest.RemoteSerial");
        } catch (NamingException e) {
            throw new RuntimeException("Failed to lookup a remote interface", e);
        }
    }

    private static Context jndiConnect() {
        try {
            Properties properties = new Properties();
            properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
            properties.setProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080");
            properties.setProperty("jboss.naming.client.ejb.context", "true");
            return new InitialContext(properties);
        } catch (NamingException e) {
            throw new RuntimeException("Failed to establish a connection", e);
        }
    }

}

And finally, my console output:

TEST

CONNECT_TEST

Community
  • 1
  • 1
korolar
  • 1,340
  • 1
  • 11
  • 20