activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ChipSchoch <csch...@elynx.com>
Subject Re: JBoss Integration Question from newb
Date Thu, 03 Sep 2009 16:57:33 GMT

Ok, I was able to get the broker running using sybase jdbc.  Below is the
config that worked.  The main thing was defining the adapter as a bean 

<bean xmlns="" id="sybase-adapter" 
                   
class="org.apache.activemq.store.jdbc.adapter.SybaseJDBCAdapter"/>

then referencing it in my persistence adapter.

<jdbcPersistenceAdapter dataSource="#sybase-ds" adapter="#sybase-adapter"/> 


The thing started, created the AMQ tables ran for 20 seconds then shutdown
with:

"No longer able to keep the exclusive lock so giving up being a master"

I am guessing this is an issue with my sybase setup, not AMQ.

==========================================================================
<beans xmlns="http://activemq.apache.org/schema/core">

<!--
	<bean xmlns=""
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-->

  <bean xmlns="" id="sybase-ds" 
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName"
value="net.sourceforge.jtds.jdbc.Driver"/>
    <property name="url"
value="jdbc:jtds:sybase://172.17.20.50:4800;DatabaseName=DEV_JBM_144"/>
    <property name="username" value="sa"/>
    <property name="password" value="prodsa"/>
    <property name="maxActive" value="200"/>
    <property name="poolPreparedStatements" value="true"/>
  </bean>
  
  
  <!-- Define which adapter to use here -->
  <bean xmlns="" id="sybase-adapter"
class="org.apache.activemq.store.jdbc.adapter.SybaseJDBCAdapter"/>
    
  <broker persistent="true" useJmx="true" brokerName="chip.broker1">

		<managementContext><!-- we'll use an existing one (JBoss) instead of
creating one -->
		  <managementContext createConnector="false"/>
		</managementContext>
	
		<!-- 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>


    <persistenceAdapter>
     <!-- 
      <journaledJDBC journalLogFiles="5" 
                     dataDirectory="{jboss.server.data.dir}/activemq" 
       							
adapter="org.apache.activemq.store.jdbc.adapter.SybaseJDBCAdapter" 
       							 dataSource="#sybase-ds"/>
     To use a different datasource, use th following syntax : -->
      <!--
      <journaledJDBC journalLogFiles="5" dataDirectory="../data"
dataSource="#postgres-ds"/>
       -->
      
      <jdbcPersistenceAdapter dataSource="#sybase-ds"
adapter="#sybase-adapter"/> 
    </persistenceAdapter>

    <transportConnectors >
      <!-- prefixing a connector with discovery: causes the connector to be
advertiesed over rendezvous -->
      <transportConnector name="chip.broker1" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
    </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>

    <!-- Sybase DataSource Setup -->
    
    <!--class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="java:/DefaultDS"/>
    </bean>    --> 
    

</beans>
=============================================================================



ChipSchoch wrote:
> 
> Thanks.  I was able to get further by adding the xmlns back in and
> changing the attribute in the 
> <jdbcPersistenceAdapter lockDataSource="#sybase-ds"/>
> 
> Here is the config:
> 
> ================================
> <beans xmlns="http://activemq.apache.org/schema/core">
> 
> <!--
> 	<bean xmlns=""
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
> -->
> 
>     <bean xmlns="" id="sybase-ds" 
> class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
>       <property name="driverClassName"
> value="net.sourceforge.jtds.jdbc.Driver"/>
>       <property name="url"
> value="jdbc:jtds:sybase://172.17.20.50:4800;DatabaseName=DEV_JBM_144"/>
>       <property name="username" value="sa"/>
>       <property name="password" value="prodsa"/>
>       <property name="maxActive" value="200"/>
>       <property name="poolPreparedStatements" value="true"/>
>     </bean>
>     
>   <broker useJmx="true" brokerName="chip.broker1">
> 
> 		<managementContext><!-- we'll use an existing one (JBoss) instead of
> creating one -->
> 		  <managementContext createConnector="false"/>
> 		</managementContext>
> 	
> 		<!-- 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>
> 
> 
>     <persistenceAdapter>
>     <!--
>       <journaledJDBC journalLogFiles="5"
> dataDirectory="{jboss.server.data.dir}/activemq" datasource="#sybase-ds"/>
>        To use a different datasource, use th following syntax : -->
>       <!--
>       <journaledJDBC journalLogFiles="5" dataDirectory="../data"
> dataSource="#postgres-ds"/>
>        -->
>        <jdbcPersistenceAdapter lockDataSource="#sybase-ds"/>
>     </persistenceAdapter>
> 
>     <transportConnectors >
>       <!-- prefixing a connector with discovery: causes the connector to
> be advertiesed over rendezvous -->
>       <transportConnector name="chip.broker1" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
>     </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>
> 
>     <!-- Sybase DataSource Setup -->
>     
>     <!--class="org.springframework.jndi.JndiObjectFactoryBean">
>         <property name="jndiName" value="java:/DefaultDS"/>
>     </bean>    --> 
>     
> 
> </beans>
> ====================================================
> 
> However, now I get sql errors.  There are no tables and it does not appear
> to be creating them.  Do you know anything about this?
> 
> java.sql.SQLException: Cannot execute a LOCK TABLE command on table
> 'ACTIVEMQ_LOCK', because this table does not exist.
> 
> 
> 
> 
> 
> 
> 
> Gary Tully wrote:
>> 
>> replace:
>> <broker useJmx="true" brokerName="chip.broker1">
>> 
>> with:
>> <broker useJmx="true" brokerName="chip.broker1" id="broker">
>> 
>> and the XBeanBrokerFactory will be able to find it.
>> 
>> Also, i recall that there is a way to append digits to files in the jboss
>> deploy directory to configure start or deploy order. This may have
>> changed
>> but I recall there is a way to do it. google "jboss deployment order" and
>> you should get a solution to ensure that the data source is deployed
>> before
>> the RAR.
>> 
>> 
>> 2009/9/3 ChipSchoch <cschoch@elynx.com>
>> 
>>>
>>> I don't know what that means.  Could you tell me what the fix is?
>>>
>>>
>>>
>>> Gary Tully wrote:
>>> >
>>> > the XBean broker factory is looking for a bean with id "broker" or an
>>> > instance of BrokerService.class and is telling us that it cannot
>>> locate
>>> > one.
>>> >
>>> > 2009/9/3 ChipSchoch <cschoch@elynx.com>
>>> >
>>> >>
>>> >> I am trying to integrate JBossAs 4.2.2 and ActiveMQ 5.2.0.  Following
>>> the
>>> >> instructions works fine, but I am trying to configure it to use jdbc
>>> >> persistence (sybase db).  I was attempting to specify a JBoss
>>> datasource
>>> >> in
>>> >> my broker-config.xml but the .rar deploys before the sybase-ds.xml so
>>> the
>>> >> datasource is not bound in JNDI.  I cannot seem to find any example
>>> of
>>> >> this
>>> >> integration.
>>> >>
>>> >> Has anyone integrated JBoss with ActiveMQ and used jdbc persistence
>>> >> employing the JBoss datasource?  If so, could you post the
>>> configuration?
>>> >>
>>> >> I went through the exercise where I defined the datasource in the
>>> config
>>> >> using xbean and was able to reconcile all the class not found and
>>> schema
>>> >> violations etc; but then the JBoss log gives:
>>> >>
>>> >> 31 WARN    | Starting ActiveMQ Broker |
>>> >> org.apache.activemq.ra.ActiveMQResourceAdapter     | Could not start
>>> up
>>> >> embeded ActiveMQ Broker 'xbean:broker-config.xml': The configuration
>>> has
>>> >> no
>>> >> BrokerService instance for resource: xbean:broker-config.xml
>>> >> 2009-09-03 08:25:29,9
>>> >>
>>> >> I am basically clueless on this.  It should not be this difficult. 
>>> Any
>>> >> help
>>> >> would really be appreciated.
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/JBoss-Integration-Question-from-newb-tp25275700p25275700.html
>>> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > http://blog.garytully.com
>>> >
>>> > Open Source Integration
>>> > http://fusesource.com
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/JBoss-Integration-Question-from-newb-tp25275700p25277309.html
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> -- 
>> http://blog.garytully.com
>> 
>> Open Source Integration
>> http://fusesource.com
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JBoss-Integration-Question-from-newb-tp25275700p25280053.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message