Showing posts with label Java Compute Node. Show all posts
Showing posts with label Java Compute Node. Show all posts

Tuesday, March 10, 2020

IBM Integration Bus - When you write Java™ code for a JavaCompute node, you can include references to other Java projects and JAR files.

To complete this task, you must have completed the following tasks:
  • Add a JavaCompute node to your message flow.
  • Create Java code for a JavaCompute node.
The Java code in a JavaCompute node might contain references to other Java projects in the Eclipse workspace (internal dependencies), or to external JAR files, for example the JavaMail API (external dependencies), or a set of JAXB Java object classes (internal or external). If other JAR files are referenced, you must add the files to the project class path.
See Using JAXB with a JavaCompute node for an example of a project using Java objects generated by the JAXB binding compiler.
  1. Right-click the project folder for the project on which you are working, and click Properties.
  2. Click Java Build Path in the left pane.
  3. Click the Libraries tab.
  4. Complete one of the following steps:
    • To add an internal dependency, click Add JARs, select the JAR file that you want to add, then click OK.
    • To add an external dependency, click Add External JARs, select the JAR file that you want to add, then click Open. Copy the JAR file to the shared-classes directory required. For more details of the shared-classes directories available and the effects of each, see Java shared classloader. If you do not copy the JAR file to a valid shared-classes directory, ClassNotFoundException exceptions are generated at run time.
You have now added a code dependency.

Reference: https://www.ibm.com/support/knowledgecenter/en/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ac30280_.htm

Loads all the JAR files located within the shared-classes directories.

Loads all the JAR files located within the shared-classes directories. The precedence order of loading is dictated by the directories the JAR files are located in.

Determine the integration node workpath to use by running the mqsireportbroker command as follows:

mqsireportbroker integrationNodeName

JAR files are loaded in the following precedence order:
  • For Windows
    • workpath\config\<my_int_node_name>\<my_int_server_label>\shared-classes
  • For Linux, UNIX, and z/OS
    • workpath/config/<my_int_node_name>/<my_int_server_label>/shared-classes
  • For Windows
    • workpath\config\<my_int_node_name>\shared-classes
  • For Linux, UNIX, and z/OS
    • workpath/config/<my_int_node_name>/shared-classes
  • For Windows
    • workpath\shared-classes
  • For Linux, UNIX and z/OS
    • workpath/shared-classes

Tuesday, February 25, 2020

IBM Integration Bus - An unsupported value type ''NVARCHAR2'' was returned for column ''XXXX''.

If we have the the issue 'An unsupported value type ''NVARCHAR2'' was returned for column ''XXXX''.', we can workaround with "Java Compute" Node.

public class HTTPInputMessageFlow_JavaCompute extends MbJavaComputeNode {

public void evaluate(MbMessageAssembly inAssembly) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");

MbMessage inMessage = inAssembly.getMessage();
MbMessageAssembly outAssembly = null;
try {
// create new message as a copy of the input
MbMessage outMessage = new MbMessage(inMessage);
outAssembly = new MbMessageAssembly(inAssembly, outMessage);
// ----------------------------------------------------------
// Add user code below
                        

// Obtain a java.sql.Connection using a JDBC Type4 datasource - in this example for a 
        // JDBC broker configurable service called "MyDB2"  

        Connection conn = getJDBCType4Connection("MyDB2",
                     JDBC_TransactionType.MB_TRANSACTION_AUTO);

        // Example of using the Connection to create a java.sql.Statement  
        Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                     ResultSet.CONCUR_READ_ONLY);
        ResultSet srs0 = stmt.executeQuery("SELECT NAME, CITY FROM MySchema.MyTable");    

        stmt.executeUpdate("UPDATE MySchema.MyTable SET CITY = \"Springfield\" WHERE Name = \"Bart\"");
       
        ..............
      } catch (SQLException sqx ){
        sqx.printStackTrace();
      }
// End of user code
// ----------------------------------------------------------
} catch (MbException e) {
// Re-throw to allow Broker handling of MbException
throw e;
} catch (RuntimeException e) {
// Re-throw to allow Broker handling of RuntimeException
throw e;
} catch (Exception e) {
// Consider replacing Exception with type(s) thrown by user code
// Example handling ensures all exceptions are re-thrown to be handled in the flow
throw new MbUserException(this, "evaluate()", "", "", e.toString(),
null);
}
// The following should only be changed
// if not propagating message to the 'out' terminal
out.propagate(outAssembly);

}

}

Install and use xorg-server on macOS via Homebrew

  The instructions to install and use xorg-server on macOS via Homebrew: Install Homebrew (if you haven't already): /bin/bash -c ...