RUN ActiveMQ
- cd /opt/activemq/apache-activemq-5.15.10/bin
- sudo sh activemq start
- password: biar
Check ActiveMQ
- localhost:8161
Execute JAR file
- java -cp <file name with dependencies> <package>.<nameServer>
Execute JAR file
- java -cp <file name with dependencies> <package>.<nameServer>
- if use microservices put 0.0.0.0 on the server ip configuration.
public class Server {
public static void main(String args[]) throws InterruptedException {
WSImpl implementor = new WSImpl();
String address = "http://0.0.0.0:8080/WSInterface";
Endpoint.publish(address, implementor);
while(true) {}
//Thread.sleep(60 * 1000);
//System.exit(0);
}
}
version: '3'
services:
soap:
build: .
ports:
- "8080:8080"
port: "external exposed:internal server port"
FROM openjdk:8-alpine
RUN apk --no-cache add curl
COPY ./4-SOAP-WebService-1.0.jar /usr/app/
WORKDIR /usr/app
EXPOSE 8080
ENTRYPOINT ["java", "-cp", "4-SOAP-WebService-1.0.jar", "it.sapienza.softeng.soapws.Server"]
set up the container
- cd <directory container>
- docker build -t <name> .
- docker-compose up
show images on docker
- docker images
show the container that are running:
- docker ps
look docker/JSM folder AND 03B-JMSServant-microService.
we must modify the logical address like:
- FROM props.setProperty(Context.PROVIDER_URL, "tcp://localhost:61616");
- TO props.setProperty(Context.PROVIDER_URL, "tcp://broker:61616");
and verify if the based service is running on the server file:
//check if activeMQ is up and running (micro service)
boolean serverReady = false;
while (!serverReady) {
Socket socket = new Socket();
try {
socket.connect(new InetSocketAddress("broker", 8161), 5000);
socket.close();
serverReady = true;
System.out.println("... broker is finally ready");
} catch(Exception ex){
serverReady = false;
System.out.println("... broker NOT yet ready...");
}
}