ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » calling java method in shared lib from JCN in application

Post new topic  Reply to topic
 calling java method in shared lib from JCN in application « View previous topic :: View next topic » 
Author Message
IIB_Intel
PostPosted: Tue Mar 07, 2017 1:56 pm    Post subject: calling java method in shared lib from JCN in application Reply with quote

Acolyte

Joined: 07 May 2015
Posts: 64

I have a JCN (App_jcn.java) which is present in the java project of an application, can I call a java method present in a class of a java project in shared library let's say named SH_LIB_A?

I know I can definitely do this if the JCN (App_jcn.java) itself part of the shared library SH_LIB_A or another shared library SH_LIB_B (where SH_LIB_B refers SH_LIB_A).
Back to top
View user's profile Send private message
timber
PostPosted: Tue Mar 07, 2017 2:29 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

https://www.ibm.com/support/knowledgecenter/en/SSMKHH_10.0.0/com.ibm.etools.mft.doc/bc23072_.htm
Back to top
View user's profile Send private message
IIB_Intel
PostPosted: Tue Mar 07, 2017 3:29 pm    Post subject: Reply with quote

Acolyte

Joined: 07 May 2015
Posts: 64

My original question was based on this link itself. When I try to give a shared library classloader on JCN node whose's java class present in the application itself, it doesn't compile.

I want to make sure if that is the expected behavior or am I doing anything wrong?

Following statement from the link is confusing, seems like a typo.

Quote:
A JavaCompute node in a message flow or subflow can access the Java classes in a shared library and any referenced shared libraries. The following diagram shows a JavaCompute node in a message flow in an application, but the JavaCompute node could be in a subflow in a shared library.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Mar 08, 2017 6:50 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

A "shared lbirary" is a deployment object.

Each shared library runs in it's own classloader. That's the picture

Each shared library classloader that references another shared library keeps it's own copy of any jars in that referenced shared library in it's own classloader. .

A JCN can reference a single shared library, by it's prefix isurrounded by {}.

Any number of JCNs can access the same shared library. Any java external procedure in ESQL can reference the same shared library.

You can not use classes outside of the shared library in the shared library, nor vice-versa. So if your shared library references log4j (you're doing it wrong in that case), you have to include the log4j jar file in that shared library.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
IIB_Intel
PostPosted: Wed Mar 08, 2017 7:30 am    Post subject: Reply with quote

Acolyte

Joined: 07 May 2015
Posts: 64

Quote:
A JCN can reference a single shared library, by it's prefix isurrounded by {}.


This also means the JCN java class has to be in the shared library? As if that is in the application's java project then that would use broker wide class loader and a class in classloader A cannot use class in classloaderB.

If my understanding is true then it answers my original question.

Quote:
You can not use classes outside of the shared library in the shared library


Are you sure on this? as I did a quick test where my log4j jar was present in the shared-classes folder and I tried access it in a java class in my shared lib and was able to log. Yes of-course, it bring the class from shared-classes to its shared library loader.
Back to top
View user's profile Send private message
IIB_Intel
PostPosted: Wed Mar 08, 2017 11:23 am    Post subject: Reply with quote

Acolyte

Joined: 07 May 2015
Posts: 64

I got the answer to my question.

From IBM - Java classes in applications, static libraries, or independent projects cannot access Java classes in shared libraries.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » calling java method in shared lib from JCN in application
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.