To begin with I am a newbie to OpenEJB standards. So please forgive my lack of knowledge on the topic.
I have a server application running on JBOSS 7.1.1 AS. I want to create a web client running on Tomee and be able to communicate with JBOSSS server (to use EJB injection in my webclient)
I tried adding jboss-client.jar to my webclient but since Tomee has its own openejb implementation, I was getting ClassNotFoundExceptions org.jboss.ejb.client.EJBClientConfiguration
Following was my contextInitalisation code
Properties ejbProperties = new Properties();
ejbProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
ejbProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
ejbProperties.put("remote.connections", "default");
ejbProperties.put("remote.connection.default.host", host);
ejbProperties.put("remote.connection.default.port", port);
ejbProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS", "JBOSS-LOCAL-USER"); // needed for forcing authentication over remoting (i.e. if you have a custom login module)
ejbProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false"); // needed for a login module that requires the password in plaintext
ejbProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "true");
ejbProperties.put("remote.connection.default.username", username);
ejbProperties.put("remote.connection.default.password", md5);
final EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(ejbProperties);
// here, a UnresolvedAddressException or SaslException is thrown but cannot be catched
// so if server address is wrong or login cannot be determined
final ConfigBasedEJBClientContextSelector selector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration);
EJBClientContext.setSelector(selector);
EJBClientContext.getCurrent().registerInterceptor(0, new ClientInterceptor());
context = new InitialContext(ejbProperties);
So i retried creating InitialContext using OpenEJBproperties in my client instead
ejbProperties.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
ejbProperties.put("java.naming.provider.url", "ejbd://" + host + ":" + port);
ejbProperties.put("java.naming.security.principal", username);
ejbProperties.put("java.naming.security.credentials", md5);
Now i get following errors console/log WARNING: RequestFailed{server=ejbd://localhost:4447} JNDI_LOOKUP:/ejb:XXX {error=Cannot determine server protocol version: Received OEJP/4.6 : Failed to read spec: [0, 0, 0, 12, 0, 0, 9, 49]}
SEVERE: Servlet /Web threw load() exception org.apache.openejb.client.ClientRuntimeException: Invalid response from server: -1 at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:468) at javax.naming.InitialContext.lookup(InitialContext.java:411)
On a side note I also see these warnings in my console WARNING: jar 'XXX\build\web\WEB-INF\lib\hibernate-jpa-2.0-api-1.0.1.Final.jar' contains offending class: javax.persistence.Entity. It will be ignored. Apr 10, 2015 10:31:51 AM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile WARNING: jar 'XXX\build\web\WEB-INF\lib\jboss-client.jar' contains offending class: javax.transaction.Transaction. It will be ignored.
I am struggling with this issue for quiet some time now. Any help is highly appreciated..
Thank You