mirror of https://github.com/apache/activemq.git
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
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@766053 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7a4d84a5b8
commit
a259babc34
|
@ -74,6 +74,11 @@ public class ActiveMQResourceAdapter extends ActiveMQConnectionSupport implement
|
||||||
@Override
|
@Override
|
||||||
public void run () {
|
public void run () {
|
||||||
try {
|
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 ) {
|
synchronized( ActiveMQResourceAdapter.this ) {
|
||||||
broker = BrokerFactory.createBroker(new URI(brokerXmlConfig));
|
broker = BrokerFactory.createBroker(new URI(brokerXmlConfig));
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,14 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.derby</groupId>
|
<groupId>org.apache.derby</groupId>
|
||||||
<artifactId>derby</artifactId>
|
<artifactId>derby</artifactId>
|
||||||
|
@ -221,4 +229,5 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,10 @@
|
||||||
<config-property-type>java.lang.String</config-property-type>
|
<config-property-type>java.lang.String</config-property-type>
|
||||||
<config-property-value></config-property-value>
|
<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>
|
</config-property>
|
||||||
|
|
||||||
|
|
|
@ -18,47 +18,22 @@
|
||||||
<!-- START SNIPPET: xbean -->
|
<!-- START SNIPPET: xbean -->
|
||||||
<beans xmlns="http://activemq.apache.org/schema/core">
|
<beans xmlns="http://activemq.apache.org/schema/core">
|
||||||
|
|
||||||
<broker useJmx="true">
|
<!-- shutdown hook is disabled as RAR classloader may be gone at shutdown -->
|
||||||
|
<broker useJmx="true" useShutdownHook="false">
|
||||||
<!-- 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>
|
|
||||||
|
|
||||||
|
<managementContext>
|
||||||
|
<!-- use appserver provided context instead of creating one,
|
||||||
|
for jboss use: -Djboss.platform.mbeanserver -->
|
||||||
|
<managementContext createConnector="false"/>
|
||||||
|
</managementContext>
|
||||||
|
|
||||||
<persistenceAdapter>
|
<persistenceAdapter>
|
||||||
<journaledJDBC journalLogFiles="5" dataDirectory="../data"/>
|
<journaledJDBC journalLogFiles="5" dataDirectory="../data"/>
|
||||||
<!-- To use a different datasource, use th following syntax : -->
|
|
||||||
<!--
|
|
||||||
<journaledJDBC journalLogFiles="5" dataDirectory="../data" dataSource="#postgres-ds"/>
|
|
||||||
-->
|
|
||||||
</persistenceAdapter>
|
</persistenceAdapter>
|
||||||
|
|
||||||
<transportConnectors>
|
<transportConnectors>
|
||||||
<!-- prefixing a connector with discovery: causes the connector to be advertiesed over rendezvous -->
|
<transportConnector uri="tcp://localhost:61616"/>
|
||||||
<transportConnector uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
|
|
||||||
</transportConnectors>
|
</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>
|
</broker>
|
||||||
|
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue