Iam trying to implement JMS using eclipse.But when I tried to save the code, it showed that javax.jms.* cannot be resolved
and there are no suggestions
I fixed this problem by including the dependency of Activemq.
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.15.0</version>
</dependency>
If you are using/Testing ActiveMQ. Then configure your build path and add external jar activemq-all-.jar. (Path:In ) Clean and Build. This will helped me , will do same to you as well.
Danke,
Rahul.
There are actually many ways to fix this. As already stated in the comment you need the Java Enterprise Edition API. Java EE is an abstract specification so what you need is an implementation of the JMS API. Since JMS is part of the Java EE specification the easiest thing is to download a application server such as GlassFish (which is the reference implementation) or JBoss.
I assume you already got the Java compiler so you only need the SDK, not the JDK.
Java EE 6 SDK Update 4 A free integrated development kit used to build, test, and deploy Java EE 6 applications.
http://www.oracle.com/technetwork/java/javaee/downloads/index.html
Then after you have downloaded GlassFish you will end up with a lot of files that is an implementation of the different Java EE specification API's. You will probably want to download the plugin that I linked to beneath so that you can start, deploy and do many other administration task of your server from Eclipse. I do not use Eclipse so I don't remember if you want this version of Eclipse as well.
http://marketplace.eclipse.org/node/867
At last you want to add GlassFish to your buildpath.
I found this blog post (Scroll to "Create projects in Eclipse") if you are unsure what to add, but there are several blog posts on how to add GlassFish to the build path in Eclipse so I won't list them here.
http://www.webagesolutions.com/knowledgebase/javakb/jkb005/index.html
If you want to resolve this issue using maven, then the correct maven dependency, available in maven repository, is the following:
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms-api</artifactId>
<version>1.1-rev-1</version>
</dependency>
See post: The following artifacts could not be resolved: javax.jms:jms:jar:1.1
In addition to the answers already provided, if you are using Maven you can add the following dependency (available from Maven2 Central repo):
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</dependency>
It can be found in jboss-jms-api.jar