activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack <jackgray1...@gmail.com>
Subject Re: About ActiveMQ
Date Tue, 13 Nov 2007 10:30:49 GMT
*This is my activemq configure file:*


<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.org/config/1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
  http://activemq.org/config/1.0
http://people.apache.org/repository/org.apache.activemq/xsds/activemq-core-4.1-incubator-SNAPSHOT.xsd
">

 <!--  embedded ActiveMQ Broker -->
 <amq:broker useJmx="false" persistent="true" >
  <amq:persistenceAdapter>
   <amq:jdbcPersistenceAdapter id="jdbcAdapter" dataSource="#mysql-ds"
createTablesOnStartup="true"
          useDatabaseLock="false" />
   <!--
    Mysql can setup useDatabaseLock="true",this is defualt
    HSQLDB,MSSQL plz setup useDatabaseLock="false",
    if u setup useDatabaseLock="true",u will catch error:
    MSSQL Error Info:FOR UPDATE clause allowed only for DECLARE CURSOR
    HSQLDB Error Info:FOR in statement [SELECT * FROM ACTIVEMQ_LOCK FOR
UPDATE]

    see
http://www.nabble.com/ActiveMQ-JDBC-Persistence-with-SQL-Server-tf2022248.html#a5560296
   -->
  </amq:persistenceAdapter>
  <amq:transportConnectors>
   <amq:transportConnector uri="tcp://localhost:0"/>
  </amq:transportConnectors>
 </amq:broker>

 <!--  ActiveMQ connectionFactory  -->
 <amq:connectionFactory id="jmsConnectionFactory"
brokerURL="vm://localhost"/>

 <!--  ActiveMQ destinations  -->
 <amq:queue name="destination" physicalName="
org.apache.activemq.spring.Test.spring.embedded"/>


 <!-- The HSQL Datasource that will be used by the Broker -->
 <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
  <property name="driverClassName" value="org.gjt.mm.mysql.Driver"/>
  <!--mysql version
  <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
  -->
  <property name="url">
   <!--springside use HSQL,table info see hsql/activemq.script-->
   <value>jdbc:mysql://localhost:3306/bookstore?useUnicode=true&amp;characterEncoding=UTF-8&amp;characterSetResults=UTF-8</value>
   <!-- mysql version
   <value>jdbc:mysql://localhost/myproject?relaxAutoCommit=true</value>
   -->
  </property>
  <property name="username" value="root"/>
  <property name="password" value="1234"/>
  <property name="poolPreparedStatements" value="true"/>
 </bean>

 <!--  Spring JmsTemplate config -->
 <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
  <property name="connectionFactory">
   <!--  lets wrap in a pool to avoid creating a connection per send -->
   <bean class="org.springframework.jms.connection.SingleConnectionFactory">
    <property name="targetConnectionFactory" ref="jmsConnectionFactory"/>
   </bean>
  </property>
  <!-- custom MessageConverter -->
  <property name="messageConverter" ref="orderMessageConverter"/>
 </bean>

 <!--  OrderMessage converter  -->
 <bean id="orderMessageConverter" class="
org.springside.bookstore.components.activemq.OrderMessageConverter"/>

 <!-- POJO which send Message uses  Spring JmsTemplate -->
 <bean id="orderMessageProducer" class="
org.springside.bookstore.components.activemq.OrderMessageProducer">
  <property name="template" ref="jmsTemplate"/>
  <property name="destination" ref="destination"/>
 </bean>

 <!--  Message Driven POJO (MDP) -->
 <bean id="messageListener" class="
org.springframework.jms.listener.adapter.MessageListenerAdapter">
  <constructor-arg>
   <bean class="
org.springside.bookstore.components.activemq.OrderMessageConsumer">
    <property name="mailService" ref="mailService"/>
   </bean>
  </constructor-arg>
  <!--  may be other method -->
  <property name="defaultListenerMethod" value="sendEmail"/>
  <!-- custom MessageConverter define -->
  <property name="messageConverter" ref="orderMessageConverter"/>
 </bean>


 <bean id="listenerContainer" class="
org.springframework.jms.listener.DefaultMessageListenerContainer">
  <property name="connectionFactory" ref="jmsConnectionFactory"/>
  <property name="destination" ref="destination"/>
  <property name="messageListener" ref="messageListener"/>
 </bean>
</beans>



2007/11/13, James Strachan <james.strachan@gmail.com>:
>
> could you provide a full stack trace please?
>
> On 13/11/2007, jack <jackgray1983@gmail.com> wrote:
> > Hi:
> >
> > I'm a Chinese user, I'm very glad to write to you. Now I have a question
> > about the activemq, when I want to store the message to
> > database, always have a exception:java.io.IOException: Object is not a
> > primitive: org.springside.bookstore.model.Order@1fe9830
> > .So please help to tell me the reason of the problem.Thank you very
> much!
> >
> >
> > --
> > JackGray
> >
>
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source SOA
> http://open.iona.com
>



-- 
JackGray

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message