| Author | Message | 
		
		  | mgzoz | 
			  
				|  Posted: Sun Sep 20, 2020 2:35 am    Post subject: Message broker shared classes - unable to find jar / class |   |  | 
		
		  | Newbie
 
 
 Joined: 19 Sep 2020Posts: 3
 
 
 | 
			  
				| Hello everyone, 
 this is my first post in here, I'm new in message broker development.
 
 i need to generate random alpha numeric in java.
 
 i created a simple flow to simulate generating the alpha numeric:
 
 HTTP input -> compute node -> trace node -> HTTP reply
 
 I've created below java class
 
 
 
   
	| Code: |  
	| package baj.sadad.helper;
 
 public class SADADHelper
 {
 private static final String ALPHA_NUMERIC_STRING = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
 
 public static void main(String[] args)
 {
 System.out.println("random Alpha Numeric = " + randomAlphaNumeric());
 }
 
 public static String randomAlphaNumeric()
 {
 StringBuilder builder = new StringBuilder();
 
 int stringLength = 6;
 
 while(stringLength-- != 0)
 {
 int character = (int)(Math.random() * ALPHA_NUMERIC_STRING.length());
 
 builder.append(ALPHA_NUMERIC_STRING.charAt(character));
 }
 
 return builder.toString();
 }
 }
 
 |  
 and create the jar as below
 
 
 
   
	| Code: |  
	| D:\Java\ibm_sdk80\bin>jar cvf  bajsadadhelper.jar  baj
 added manifest
 adding: baj/(in = 0) (out= 0)(stored 0%)
 adding: baj/sadad/(in = 0) (out= 0)(stored 0%)
 adding: baj/sadad/helper/(in = 0) (out= 0)(stored 0%)
 adding: baj/sadad/helper/SADADHelper.class(in = 1100) (out= 702)(deflated 36%)
 
 |  
 added the created jar in /var/mqsi/shared-classes/ (work path)
 
 when trying to call the java function from below ESQL snippet it returns below error actually when accessing compute node.
 
 ESQL snippet:
 
 
 
   
	| Code: |  
	| 
 
 CREATE COMPUTE MODULE LocalApplication_MSGFlow_Compute
 CREATE FUNCTION Main() RETURNS BOOLEAN
 BEGIN
 CALL CopyEntireMessage();
 
 DECLARE randomAlphaNumeric1 CHARACTER;
 DECLARE randomAlphaNumeric2 CHARACTER;
 
 CALL randomAlphaNumerics() INTO randomAlphaNumeric1;
 
 IF randomAlphaNumeric1 IS NOT NULL OR randomAlphaNumeric1 <> '' THEN
 SET randomAlphaNumeric2 = randomAlphaNumeric1 || ' Generated randomAlphaNumeric';
 ELSE
 SET randomAlphaNumeric2 = 'randomAlphaNumeric IS NULL';
 END IF;
 
 RETURN TRUE;
 END;
 
 CREATE PROCEDURE CopyEntireMessage() BEGIN
 SET OutputRoot = InputRoot;
 END;
 
 CREATE FUNCTION randomAlphaNumerics()
 RETURNS CHARACTER
 LANGUAGE JAVA
 EXTERNAL NAME "baj.sadad.helper.SADADHelper.randomAlphaNumeric";
 
 END MODULE;
 
 |  
 Exception list:
 
 
 
   
	| Code: |  
	| ExceptionList RecoverableException
 File:CHARACTER:/build/slot1/S800_P/src/DataFlowEngine/ImbDataFlowNode.cpp
 Line:INTEGER:1138
 Function:CHARACTER:ImbDataFlowNode::createExceptionList
 Type:CHARACTER:ComIbmComputeNode
 Name:CHARACTER:LocalApplication_MSGFlow#FCMComposite_1_1
 Label:CHARACTER:LocalApplication_MSGFlow.Compute
 Catalog:CHARACTER:BIPmsgs
 Severity:INTEGER:3
 Number:INTEGER:2230
 Text:CHARACTER:Node throwing exception
 Insert
 Type:INTEGER:14
 Text:CHARACTER:LocalApplication_MSGFlow.Compute
 RecoverableException
 File:CHARACTER:/build/slot1/S800_P/src/DataFlowEngine/ImbRdl/ImbRdlRoutine.cpp
 Line:INTEGER:2112
 Function:CHARACTER:SqlRoutine::resolveExternalJavaParameters
 Type:CHARACTER:ImbESQLManager
 Name:CHARACTER:ImbESQLManager
 Label:CHARACTER:ImbESQLManager
 Catalog:CHARACTER:BIPmsgs
 Severity:INTEGER:3
 Number:INTEGER:3202
 Text:CHARACTER:An error occured whilst trying to locate a Java Class / method
 Insert
 Type:INTEGER:5
 Text:CHARACTER:.LocalApplication_MSGFlow_Compute.randomAlphaNumerics1
 Insert
 Type:INTEGER:5
 Text:CHARACTER:1.2
 Insert
 Type:INTEGER:5
 Text:CHARACTER:baj.sadad.helper.SADADHelper.randomAlphaNumeric
 Insert
 Type:INTEGER:5
 Text:CHARACTER:randomAlphaNumerics1
 RecoverableException
 File:CHARACTER:/build/slot1/S800_P/src/DataFlowEngine/ImbRdl/ImbRdlExternalJava.cpp
 Line:INTEGER:1122
 Function:CHARACTER:ESQL2JavaMethodResolver::decodeReturnStatus
 Type:CHARACTER:
 Name:CHARACTER:
 Label:CHARACTER:
 Catalog:CHARACTER:BIPmsgs
 Severity:INTEGER:3
 Number:INTEGER:2943
 Text:CHARACTER:Java class not found
 Insert
 Type:INTEGER:5
 Text:CHARACTER:baj.sadad.helper.SADADHelper.randomAlphaNumeric
 |  
 i need support there how to make the broker see the JAR file from shared classes path
  . |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | abhi_thri | 
			  
				|  Posted: Sun Sep 20, 2020 3:21 am    Post subject: Re: Message broker shared classes - unable to find jar / cla |   |  | 
		
		  |  Knight
 
 
 Joined: 17 Jul 2017Posts: 516
 Location: UK
 
 | 
			  
				| 
   
	| mgzoz wrote: |  
	| i need to generate random alpha numeric in java.
 
 |  
 hi...what is this random number used for? see whether UUIDASCHAR fits the bill, if so you can do this in ESQL itself.
 
 https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ak05910_.html
 
 Coming back to class not found error, check the below,
 - Just to be sure do verify that the node is indeed using '/var/mqsi' as Workpath...use mqsireportbroker to verify that.
 - check the file permissions to ensure that broker user id to have the sufficient permissions
 - After loading the jars to the shared-classes did you restart the integration node?
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mgzoz | 
			  
				|  Posted: Sun Sep 20, 2020 4:55 am    Post subject: Re: Message broker shared classes - unable to find jar / cla |   |  | 
		
		  | Newbie
 
 
 Joined: 19 Sep 2020Posts: 3
 
 
 | 
			  
				| 
   
	| abhi_thri wrote: |  
	| 
 hi...what is this random number used for? see whether UUIDASCHAR fits the bill, if so you can do this in ESQL itself.
 |  
 hi, this random number will be used internally when calling other systems through SOAP request (part of the message body) or MQ input (part of the message which we put)  which should have dynamic length and could be longer than what UUIDASCHAR generates.
 
 
 
   
	| abhi_thri wrote: |  
	| Coming back to class not found error, check the below,
 - Just to be sure do verify that the node is indeed using '/var/mqsi' as Workpath...use mqsireportbroker to verify that.
 - check the file permissions to ensure that broker user id to have the sufficient permissions
 - After loading the jars to the shared-classes did you restart the integration node?
 |  
 1- I ran the command and it returned to me  "Work path = '/var/mqsi'"
 2- the file permission is the same as other files "-rw-r--r--"
 3- I tried first without restart then restart the broker and the same error received
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | abhi_thri | 
			  
				|  Posted: Sun Sep 20, 2020 7:40 am    Post subject: Re: Message broker shared classes - unable to find jar / cla |   |  | 
		
		  |  Knight
 
 
 Joined: 17 Jul 2017Posts: 516
 Location: UK
 
 | 
			  
				| 
   
	| mgzoz wrote: |  
	| 2- the file permission is the same as other files "-rw-r--r--"
 
 |  
 - is the file owner the same as the broker user id or just try changing the permissions to 755 and see?
 - is /tmp full at all and does broker user id have sufficient permissions to read/write to it.
 - enable user trace for the flow and post the full error details here
 - what happens if you deploy the jar file directly via the same message flow bar file
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mgzoz | 
			  
				|  Posted: Sun Sep 20, 2020 9:46 am    Post subject: Re: Message broker shared classes - unable to find jar / cla |   |  | 
		
		  | Newbie
 
 
 Joined: 19 Sep 2020Posts: 3
 
 
 | 
			  
				| 
   
	| abhi_thri wrote: |  
	| 
 - is the file owner the same as the broker user id or just try changing the permissions to 755 and see?
 |  
 tried it and same error returned even i tried 777, same result.
 
 
 
   
	| abhi_thri wrote: |  
	| - is /tmp full at all and does broker user id have sufficient permissions to read/write to it.
 - enable user trace for the flow and post the full error details here
 - what happens if you deploy the jar file directly via the same message flow bar file
 |  
 before the trace details, i wanna highlight something:
 
 before the MB was using root user with full privileges
 and due restriction from application security team they force us to create new user ano not to use the root user.
 
 we created different user and put user id in mqbrkrs and mqm groups
 now the broker and running with the new user.
 
 
 trace log contain $root and $exception list
 
 
   
	| Code: |  
	| Timestamps are formatted in local time, 180 minutes past GMT.
 Trace written by version ; formatter version 8005 (build S800-FP05 on rios_aix_4)
 
 2020-09-20 20:17:56.225136    13116   UserTrace   BIP4060I: Data ''( ['WSRoot' : 0x11473e7b0]
 (0x01000000:Name):Properties      = ( ['WSPROPERTYPARSER' : 0x114734b30]
 (0x03000000:NameValue):MessageSet             = '' (CHARACTER)
 (0x03000000:NameValue):MessageType            = '' (CHARACTER)
 (0x03000000:NameValue):MessageFormat          = '' (CHARACTER)
 (0x03000000:NameValue):Encoding               = 273 (INTEGER)
 (0x03000000:NameValue):CodedCharSetId         = 1208 (INTEGER)
 (0x03000000:NameValue):Transactional          = FALSE (BOOLEAN)
 (0x03000000:NameValue):Persistence            = FALSE (BOOLEAN)
 (0x03000000:NameValue):CreationTime           = GMTTIMESTAMP '2020-09-20 17:17:55.795275' (GMTTIMESTAMP)
 (0x03000000:NameValue):ExpirationTime         = -1 (INTEGER)
 (0x03000000:NameValue):Priority               = 0 (INTEGER)
 (0x03000000:NameValue):ReplyIdentifier        = X'000000000000000000000000000000000000000000000000' (BLOB)
 (0x03000000:NameValue):ReplyProtocol          = 'SOAP-HTTP' (CHARACTER)
 (0x03000000:NameValue):Topic                  = NULL
 (0x03000000:NameValue):ContentType            = '' (CHARACTER)
 (0x03000000:NameValue):IdentitySourceType     = '' (CHARACTER)
 (0x03000000:NameValue):IdentitySourceToken    = '' (CHARACTER)
 (0x03000000:NameValue):IdentitySourcePassword = '' (CHARACTER)
 (0x03000000:NameValue):IdentitySourceIssuedBy = '' (CHARACTER)
 (0x03000000:NameValue):IdentityMappedType     = '' (CHARACTER)
 (0x03000000:NameValue):IdentityMappedToken    = '' (CHARACTER)
 (0x03000000:NameValue):IdentityMappedPassword = '' (CHARACTER)
 (0x03000000:NameValue):IdentityMappedIssuedBy = '' (CHARACTER)
 )
 (0x01000000:Name):HTTPInputHeader = ( ['WSINPHDR' : 0x11472a610]
 (0x03000000:NameValue):X-Original-HTTP-Command = 'POST https://192.136.21.46:5331/TestApplication HTTP/1.1' (CHARACTER)
 (0x03000000:NameValue):User-Agent              = 'Fiddler' (CHARACTER)
 (0x03000000:NameValue):Host                    = '10.250.25.46:5331' (CHARACTER)
 (0x03000000:NameValue):Content-Length          = '0' (CHARACTER)
 (0x03000000:NameValue):X-Remote-Addr           = '192.136.21.21' (CHARACTER)
 (0x03000000:NameValue):X-Remote-Host           = '192.136.21.21' (CHARACTER)
 (0x03000000:NameValue):X-Server-Name           = '192.136.21.46' (CHARACTER)
 (0x03000000:NameValue):X-Server-Port           = '5331' (CHARACTER)
 (0x03000000:NameValue):X-Scheme                = 'https' (CHARACTER)
 )
 )
 ----------------------------
 ( ['MQROOT' : 0x114726250]
 (0x01000000:Name):RecoverableException = (
 (0x03000000:NameValue):File                 = '/build/slot1/S800_P/src/DataFlowEngine/ImbDataFlowNode.cpp' (CHARACTER)
 (0x03000000:NameValue):Line                 = 1138 (INTEGER)
 (0x03000000:NameValue):Function             = 'ImbDataFlowNode::createExceptionList' (CHARACTER)
 (0x03000000:NameValue):Type                 = 'ComIbmComputeNode' (CHARACTER)
 (0x03000000:NameValue):Name                 = 'LocalApplication_MSGFlow#FCMComposite_1_1' (CHARACTER)
 (0x03000000:NameValue):Label                = 'LocalApplication_MSGFlow.Compute' (CHARACTER)
 (0x03000000:NameValue):Catalog              = 'BIPmsgs' (CHARACTER)
 (0x03000000:NameValue):Severity             = 3 (INTEGER)
 (0x03000000:NameValue):Number               = 2230 (INTEGER)
 (0x03000000:NameValue):Text                 = 'Node throwing exception' (CHARACTER)
 (0x01000000:Name     ):Insert               = (
 (0x03000000:NameValue):Type = 14 (INTEGER)
 (0x03000000:NameValue):Text = 'LocalApplication_MSGFlow.Compute' (CHARACTER)
 )
 (0x01000000:Name     ):RecoverableException = (
 (0x03000000:NameValue):File                 = '/build/slot1/S800_P/src/DataFlowEngine/ImbRdl/ImbRdlRoutine.cpp' (CHARACTER)
 (0x03000000:NameValue):Line                 = 2112 (INTEGER)
 (0x03000000:NameValue):Function             = 'SqlRoutine::resolveExternalJavaParameters' (CHARACTER)
 (0x03000000:NameValue):Type                 = 'ImbESQLManager' (CHARACTER)
 (0x03000000:NameValue):Name                 = 'ImbESQLManager' (CHARACTER)
 (0x03000000:NameValue):Label                = 'ImbESQLManager' (CHARACTER)
 (0x03000000:NameValue):Catalog              = 'BIPmsgs' (CHARACTER)
 (0x03000000:NameValue):Severity             = 3 (INTEGER)
 (0x03000000:NameValue):Number               = 3202 (INTEGER)
 (0x03000000:NameValue):Text                 = 'An error occured whilst trying to locate a Java Class / method' (CHARACTER)
 (0x01000000:Name     ):Insert               = (
 (0x03000000:NameValue):Type = 5 (INTEGER)
 (0x03000000:NameValue):Text = '.LocalApplication_MSGFlow_Compute.randomAlphaNumerics' (CHARACTER)
 )
 (0x01000000:Name     ):Insert               = (
 (0x03000000:NameValue):Type = 5 (INTEGER)
 (0x03000000:NameValue):Text = '1.2' (CHARACTER)
 )
 (0x01000000:Name     ):Insert               = (
 (0x03000000:NameValue):Type = 5 (INTEGER)
 (0x03000000:NameValue):Text = 'baj.sadad.helper.SADADHelper.randomAlphaNumeric' (CHARACTER)
 )
 (0x01000000:Name     ):Insert               = (
 (0x03000000:NameValue):Type = 5 (INTEGER)
 (0x03000000:NameValue):Text = 'randomAlphaNumerics' (CHARACTER)
 )
 (0x01000000:Name     ):RecoverableException = (
 (0x03000000:NameValue):File     = '/build/slot1/S800_P/src/DataFlowEngine/ImbRdl/ImbRdlExternalJava.cpp' (CHARACTER)
 (0x03000000:NameValue):Line     = 1122 (INTEGER)
 (0x03000000:NameValue):Function = 'ESQL2JavaMethodResolver::decodeReturnStatus' (CHARACTER)
 (0x03000000:NameValue):Type     = '' (CHARACTER)
 (0x03000000:NameValue):Name     = '' (CHARACTER)
 (0x03000000:NameValue):Label    = '' (CHARACTER)
 (0x03000000:NameValue):Catalog  = 'BIPmsgs' (CHARACTER)
 (0x03000000:NameValue):Severity = 3 (INTEGER)
 (0x03000000:NameValue):Number   = 2943 (INTEGER)
 (0x03000000:NameValue):Text     = 'Java class not found' (CHARACTER)
 (0x01000000:Name     ):Insert   = (
 (0x03000000:NameValue):Type = 5 (INTEGER)
 (0x03000000:NameValue):Text = 'baj.sadad.helper.SADADHelper.randomAlphaNumeric' (CHARACTER)
 )
 )
 )
 )
 )
 ----------------------------
 
 '' from trace node 'LocalApplication_MSGFlow.Trace'.
 The trace node 'LocalApplication_MSGFlow.Trace' has output the specified trace data.
 This is an information message provided by the message flow designer.  The user response will be determined by the local environment.
 Threads encountered in this trace:
 13116
 
 |  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | abhi_thri | 
			  
				|  Posted: Wed Sep 23, 2020 10:34 pm    Post subject: |   |  | 
		
		  |  Knight
 
 
 Joined: 17 Jul 2017Posts: 516
 Location: UK
 
 | 
			  
				| hi...so the integration node was created using root and later switched to be started/running as a different user? I wonder whether that might be contributing to the issue, usually IIB installation as such is done by a superuser but nodes are created using specific users. 
 Did you ran the 'iib verify all' or 'ace verify all' after switching to the new user, not sure whether it will verify classpath access though.
 
 You could try creating another temporary integration node using the new user and see whether the java call works there. Alternatively you could collect service trace of integration server and trace the error there, just to see whether the broker is looking at the right folders for the classes.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |