5

Im trying to run a ActiveMQ glassfish embedded using the maven-embedded-glassfish-plugin.

I have separately completed below tutorials, so I know the basics. The goal is to have a setup that builds in 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/

Project setup for #2 is used as startpoint from now and I will try to merge the steps from #1

I've setup a glassfish-resources.xml hoping it will do the configuration tutorial 1 did from the glassfish admin-console.

<?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>

additions 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 glassfish-resources.xml loaded? Should i use maven admin command or place it in some META-INF? edit: looks like it goes in web-inf if war and meta-inf if ejb-jar

Q2: Not entirely sure what is the next step. #1 has me copy activemq and log4j libraries to GLASSFISH_HOME/glassfish/lib so far I only added the dependency in the pom.xml, what is the equivalent here?

Q3: The Rar needs to be deployed as well. How can multiple applications be deployed?

Aksel Willgert
  • 11,367
  • 5
  • 53
  • 74

0 Answers0