diff --git a/README.md b/README.md
index 85039a6..d56012a 100644
--- a/README.md
+++ b/README.md
@@ -36,4 +36,8 @@ To compile and run the example you can simply use a maven call:
cd client
mvn clean compile package exec:java
-You should see the example result "Hello World" and the the remotely queried Wildfly Home Dir on the output.
\ No newline at end of file
+You should see the example result "Hello World" and the the remotely queried Wildfly Home Dir on the output.
+
+#Contributor
+
+- @ryankarl65
\ No newline at end of file
diff --git a/client/pom.xml b/client/pom.xml
index ae1e950..c46469e 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -33,8 +33,8 @@
1.2.1
- 1.7
- 1.7
+ 8
+ 8
@@ -127,8 +127,18 @@
jboss-marshalling-river
runtime
+
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.12.1
+
+
+
+
${project.artifactId}
diff --git a/client/src/main/java/com/illucit/ejbremote/EjbRemoteClient.java b/client/src/main/java/com/illucit/ejbremote/EjbRemoteClient.java
index 036d4d4..bc1db3c 100644
--- a/client/src/main/java/com/illucit/ejbremote/EjbRemoteClient.java
+++ b/client/src/main/java/com/illucit/ejbremote/EjbRemoteClient.java
@@ -1,154 +1,92 @@
package com.illucit.ejbremote;
-import static javax.naming.Context.INITIAL_CONTEXT_FACTORY;
-import static javax.naming.Context.PROVIDER_URL;
-import static javax.naming.Context.URL_PKG_PREFIXES;
-
-import java.util.Hashtable;
-import java.util.Map;
+import com.illucit.ejbremote.server.ExampleService;
+import com.illucit.ejbremote.utils.EjbUrlUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import javax.naming.Context;
-import javax.naming.InitialContext;
import javax.naming.NamingException;
+import java.util.Map;
-import com.illucit.ejbremote.server.ExampleService;
+import static com.illucit.ejbremote.utils.ContextUtils.createEjbProxy;
+import static com.illucit.ejbremote.utils.ContextUtils.createRemoteEjbContext;
/**
* Remote EJB Client.
- *
- * @author Christian Simon
*
+ * @author Christian Simon
*/
public class EjbRemoteClient {
- /**
- * Run example.
- *
- * @param args
- * (not used)
- */
- public static void main(String[] args) {
-
- // Connection to Wildfly Server instance
- String host = "127.0.0.1";
- String port = "8080"; // Wildfly HTTP port
-
- Context remotingContext;
- try {
- remotingContext = createRemoteEjbContext(host, port);
- } catch (NamingException e) {
- System.err.println("Error setting up remoting context");
- e.printStackTrace();
- return;
- }
-
- // Syntax: ejb:${appName}/${moduleName}/${beanName}!${remoteView}
- // appName = name of EAR deployment (or empty for single EJB/WAR
- // deployments)
- // moduleName = name of EJB/WAR deployment
- // beanName = name of the EJB (Simple name of EJB class)
- // remoteView = fully qualified remote interface class
- String ejbUrl = "ejb:/ejb-remote-server/ExampleServiceImpl!com.illucit.ejbremote.server.ExampleService";
-
- ExampleService service;
- try {
- service = createEjbProxy(remotingContext, ejbUrl, ExampleService.class);
- } catch (NamingException e) {
- System.err.println("Error resolving bean");
- e.printStackTrace();
- return;
- } catch (ClassCastException e) {
- System.err.println("Resolved EJB is of wrong type");
- e.printStackTrace();
- return;
- }
-
- // Call remote method with parameter
-
- String toGreet = "World";
-
- String exampleResult;
- try {
- exampleResult = service.greet(toGreet);
- } catch (Exception e) {
- System.err.println("Error accessing remote bean");
- e.printStackTrace();
- return;
- }
-
- // Hello World!
- System.out.println("Example result: " + exampleResult);
-
- // Retrieve result from EJB call
-
- Map