I have a spring web application which I am trying to deploy on tomcat 7. I got following error on tomcat 7 start-up:
Caused by:
java.lang.ClassNotFoundException: javax.jms.JMSContext
This is because tomcat could not find javaee-api-7.0.jar
which is present in my application's WEB-INF/lib
folder. However, if I copy this to tomcat/lib
, error is fixed and tomcat can load the class.
But I don't want to copy any additional jars to tomcat/lib. Can someone help here so that tomcat can find above jar in application's lib. Am I missing any classpath handler entries? I have not added any explicitly.
I was also facing the same issue when I moved from spring-3.0 to spring-5.0 while using Tomcat-7 to deploy my application. I added below maven dependency in pom.xml file and it got resolved.
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
<version>2.0.1</version>
</dependency>
The root cause I found is, UserCredentialsConnectionFactoryAdapter class provided by spring-jms-5.0.2.RELEASE.jar was using JMSContext class internally. This class was not available in jms-1.1.jar which I was using with spring-jms-3.2.4.jar.
So I replaced jms-1.1.jar with javax.jms-api-2.0.1.jar
I would suggest you to add/upgrade your jms jar as mentioned above according to you spring version. Hope this works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With