ibm-messaging / mq-dev-badge-sample

Sample code of the MQ developer essentials badge
Apache License 2.0
13 stars 37 forks source link

Java 11 update (Jakarta XML Bind library and Maven) #11

Closed Tanmay-Kudchadkar closed 2 years ago

Tanmay-Kudchadkar commented 2 years ago

This pull request was created to update the existing code to work with Java 11. It uses the Jakarta XML Bind library instead of the Javax XML Bind library. The directories have also been restructured to integrate Maven.

chughts commented 2 years ago

The application that runs inside the docker image is already maven enabled, so we should be using maven to package the executable and copy only the uber jar that gets created into the run image.

We will then not need all the wget statements as a mvn package clean will fetch all the dependencies.

The first image can be based on https://hub.docker.com/_/maven eg. FROM maven:3.6-jdk-11 or FROM 3.8.4-openjdk-11

see https://stackoverflow.com/questions/27767264/how-to-dockerize-maven-project-and-how-many-ways-to-accomplish-it

chughts commented 2 years ago

In the dockerfile update the tested list.

 Switch to the MQ image
  Tested with
      9.2.4.0-r1
      9.2.0.0-r2
      9.2.0.0-r1
      9.1.5.0-r2
      9.1.5.0-r1

To what you have tested with. Remove any that you have not tested against.

chughts commented 2 years ago

MQTicketService/README.md remove the line

Make sure you have these ```.jar``` files in your class path when compiling and executing code.

Change

Build the .jar file required for by running the following command:

to Build the application by running the following command:

chughts commented 2 years ago

EnvSetter.java Clean up the error catch. Currently the code is

e.printStackTrace();
                     logger.log(Level.SEVERE, "Credentials are incorrect, could not create context", e);

when the error is instanceof JMSSecurityRuntimeException as well as when it is not. Decide which it should be and remove the 2 duplicated lines.

Clean up the indentation in the method setJMSProperties

chughts commented 2 years ago

Manager.java

Add in-code documentation as to what

 final String key = "org.glassfish.jaxb.runtime.v2.bytecode.ClassTailor.noOptimize";
                     System.setProperty(key, "true");

does.

Same applies to Reseller.java

chughts commented 2 years ago

MQTicketService/startApp.sh With a maven build inside the docker image, the run command should get updated to run the uber jar.

chughts commented 2 years ago

TicketRequester.java Remove commented out import.

chughts commented 2 years ago

main readme

mvn clean package removes any previous builds, then recompiles and creates the uber jar.

So the following is not needed, and should be removed.

To compile run
 javac -cp target/ModelAnswer-1.4.jar com/ibm/mq/demo/*.java

Edit the test against list to only those versions that you have tested with.

the ticket service has been tested with the ibmcom/mq images

9.2.4.0-r1 9.2.0.0-r2 9.2.0.0-r1 9.1.5.0-r2