Author |
Message
|
MABeatty1978 |
Posted: Thu Jul 16, 2015 11:44 am Post subject: Accessing Java Libraries with different user |
|
|
Acolyte
Joined: 17 Jul 2014 Posts: 54
|
I've got a java application (using Eclipse) that I wrote that works fine when running on my development box under my user name, but when I run the application using the user that will be in production, I get MQRC 4095 MQRC_MODULE_NOT_FOUND. I assume this to be a permission issue. To confirm, I exported the project and imported it into back into an instand of Eclipse using the production user. In doing so, it becomes pretty clear by all the red squiggly lines with the message "import com.ibm cannot be resolved" that this uesr is unable to access those libraries.
Any advice as to what I'm doing wrong and how to resolve? |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 16, 2015 12:46 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You did not specify the environment (Windows / Linux). I would say make the library path and everything underneath it Read eXecute for everybody  _________________ MQ & Broker admin |
|
Back to top |
|
 |
MABeatty1978 |
Posted: Fri Jul 17, 2015 4:26 am Post subject: |
|
|
Acolyte
Joined: 17 Jul 2014 Posts: 54
|
Env is Linux. I changed the ownership of /opt/mqm/java/lib and the jar's beneath it, but it didn't resolve anything. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jul 17, 2015 5:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
MABeatty1978 wrote: |
Env is Linux. I changed the ownership of /opt/mqm/java/lib and the jar's beneath it, but it didn't resolve anything. |
Sure but did you also set rx for the libraries there (*.so)?
And remember to do it for both /opt/mqm/java/lib and /opt/mqm/java/lib64
Or any corresponding non std directory you might have installed MQ into.
Don't change ownership... just add rx for all. _________________ MQ & Broker admin |
|
Back to top |
|
 |
tczielke |
Posted: Fri Jul 17, 2015 5:07 am Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 Location: Illinois, USA
|
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jul 17, 2015 5:15 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
And by the way, when using eclipse, please create a library for the MQ jars.
You can then just add the library to your project and all the red lines should now go away...
(I don't add the jars to the classpath, I add the jars to the library.) This way if I happen to have the jars in a different path or at a different level, all I have to do is add the corresponding library to the project, an can configure the runtime execution with different versions as well depending on the libraries declared for the runtime execution....
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
MABeatty1978 |
Posted: Fri Jul 17, 2015 11:26 am Post subject: |
|
|
Acolyte
Joined: 17 Jul 2014 Posts: 54
|
I'm getting this from the stack:
com.ibm.mq.jmqi.JmqiException: CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd' was not found. [3=mqjbnd]
but when I run dspmqver -p 4:
Name: IBM WebSphere MQ
Version: 7.0.1.7
CMVC Level: k701-107-111107 mqjbnd=k701-107-111107
Build Type: Production |
|
Back to top |
|
 |
vennela |
Posted: Fri Jul 17, 2015 11:30 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
I think you might have to set LD_LIBRARY_PATH
But not sure how you would do that in Eclipse |
|
Back to top |
|
 |
MABeatty1978 |
Posted: Mon Jul 20, 2015 5:06 am Post subject: |
|
|
Acolyte
Joined: 17 Jul 2014 Posts: 54
|
vennela wrote: |
I think you might have to set LD_LIBRARY_PATH
But not sure how you would do that in Eclipse |
That fixed it, thatnk you! FYI, don't need to do it in eclipse, just set the path in your login profile and Eclipse will source it in when it lauches. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jul 20, 2015 1:53 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You can also set it explicitly by using a launch profile and the JVM option:
Code: |
#linux
-Djava.library.path=///${MQ_JAVA_INSTALL_PATH}/[lib|lib64]
#windows
-Djava.library.path=///%MQ_JAVA_INSTALL_PATH%/[lib|lib64] |
use either lib or lib64 depending on the OS and the support of your JVM.
Or if using multiple installations an absolute path and a launch profile per installation...
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jul 21, 2015 5:48 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
or export/set it in the environment of a command shell, and then run the eclipse process from that shell.
This also allows you to sudo/r u n a s or etc. |
|
Back to top |
|
 |
tczielke |
Posted: Tue Jul 21, 2015 5:59 am Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 Location: Illinois, USA
|
Also, Linux administrators do frown upon the use of LD_LIBRARY_PATH. I believe setting that environment variable does affect any any shared object file that your process would load and would require dynamic linking. _________________ Working with MQ since 2010. |
|
Back to top |
|
 |
vennela |
Posted: Fri Jul 31, 2015 9:21 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
If he is using Eclipse, most likely his workstation is Linux based and not Windows based and I believe that is where he is doing these settings. So, in this case my best guest is he himself is the Linux administrator |
|
Back to top |
|
 |
tczielke |
Posted: Fri Jul 31, 2015 9:35 am Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 Location: Illinois, USA
|
To clarify, the use of the LD_LIBRARY_PATH environment variable is a frowned upon practice in Linux, at least based on what I have read. You at least need to be aware of the dynamic linking risks if you use it, especially in an enterprise environment. _________________ Working with MQ since 2010. |
|
Back to top |
|
 |
|