java


IBM MQ Java Error :: java.lang.ClassNotFoundException: com.ibm.mq.internal.MQCommonServices


I am getting the below error while trying to extract the MQHeaders using MQHeaderIterator from MQMessage object . I am using the below line of code and getting the below Exception. Added below jar in classpath also but still it showing error.
Libraries used:
com.ibm.mq.jar
com.ibm.mq.headers.jar
com.ibm.mq.commonservices.jar
com.ibm.mq.jmqi.jar
com.ibm.mq.pcf.jar
Code:
//Giving error in this line
MQHeaderIterator it = new MQHeaderIterator(theMessage);
Its throwing Exception as below.
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/mq/internal/MQCommonServices
at com.ibm.mq.headers.MQHeaderIterator.<init>(MQHeaderIterator.java:112)
at com.test.mq.util.MQClass.main(MQClass.java:69)
Caused by: java.lang.ClassNotFoundException: com.ibm.mq.internal.MQCommonServices
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
Please suggest the possible reason for this error mostly ClassNot Found error occurs when some jar file is missing. Am i missing something here?
Short answer, point the classpath to the java/lib directory of the original IBM MQ install location which contains ALL required jar files.
More detail:
IBM does not support copying jar files to different locations until v8 in which case they have added support for relocation but have combined everything needed into two jar files com.ibm.mq.allclient.jar and com.ibm.mq.traceControl.jar which can be relocated from a full MQ Server or MQ Client install to another location in your enterprise.
For more details see the section "Starting with MQ 8.0, you can use Relocatable JAR Files" on IBMs Technote "Starting with MQ 8.0, you can use Relocatable JAR Files".
WebSphere MQ 8.0.0 > IBM MQ > Developing applications > Developing
object-oriented applications with IBM MQ > Using IBM MQ classes for
Java > Installation and configuration of IBM MQ classes for Java >
What is installed for IBM MQ classes for Java
Relocatable JAR files
Within an enterprise, the following files can be moved to systems
that need to run IBM MQ classes for Java applications:
com.ibm.mq.allclient.jar
com.ibm.mq.traceControl.jar
The file com.ibm.mq.allclient.jar contains the IBM MQ classes for
JMS, the IBM MQ classes for Java, and the PCF and Headers Classes. If
you move this file to a new location, make sure that you take steps to
keep this new location maintained with new IBM MQ Fix Packs. Also,
make sure that the use of this file is made known to IBM Support if
you are getting an interim fix.
To determine the version of the file com.ibm.mq.allclient.jar, use
the command: java -jar com.ibm.mq.allclient.jar
Note that all MQ versions 7.1 and earlier are end of service from IBM. IBM MQ v7.5 has an end of service date of April 30th 2018.
I would recommend you move to v8.0 or v9.0 which have not had end of service dates announced yet. Newer MQ client versions can connect to older MQ queue managers. You can download a java only install of MQ 8.0 or MQ 9.0 jar files at the links below:
IBM MQ v8.0 Client
IBM MQ v9.0 Client

Related Links

Build one jar per platform for multi-platform SWT application
expected: START_TAG SOAP error
Tomcat v7.0 stopped to run my project at localhost
Java Input/Output
Java chat between mobile and web client
Fire Event every (x) passes in Java?
wso2 entitlements from Java program
Graphics Context misaligned on first paint
Printing content of an Array in Java
Image not being displayed properly
try-with behavior with implicit and explicit closeables
Sockets Java/PHP Transferring data slowly
java RuntimeException in slick2D game project
Java Executing ipconfig , Client-Server
Checking if characters in a string are digits, but with exceptions
jquery/javascript: download a file from any webserver

Categories

HOME
twitter
jdo
gitlab
testng
hook
gremlin
deezer
fluentd
single-sign-on
comparison
razor
win32gui
umd
icloud
angular-ui-bootstrap
ojdbc
pivotal-cloud-foundry
datastax-java-driver
amazon-cloudformation
resize
event-handling
try-catch
worldwind
seaborn
saxon
pc
jqwidget
openedx
arabic
ehcache
dcevm
tapestry
bootstrap-tour
microsoft-r
hammerspoon
blazemeter
numerical-methods
sparse-matrix
bootstrap-duallistbox
kannel
maxmind
neo4j-spatial
large-file-upload
lightswitch-2013
frame
perlin-noise
textmate
openoffice.org
google-api-nodejs-client
mmenu
catalog
fusionpbx
ios5
main
simplexml
web-mining
swift3.0.2
dynamics-crm-2013
vapor
squib
g-code
taffy
osx-mavericks
pubmed
mu
lowpass-filter
directory-structure
pg-dump
boost-preprocessor
windows-mobile-6.5
knpmenubundle
flow-control
android-fonts
file-writing
intrusion-detection
nsfilemanager
hill-climbing
rvest
design-by-contract
goose
jfugue
separator
splash
unity5.2.3
e10s
operator-precedence
ng-animate
gadt
angularjs-ng-click
winddk
java-metro-framework
eol
typeof
rebol3
mysql-error-1062
cdc
dataadapter
jquery-mobile-dialog
html-editor
robotics-studio
specification-pattern
google-email-migration
propertyeditor
datawindow
hgsubversion
cufon
gwt-ext
subgurim-maps
horizontal-accordion
appendto
imac
gamequery
jquery-ui-droppable
backcolor
boost-smart-ptr
procedural-music
3gp

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile