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 » IBM MQ Java / JMS » java - no main manifest attribute

Post new topic  Reply to topic Goto page 1, 2  Next
 java - no main manifest attribute « View previous topic :: View next topic » 
Author Message
smdavies99
PostPosted: Thu Aug 21, 2014 2:13 am    Post subject: java - no main manifest attribute Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

I have a simple bit of java code that works fine on windows but when I move it to Linux (RHEL 6.5) I get a problem.
On windows I do the following

Code:

"C:\Program Files (x86)\IBM\WMBT700\jdk\bin\javac"  -Xlint:deprecation MQSend.java

set MQSERVER=MQTEST.SVRCONN/TCP/192.168.27.22(7000)
java -classpath C:\temp;"C:\Program Files (x86)\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar";"C:\Program Files (x86)\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jmqi.jar" MQSend A.OUT MQTEST


This as I said works fine.
So I copy the .class file to the Linux Server and create a script that looks like this.
Code:

export MQSERVER=MQTEST.SVRCONN/TCP/'192.168.27.22(7000)'
java  -classpath $HOME/Downloads/mqsend;/opt/mqm/java/lib/com.ibm.mq.jar;/opt/mqm/java/lib/com.ibm.mq.jmqi.jar  MQSend A.OUT MQTEST

Sadly it fails when run

Code:

no main manifest attribute, in /opt/mqm/java/lib/com.ibm.mq.jar
no main manifest attribute, in /opt/mqm/java/lib/com.ibm.mq.jmqi.jar


The user is in the mqm group as shown below
Code:

[mquser@localhost tmp]$ id -a
uid=501(mquser) gid=501(mqm) groups=501(mqm) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[mquser@localhost tmp]$

and the instance is setup as shown by the output from a dspmqinst.
Code:

[mquser@localhost tmp]$ dspmqinst
InstName:      Installation1
InstDesc:                                                                     
Identifier:    1
InstPath:      /opt/mqm
Version:       7.5.0.3
Primary:       Yes
State:         Available
[mquser@localhost tmp]$

There is a manifest in the .jar files so what really gives here?
What simple thing am I doing wrong?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 21, 2014 4:26 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Your classpath is wrong. You forgot that in Unix/Linux you have to replace the windows separator ";" (semi-colon) with a ":" (full colon).
Try it again that way and let us know...
Code:
export MQSERVER=MQTEST.SVRCONN/TCP/'192.168.27.22(7000)'
java  -classpath $HOME/Downloads/mqsend:/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mq.jmqi.jar  MQSend A.OUT MQTEST


(That'll teach you about pasting a command line from windows to Unix/Linux, and just doing replace on path elements)

Your command was interpreted as trying to run the jar files and not your program... hence the error output.

Have fun.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Thu Aug 21, 2014 5:17 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Doh! I should have realized that. (my eyes need testing obviously)

however that does not solve the problem of getting it to work although it gets a bit further as now I get the following

Code:

java -classpath /var/tmp:/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mq.jmqi.jar   MQSend A.OUT MQTEST
MQSend started...
MQJE001: Completion Code '2', Reason '2495'.
WMQ exception occurred : Completion code 2 Reason code 2495
[sdavi@localhost tmp]$

[sdavi@localhost tmp]$ /opt/mqm/samp/bin/amqsgetc A.OUT MQTEST
Sample AMQSGET0 start
MQGET ended with reason code 2110
message <gello>
MQGET ended with reason code 2110
message <dfglgkg Hello World>
no more messages
Sample AMQSGET0 end
[sdavi@localhost tmp]$

The 2110 errors with 'amqsgetc' is MQRC_FORMAT_ERROR. this means that the putting application has not set the MQMD.Format property. This is ok for the moment

so a 'C' application works but a Java one fails with an error I've never seen before. Oh the wonders of Java.
There a good few posts on the internet (and here) about this error. Many were unresolved and others point to differences between 32bit and 64 bit libraries. The Linux server has the 7.5.0.3 64bit client installed. no 32bit in sight.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 21, 2014 5:21 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

MQRC_MODULE_NOT_FOUND suggests that you are missing a jar file on the classpath, or that you're under the covers trying to use a bindings connection on a client machine.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 21, 2014 5:23 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Don't discount the 2495 Module not found error.
I like to add all jar files from /<mqinstall>/java/lib to the classpath. This way I do know I have no classpath problem. Specially when the jar files change from one version to the other...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Thu Aug 21, 2014 5:27 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

smdavies99 wrote:
Many were unresolved and others point to differences between 32bit and 64 bit libraries. The Linux server has the 7.5.0.3 64bit client installed. no 32bit in sight.


Just for fun what is the response to:
Code:
which java
java -version

You could be surprised with your comment no 32 bit in sight...

Also if using java and bindings connection, did you also set the java.library.path to the right libraries + corresponding mq library?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Thu Aug 21, 2014 5:45 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Also I've got 2495 module not found out of 7.5.0.3 (in my case from the IIB Toolkit) and ended up doing a setmqinst again to reset the primary installation.

No idea why I had to but theorised some weirdness with paths; the probem manifested after a mandatory corporate wide Java update to 1.7.something.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Aug 21, 2014 5:48 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

fjb_saper wrote:

You could be surprised with your comment no 32 bit in sight...

Also if using java and bindings connection, did you also set the java.library.path to the right libraries + corresponding mq library?


I thought that so...

Code:

[sdavi@localhost tmp]$ /opt/mqm/java/jre64/jre/bin/java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build pxa6460sr15-20131017_01(SR15))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux amd64-64 jvmxa6460sr15-20131016_170922 (JIT enabled, AOT enabled)
J9VM - 20131016_170922
JIT  - r9_20130920_46510ifx2
GC   - GA24_Java6_SR15_20131016_1337_B170922)
JCL  - 20131015_01
[sdavi@localhost tmp]$


