praktikum1/aufgabe1
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<!-- Abhängigkeit zu den EJB-Interfaces des Server-Moduls -->
|
||||
<dependency>
|
||||
<groupId>de.componentware</groupId>
|
||||
<artifactId>ejb-uebung</artifactId>
|
||||
<artifactId>ejb-server</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- BOM für alle WildFly EJB-Client Abhängigkeiten -->
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.example.demo.praktikum1.aufgabe1;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.Context;
|
||||
import java.util.Properties;
|
||||
|
||||
public class Client {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Properties props = new Properties();
|
||||
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
|
||||
"org.wildfly.naming.client.WildFlyInitialContextFactory");
|
||||
props.setProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080");
|
||||
|
||||
InitialContext ctx = new InitialContext(props);
|
||||
String jndiName = "ejb:/ejb-server-1.0-SNAPSHOT/Calculator!org.example.demo.praktikum1.aufgabe1.CalculatorRemote";
|
||||
var calc = (CalculatorRemote) ctx.lookup(jndiName);
|
||||
|
||||
System.out.println("6 + 7 = " + calc.addiere(6, 7));
|
||||
System.out.println("6 - 7 = " + calc.subtrahiere(6, 7));
|
||||
System.out.println("6 * 7 = " + calc.multipliziere(6, 7));
|
||||
System.out.println("6 / 7 = " + calc.dividiere(6, 7));
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public class Client {
|
||||
props.setProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080");
|
||||
|
||||
InitialContext ctx = new InitialContext(props);
|
||||
String jndiName = "ejb:/ejb-uebung-1.0-SNAPSHOT/Encryptor!org.example.demo.uebung1.aufgabe16.EncryptorRemote";
|
||||
String jndiName = "ejb:/ejb-server-1.0-SNAPSHOT/Encryptor!org.example.demo.uebung1.aufgabe16.EncryptorRemote";
|
||||
EncryptorRemote encryptor = (EncryptorRemote) ctx.lookup(jndiName);
|
||||
|
||||
String original = "Hallo Welt";
|
||||
|
||||
@@ -11,7 +11,7 @@ public class Client {
|
||||
props.setProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080");
|
||||
|
||||
InitialContext ctx = new InitialContext(props);
|
||||
String jndiName = "ejb:/ejb-uebung-1.0-SNAPSHOT/Counter!org.example.demo.uebung1.aufgabe17.CounterRemote?stateful";
|
||||
String jndiName = "ejb:/ejb-server-1.0-SNAPSHOT/Counter!org.example.demo.uebung1.aufgabe17.CounterRemote?stateful";
|
||||
CounterRemote counter = (CounterRemote) ctx.lookup(jndiName);
|
||||
|
||||
System.out.println(counter.getAndIncrement());
|
||||
|
||||
Reference in New Issue
Block a user