How to change my standalone client's remote ejb configuration to not reference org.jboss.ejb.client in JBoss EAP 7.1
Issue
- How to change my standalone client's remote ejb configuration to not reference org.jboss.ejb.client in JBoss EAP 7.1
- We are getting ClassNotFoundException org.jboss.ejb.client.EJBClientConfiguration when migrating an application to JBoss EAP 7.1
Caused by: java.lang.ClassNotFoundException: org.jboss.ejb.client.EJBClientConfiguration from [Module "deployment.application.ear" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 60 more
- We were using the PropertiesBasedEJBClientConfiguration configuration in JBoss EAP 6.x / 7.0 for our standalone application to call a remote EJB in JBoss EAP, is it possible to not depend on the org.jboss.ejb.client classes?
import org.jboss.ejb.client.EJBClientConfiguration;
import org.jboss.ejb.client.ContextSelector;
import org.jboss.ejb.client.PropertiesBasedEJBClientConfiguration;
import org.jboss.ejb.client.EJBClientContext;
import org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector;
private void setupEJBContext(String host, String port, String username, String password) {
Properties p = new Properties();
p.put("remote.connections", "default");
p.put("remote.connection.default.host", host);
p.put("remote.connection.default.port", port);
p.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
p.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
p.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
p.put("remote.connection.default.username", username);
p.put("remote.connection.default.password", password);
EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(p);
ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);
EJBClientContext.setSelector(selector);
}
public void invokeEJB(String host, String port, String username, String password) {
setupEJBContext(host, port, username, password);
Properties env = new Properties();
env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
InitialContext ctx = new InitialContext(env);
Hello ejbObject = (Hello) ctx.lookup("ejb:/ejb-client//Hello!jboss.example.ejb.Hello");
System.out.println("Response: " + ejbObject.sayHello());
}
Environment
Red Hat JBoss Enterprise Application Platform (EAP) 7.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.