Try calling the CORBA service in Java 11+

Previously, in "Call CORBA service from Spring (Java)", how to call CORBA service using Spring function on Java 8 I introduced it, but this time I would like to introduce how to call the CORBA service using an alternative library in Java 11+ (Why CORBA in this era !?) Please don't ask w).

Verification version

JDK

NOTE:

In this entry, the CORBA service is also created in Java ... In order to be able to acquire CORBA objects via the naming service, the function equivalent to orbd included in JDK 8 is also required. (If you want to get a CORBA object using an IOR string without using a naming service, you don't need a function equivalent to orbd). Since JDK 11 and later does not include the orbd command ... This entry uses JDK 8 only to use the orbd command ... (Completely compromised, but this entry focuses on the client side only. Please note that

Spring Boot

Alternate library

What is Eclipse ORB?

Roughly speaking, it seems that the ORB implementation used in GlassFish is being developed as an independent subproject of Eclipse EE 4J. From this library, not only the ORB implementation but also tools such as idlj and rmic are provided. This library is introduced as an alternative library in "JEP 320: Remove the Java EE and CORBA Modules". It has been.

What is JBoss repackaging of the OpenJDK ORB?

It looks like JBoss is redistributing the OpenJDK 8 ORB implementation. Since the 1st release is 2015 ... Deprecated in JDK 9, it's unclear if it's related to the disappearance of modules in JDK 11.

What is JBoss repackaging of the OpenJDK9 ORB additions?

Did JBoss disappear in OpenJDK 9? It seems to be a library that redistributes ORB related classes. Here, "[Call the CORBA service from Spring (Java)](https://qiita.com/kazuki43zoo/items/5eb4d57d785e0b3505fb#spring%E3%81%AE%E6%A9%9F%E8%83" % BD% E3% 82% 92% E4% BD% BF% E3% 81% A3% E3% 81% A6corba% E3% 82% B5% E3% 83% BC% E3% 83% 93% E3% 82% B9 % E3% 82% 92% E5% 91% BC% E3% 81% B3% E5% 87% BA% E3% 81% 97% E3% 81% A6% E3% 81% BF% E3% 82% 8B) " The " com.sun.jndi.cosnaming.CNCtxFactory "used in is included.

Try to create a CORBA service in Java

"[Here](https://qiita.com/kazuki43zoo/items/5eb4d57d785e0b3505fb#java%E3%81%A7corba%E3%82%B5%E3%83%BC%E3%83%93%E3%82%B9" % E3% 82% 92% E4% BD% 9C% E3% 81% A3% E3% 81% A6% E3% 81% BF% E3% 82% 8B) ". Regarding the part that generates Java code from the IDL file, there is no idlj command in JDK 11+, so idlj provided by Eclipse ORB You can generate an equivalent class by using /corba/idlj/4.2.1/idlj-4.2.1.jar) (executable jar).

$ java -jar idlj-4.2.1.jar -fall -td src/main/java src/main/resources/Greeting.idl

Try publishing the CORBA service in Java

Enable Alternate Library

Since there is no ORB implementation in JDK 11+, if you do nothing, you will not be able to find the required class and compile, so first of all ... you need to be able to use an alternative library.

Eclipse ORB

pom.xml


<dependency>
  <groupId>org.glassfish.corba</groupId>
  <artifactId>glassfish-corba-orb</artifactId>
  <version>4.2.1</version>
</dependency>
<dependency> <!--"Com" in Spring Boot.sun.jndi.cosnaming.To use "CNCTxFactory"-->
  <groupId>org.jboss.openjdk-orb</groupId>
  <artifactId>openjdk-orb-jdk9-supplement</artifactId>
  <version>1.0.3.Final</version>
  <exclusions>
  <exclusion> <!--Excluded because the ORB implementation overlaps with the Eclipse ORB-->
    <groupId>org.jboss.openjdk-orb</groupId>
    <artifactId>openjdk-orb</artifactId>
    </exclusion>
  </exclusions>
</dependency>

JBoss repackaging of the OpenJDK ORB

pom.xml


<dependency>
  <groupId>org.jboss.openjdk-orb</groupId>
  <artifactId>openjdk-orb</artifactId>
  <version>8.1.4.Final</version>
</dependency>

Release of CORBA service

Publish the CORBA service when the ORB is available. For more information, see "[here](https://qiita.com/kazuki43zoo/items/5eb4d57d785e0b3505fb#java%E3%81%A7corba%E3%82%B5%E3%83%BC%E3%83%93%E3%82" % B9% E3% 82% 92% E5% 85% AC% E9% 96% 8B% E3% 81% 97% E3% 81% A6% E3% 81% BF% E3% 82% 8B) ". If the environment is such that the orbd command of JDK 8 is in the path, there is no need to modify the source code, but if the path is not in the path ... The following modifications are required.

    List<String> orbdStartupCommands = new ArrayList<>();
