EJBCLIENT000021: EJB client context selector may not be changed in JBoss EAP 6

Solution Verified - Updated -

Issue

I'm setting up an ejb client in JBoss EAP 6 server A to call an EJB in JBoss EAP 6 server B and I'm getting this exception

Caused by: java.lang.RuntimeException: Failed to setup EJB remote context
    at org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:468) [jboss-client.jar:7.1.2.Final-redhat-1]
    at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:145) [jboss-client.jar:7.1.2.Final-redhat-1]
    ... 54 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_30]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_30]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_30]
    at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_30]
    at org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:448) [jboss-client.jar:7.1.2.Final-redhat-1]
    ... 55 more
Caused by: java.lang.SecurityException: EJBCLIENT000021: EJB client context selector may not be changed
    at org.jboss.ejb.client.EJBClientContext.setSelector(EJBClientContext.java:186) [jboss-ejb-client-1.0.10.Final-redhat-1.jar:1.0.10.Final-redhat-1]
    at org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector.setupSelector(RemoteNamingEjbClientContextSelector.java:28) [jboss-client.jar:7.1.2.Final-redhat-1]
    ... 60 more
  • We are seeing this exception:
java.lang.SecurityException: EJBCLIENT000021: EJB client context selector may not be changed
        at org.jboss.ejb.client.EJBClientContext.setSelector(EJBClientContext.java:210)

My client code running in JBoss EAP 6 below. Does that mean I can't use programmatic settings, but have to use a properties-file?

Properties props = new Properties();
props.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
props.put("remote.connections", "default");
props.put("remote.connection.default.port", 4447);
props.put("remote.connection.default.host", host); 
props.put("remote.connection.default.username", username);
props.put("remote.connection.default.password", password);
props.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
props.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");

EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(props);

// create and set the selector
ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);
EJBClientContext.setSelector(selector);

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 6.0.x
    • 6.1.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In