With which maven dependencies can i create a standalone JMS client for Glassfish?

后端 未结 4 863
我在风中等你
我在风中等你 2020-12-06 19:05

i want to create a very simple JMS standalone client to a JMS Topic hosted on my Glassfish server.

My project is built using maven.

I know there seems to be

4条回答
  •  我在风中等你
    2020-12-06 19:23

    OK, this one was rather tricky.

    After some searches and tries, I removed weld dependencies (in order to go back to a more classical main).

    Then, I replaced my (old-style) appserv-rt.jar dependency with

        
            org.glassfish.appclient
            gf-client
            3.1
            pom
            compile
        
    

    This is not a little change, as gf-client pulls all jars for Glassfish, which obviously makes a lot of jars (hopefully there is a method to optimize jar number, although we all know about premature optimization).

    So, once it's done, it's perfectly possible to use EJB remote interface, but not JMS (due to incomprehensible reasons). In order to make JMS work with gf-client, one then have to go create maven dependencies for imqjmsra.jar and imqbroker.jar, both located in %GLASSFISH3_INSTALL_DIR%/glassfish/lib/install/applications/jmsra. Furthermore, as imqjmsra.jar internally uses imqbroker.jar, I recommend you to create the following poms :

    
      4.0.0
      org.glassfish.external.jms
      imqjmsra
      3.1.0
      POM was created by Sonatype Nexus
      
        
              org.glassfish.external.jms
              imqbroker
              3.1.0
        
      
    
    

    associated to imqjmsra.jar and

    
    
      4.0.0
      org.glassfish.external.jms
      imqbroker
      3.1.0
      POM was created by Sonatype Nexus
    
    

    associated to imqbroker.jar.

    Obviously, as I use Nexus repository management, it was easier for me to create these dependencies in our company 3rd parties local repository using Nexus "upload artifact page".

    Once it's done, My POM dependencies now are

        
            org.glassfish.appclient
            gf-client
            3.1
            pom
            compile
        
        
            org.glassfish.external.jms
            imqjmsra
            3.1.0
        
    

    And I can totally poll my JMS queue.

提交回复
热议问题