java.lang.ClassNotFoundException: javax.jms.JMSContext on tomcat 7
Asked Answered
B

2

17

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.

Bolide answered 29/5, 2017 at 7:32 Comment(0)
E
47

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!

Endothermic answered 6/3, 2018 at 7:11 Comment(2)
In spring-jms the javax-jms dependency is marked provided and hence needs to be added by the container.Judaic
yes, please approve this answer if this solves the issue.Endothermic
Q
0

I had the same problem in an Apache karaf 4.2.7 environment over JDK 11.0.2, in my case the exception prints

Caused by: java.lang.ClassNotFoundException: javax.jms.JMSContext not found by org.apache.geronimo.specs.geronimo-jms_1.1_spec

It works by installing: bundle:install mvn:javax.jms/javax.jms-api/2.0.1

Quinquepartite answered 24/1, 2020 at 18:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.