//    orbdStartupCommands.add("orbd");
    orbdStartupCommands.add("/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/orbd"); //Specify the command with the full path
    orbdStartupCommands.addAll(Arrays.asList(ORB_OPTIONS));

Try calling the CORBA service from Java

"[Here](https://qiita.com/kazuki43zoo/items/5eb4d57d785e0b3505fb#java%E3%81%8B%E3%82%89corba%E3%82%B5%E3%83%BC%E3%83%93" % E3% 82% B9% E3% 82% 92% E5% 91% BC% E3% 81% B3% E5% 87% BA% E3% 81% 97% E3% 81% A6% E3% 81% BF% E3 % 82% 8B) ”. There is nothing that needs to be fixed.

Try calling the CORBA service using the Spring function

"[Here](https://qiita.com/kazuki43zoo/items/5eb4d57d785e0b3505fb#spring%E3%81%AE%E6%A9%9F%E8%83%BD%E3%82%92%E4%BD%BF % E3% 81% A3% E3% 81% A6corba% E3% 82% B5% E3% 83% BC% E3% 83% 93% E3% 82% B9% E3% 82% 92% E5% 91% BC% E3 % 81% B3% E5% 87% BA% E3% 81% 97% E3% 81% A6% E3% 81% BF% E3% 82% 8B) ". There is nothing that needs to be fixed.

Demo application

Although it is not exactly the same as the content introduced in this entry, a demo application with the same content is published on GitHub.

Summary

CORBA's module disappeared in JDK 11, but I found that it can be used in the environment of JDK 11+ by using an alternative library. But ... can alternative libraries be used in commercial applications? When I checked the license, I was worried about the part

Eclipse ORB is ...

Homepage excerpt


Eclipse Distribution License 1.0 (BSD)
Eclipse Public License 2.0
one(Secondary) GNU General Public License, version 2 with the GNU Classpath Exception

JBoss repackaging of the OpenJDK ORB

From the license file


GNU General Public License, version 2 with the GNU Classpath Exception

So, as long as you add the jar file on the classpath and use it, it seems that you can use it even in non-OSS commercial applications that can not publish the source code.

Recommended Posts

Try calling the CORBA service in Java 11+
Try calling the CORBA service from Spring (Java)
Try calling JavaScript in Java
Try using the COTOHA API parsing in Java
Try calling synchronized methods from multiple threads in Java
Try using RocksDB in Java
Try developing Spresense in Java (1)
Try functional type in Java! ①
Try calling IBM Watson Assistant 2018-07-10 from the Java SDK.
Try global hooking in Java using the JNativeHook library
Guess the character code in Java
Try implementing GraphQL server in Java
Specify the java location in eclipse.ini
Unzip the zip file in Java
Try running Selenuim 3.141.59 in eclipse (java)
Try an If expression in Java
Parsing the COTOHA API in Java
Try running AWS X-Ray in Java
Try to implement Yubaba in Java
Call the super method in Java
Get the result of POST in Java
Try to solve Project Euler in Java
Java reference to understand in the figure
Try using the service on Android Oreo
Try to implement n-ary addition in Java
Call the Windows Notification API in Java
I tried the new era in Java
[Java] Use cryptography in the standard library
Organized memo in the head (Java --Array)
What is the main method in Java?
Try making a calculator app in Java
How to get the date in java
Try calling Nim from Java via JNI
The story of writing Java in Emacs
Console input in Java (understanding the mechanism)
Try using the Wii remote with Java
Regarding the transient modifier and serialization in Java
Try calling Watson NLU that seems to support Japanese from the Java SDK
The story of low-level string comparison in Java
[Java] Handling of JavaBeans in the method chain
About the idea of anonymous classes in Java
ChatWork4j for using the ChatWork API in Java
A story about the JDK in the Java 11 era
Partization in Java
Organized memo in the head (Java --Control syntax)
Try scraping about 30 lines in Java (CSV output)
The intersection type introduced in Java 10 is amazing (?)
CORBA seems to be removed in Java SE 11. .. ..
The story of learning Java in the first programming
Try Java 8 Stream
Measure the size of a folder in Java
Try Azure Service Fabric (Java) on Mac-Local Environment
Try to create a bulletin board in Java
Changes in Java 11
Second decoction: Try an If expression in Java
Feel the passage of time even in Java
Try using Sourcetrail (win version) in Java code
Try using GCP's Cloud Vision API in Java
Organized memo in the head (Java --instance edition)
Try using Sourcetrail (macOS version) in Java code
Try accessing the dataset from Java using JZOS