still gives the error
plus
Code:

[sdavi@localhost tmp]$ java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-x86_64 u65-b17)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
[sdavi@localhost tmp]$

as used before.

If there are .jar files missing from the classpath why don't I get a java Classnotfound error?
also, why does windows only need the two .jar files to be in the classpath? Are they so different?

I will add the other com.ibm.mq.* jars to the classpath and try again.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 21, 2014 5:58 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

classpath should be classpath should be classpath regardless of platform.

MQRC_MODULE_NOT_FOUND is *suggestive* of a missing jar file, but it's also suggestive of a missing file on the library path.

Did you source setmqenv in the shell running the Java program?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Aug 21, 2014 6:12 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

mqjeff wrote:
classpath should be classpath should be classpath regardless of platform.

MQRC_MODULE_NOT_FOUND is *suggestive* of a missing jar file, but it's also suggestive of a missing file on the library path.

Did you source setmqenv in the shell running the Java program?


Yes.
Here is the output from a newly created command window.
Code:

[sdavi@localhost ~]$ set | grep MQ
MQ_DATA_PATH=/var/mqm
MQ_ENV_MODE=64
MQ_INSTALLATION_NAME=Installation1
MQ_INSTALLATION_PATH=/opt/mqm
MQ_JAVA_DATA_PATH=/var/mqm
MQ_JAVA_INSTALL_PATH=/opt/mqm/java
MQ_JAVA_LIB_PATH=/opt/mqm/java/lib64
MQ_JRE_PATH=/opt/mqm/java/jre64/jre
[sdavi@localhost ~]$
[sdavi@localhost tmp]$ ./a5
/opt/mqm/java/lib/com.ibm.mq.jar:
/opt/mqm/java/lib/com.ibm.mq.jmqi.jar:
/opt/mqm/java/lib/com.ibm.mq.axis2.jar:
/opt/mqm/java/lib/com.ibm.mq.jar:
/opt/mqm/java/lib/com.ibm.mq.jms.Nojndi.jar:
/opt/mqm/java/lib/com.ibm.mq.tools.ras.jar:
/opt/mqm/java/lib/com.ibm.mq.commonservices.jar:
/opt/mqm/java/lib/com.ibm.mq.jmqi.jar:
/opt/mqm/java/lib/com.ibm.mq.headers.jar:
/opt/mqm/java/lib/com.ibm.mqjms.jar:
/opt/mqm/java/lib/com.ibm.mq.jar
MQSend started...
MQJE001: Completion Code '2', Reason '2495'.
WMQ exception occurred : Completion code 2 Reason code 2495
[sdavi@localhost tmp]$


The 'set | grep MQ' shows the things set by the setmqenv (contained in the .bashrc). The 'a5' script echoes the $CLASSPATH before trying to run java.

[classpath redacted for readability]
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 21, 2014 6:23 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

... the arguments you're sending to look like you're asking it to make a bindings connection.

If you've only got a client installed, that would explain the MQRC_MODULE_NOT_FOUND, because it's trying to use the classes that link to native libraries for doing bindings connections, rather than trying to make a channel connection.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Aug 21, 2014 6:36 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

mqjeff wrote:
... the arguments you're sending to look like you're asking it to make a bindings connection.

If you've only got a client installed, that would explain the MQRC_MODULE_NOT_FOUND, because it's trying to use the classes that link to native libraries for doing bindings connections, rather than trying to make a channel connection.


in the shell script there is
Code:

export MQSERVER=MQTEST.SVRCONN/TCP/'192.168.27.22(7000)'


But naturally the java code won't use that now will it!

Is there any wonder why I really [redacted] java.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 21, 2014 6:39 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Java *might* use that, if you don't give it a queue manager name.

So
Quote:
MQSend A.OUT MQTEST


is MQTEST the qm name? Or *used* as the qm name?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Aug 21, 2014 6:49 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

The Queue Manager name is MQTEST
The SVRCONN Channel is MQTEST.SVRCONN


It looks like I'll have to edit the code to force it to use a client connection. sigh
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 21, 2014 6:51 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

well, again, the behavior here should be the same on windows.

Unless MQTEST is on the windows box?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » java - no main manifest attribute
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.