You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2009/04/17 17:34:35 UTC

svn commit: r766053 - in /activemq/trunk: activemq-ra/src/main/java/org/apache/activemq/ra/ activemq-rar/ activemq-rar/src/main/rar/ activemq-rar/src/main/rar/META-INF/

Author: gtully
Date: Fri Apr 17 15:34:34 2009
New Revision: 766053

URL: http://svn.apache.org/viewvc?rev=766053&view=rev
Log:
resolve AMQ-2212|https://issues.apache.org/activemq/browse/AMQ-2212 - fix resource resolving for RAR with weblogic - set the thread context class loader for the thread that starts the embedded broker

Added:
    activemq/trunk/activemq-rar/src/main/rar/log4j.properties   (with props)
Modified:
    activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
    activemq/trunk/activemq-rar/pom.xml
    activemq/trunk/activemq-rar/src/main/rar/META-INF/ra.xml
    activemq/trunk/activemq-rar/src/main/rar/broker-config.xml

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java?rev=766053&r1=766052&r2=766053&view=diff
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java (original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java Fri Apr 17 15:34:34 2009
@@ -74,6 +74,11 @@
                 @Override
                 public void run () {
                     try {
+                        // ensure RAR resources are available to xbean (needed for weblogic)
+                        log.debug("original thread context classLoader: " + Thread.currentThread().getContextClassLoader());
+                        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+                        log.debug("current (from getClass()) thread context classLoader: " + Thread.currentThread().getContextClassLoader());
+                        
                         synchronized( ActiveMQResourceAdapter.this ) {
                             broker = BrokerFactory.createBroker(new URI(brokerXmlConfig));
                         }

Modified: activemq/trunk/activemq-rar/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-rar/pom.xml?rev=766053&r1=766052&r2=766053&view=diff
==============================================================================
--- activemq/trunk/activemq-rar/pom.xml (original)
+++ activemq/trunk/activemq-rar/pom.xml Fri Apr 17 15:34:34 2009
@@ -198,6 +198,14 @@
       </exclusions>
     </dependency>
     <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-context</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.derby</groupId>
       <artifactId>derby</artifactId>
     </dependency>
@@ -221,4 +229,5 @@
     </plugins>
   </build>
   
-</project>
\ No newline at end of file
+</project>
+

Modified: activemq/trunk/activemq-rar/src/main/rar/META-INF/ra.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-rar/src/main/rar/META-INF/ra.xml?rev=766053&r1=766052&r2=766053&view=diff
==============================================================================
--- activemq/trunk/activemq-rar/src/main/rar/META-INF/ra.xml (original)
+++ activemq/trunk/activemq-rar/src/main/rar/META-INF/ra.xml Fri Apr 17 15:34:34 2009
@@ -284,7 +284,10 @@
             <config-property-type>java.lang.String</config-property-type>
             <config-property-value></config-property-value>
             <!--
-            <config-property-value>xbean:broker-config.xml</config-property-value>
+             To use the broker-config.xml from the root for the RAR
+               <config-property-value>xbean:broker-config.xml</config-property-value>
+             To use an external file or url location
+               <config-property-value>xbean:file:///amq/config/jee/broker-config.xml</config-property-value>
             -->
         </config-property>
 

Modified: activemq/trunk/activemq-rar/src/main/rar/broker-config.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-rar/src/main/rar/broker-config.xml?rev=766053&r1=766052&r2=766053&view=diff
==============================================================================
--- activemq/trunk/activemq-rar/src/main/rar/broker-config.xml (original)
+++ activemq/trunk/activemq-rar/src/main/rar/broker-config.xml Fri Apr 17 15:34:34 2009
@@ -18,47 +18,22 @@
 <!-- START SNIPPET: xbean -->
 <beans xmlns="http://activemq.apache.org/schema/core">
 
-  <broker useJmx="true">
-
-	<!-- In ActiveMQ 4, you can setup destination policies. note: this xml format may still change a bit -->
-    <destinationPolicy>
-      <policyMap><policyEntries>
-
-          <policyEntry topic="FOO.>">
-            <dispatchPolicy>
-              <strictOrderDispatchPolicy />
-            </dispatchPolicy>
-            <subscriptionRecoveryPolicy>
-              <lastImageSubscriptionRecoveryPolicy />
-            </subscriptionRecoveryPolicy>
-          </policyEntry>
-
-      </policyEntries></policyMap>
-    </destinationPolicy>
+  <!--  shutdown hook is disabled as RAR classloader may be gone at shutdown -->
+  <broker useJmx="true" useShutdownHook="false">
 
+     <managementContext>
+       <!-- use appserver provided context instead of creating one,
+            for jboss use: -Djboss.platform.mbeanserver -->
+       <managementContext createConnector="false"/>
+     </managementContext>
 
     <persistenceAdapter>
       <journaledJDBC journalLogFiles="5" dataDirectory="../data"/>
-      <!-- To use a different datasource, use th following syntax : -->
-      <!--
-      <journaledJDBC journalLogFiles="5" dataDirectory="../data" dataSource="#postgres-ds"/>
-       -->
     </persistenceAdapter>
 
     <transportConnectors>
-      <!-- prefixing a connector with discovery: causes the connector to be advertiesed over rendezvous -->
-      <transportConnector uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
+      <transportConnector uri="tcp://localhost:61616"/>
     </transportConnectors>
-
-    <networkConnectors>
-      <!-- by default just auto discover the other brokers -->
-      <networkConnector uri="multicast://default"/>
-      <!--
-      <networkConnector uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
-      -->
-    </networkConnectors>
-
+    
   </broker>
-
-
 </beans>

Added: activemq/trunk/activemq-rar/src/main/rar/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-rar/src/main/rar/log4j.properties?rev=766053&view=auto
==============================================================================
--- activemq/trunk/activemq-rar/src/main/rar/log4j.properties (added)
+++ activemq/trunk/activemq-rar/src/main/rar/log4j.properties Fri Apr 17 15:34:34 2009
@@ -0,0 +1,35 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+## 
+## http://www.apache.org/licenses/LICENSE-2.0
+## 
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+log4j.rootLogger=INFO, stdout
+
+log4j.logger.org.apache.activemq.spring=WARN
+log4j.logger.org.springframework=WARN
+log4j.logger.org.apache.xbean.spring=WARN
+
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=activemq-ra.log
+log4j.appender.out.append=true

Propchange: activemq/trunk/activemq-rar/src/main/rar/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-rar/src/main/rar/log4j.properties
------------------------------------------------------------------------------
    svn:executable = *

Propchange: activemq/trunk/activemq-rar/src/main/rar/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: activemq/trunk/activemq-rar/src/main/rar/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain