how to include javax.jms.* in eclipse?

前端 未结 9 1304
太阳男子
太阳男子 2021-02-05 17:10

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

相关标签:
9条回答
  • 2021-02-05 17:12

    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>
    
    0 讨论(0)
  • 2021-02-05 17:16

    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.
    
    0 讨论(0)
  • 2021-02-05 17:19

    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

    0 讨论(0)
  • 2021-02-05 17:21

    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

    0 讨论(0)
  • 2021-02-05 17:22

    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>
    
    0 讨论(0)
  • 2021-02-05 17:24

    It can be found in jboss-jms-api.jar

    0 讨论(0)
提交回复
热议问题