我正在尝试Spring + IBM MQ服务的原型。我能够成功运行并击中消息队列,并通过maven创建的jar文件在Windows中获得响应。
但是一旦我将此jar文件移到Linux框中并尝试命中以下命令,它就会引发异常。并附上所有必要的信息。任何帮助都非常感谢你们。
我坚持了很长时间。 :-(
Java jdk 1.7
Eclipse氧气IBM MQ 8.0.0.4(试用版)
pom.xml:
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>com.ibm.mqjms</artifactId>
<version>${webSphereMQVersion}</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>com.ibm.mq.jmqi</artifactId>
<version>${webSphereMQVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springJMSVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${springJMSVersion}</version>
</dependency>
Linux例外:
[pts/0][17:32:53:oracle@abcdefgh ] ~/ABC/MQQueue>java -jar springjms-0.0.1.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javax/jms/JMSException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
at java.lang.Class.getMethod0(Class.java:2866)
at java.lang.Class.getMethod(Class.java:1676)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: javax.jms.JMSException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more