Built-in ActiveMQ in built-in Glassfish (using maven-embedded-glassfish-plugin)

I am trying to run an old ActiveMQ chip built in with the maven-embedded-glassfish plugin.

I prepared the tutorials below separately, so I know the basics. The goal is to have an installation that is built with one click and avoids 3pp libraries in svn.

1 http://www.hascode.com/2011/09/java-ee-6-development-using-the-maven-embedded-glassfish-plugin/

2 http://javadude.wordpress.com/2011/07/21/glassfish-v3-1-running-embedded-activemq-for-jms-part-1/

The project setup for # 2 is used as a starting point, and I will try to combine the steps from # 1

I installed the glassfish-resources.xml file, hoping that it will complete setup 1 tutorial from the Glassfish control panel.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<resource-adapter-config resource-adapter-name="activemq-rar-5.6.0" thread-pool-ids="thread-pool-1">
    <property name="ServerUrl" value="vm://localhost:61616"></property>
    <property name="BrokerXmlConfig" value="broker:(tcp://0.0.0.0:61616)"></property>
</resource-adapter-config>
    <connector-resource enabled="true" jndi-name="amqres"
        object-type="user" pool-name="amqpool">
    </connector-resource>
    <connector-connection-pool
        connection-definition-name="javax.jms.ConnectionFactory"
        fail-all-connections="false" idle-timeout-in-seconds="300"
        is-connection-validation-required="false" max-pool-size="32"
        max-wait-time-in-millis="60000" name="amqpool" pool-resize-quantity="2"
        resource-adapter-name="activemq-rar-5.6.0" steady-pool-size="2" />
    <admin-object-resource res-adapter="activemq-rar-5.6.0"
        res-type="javax.jms.Queue" jndi-name="amqmsg"></admin-object-resource>
</resources>

add-ons to pom.xml

<dependencies>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-rar</artifactId>
        <version>5.6.0</version>
        <type>rar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-core</artifactId>
        <version>5.6.0</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

Q1: How is the glassfish-resources.xml file loaded? Should I use the maven admin command or place it on some META-INF? edit: it looks like it goes to web-inf if war and meta-inf if ejb-jar

Q2: Not quite sure what the next step is. # 1 do I have activemq and log4j libraries for GLASSFISH_HOME / glassfish / lib so far I just added the dependency to pom.xml, which is equivalent here?

Q3: Rar also needs to be deployed. How can I deploy multiple applications?

+5
source share

All Articles