Am not completely sure I follow how you are using spring but you need
to make sure that the dataSource POJO is accessible to the application
context which defines the broker. e.g. try use a parent context and
place it there, then include the child contexts so you have a
parent-child relationship

On 9/1/06, javaxmlsoapdev <[EMAIL PROTECTED]> wrote:

Just to clarify that <bean> is now outside of <broker> (it was my bad having
withing <broker). Now problem is, I have following order to load Spring
configs

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
        <set-property property="contextConfigLocation"
value="/WEB-INF/spring/dataAccessContext.xml
/WEB-INF/spring/businessContext.xml /WEB-INF/spring/applicationContext.xml
/WEB-INF/spring-embedded.xml"/>
  </plug-in>
In dataAccessContext config I have following

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
                <property
name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property>
                <property
name="url"><value>jdbc:oracle:thin:@localhost:1521:XE</value></property>
                <property name="username"><value>fts</value></property>
                <property name="password"><value>admin</value></property>
        </bean>

In activemq.xml I use reference of dataSource as below and I get
beanNotFoundException.

<journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"
dataSource="#dataSource"/>

If I define dataSource within activemq, my other beans initialization fails,
which has dependecny with dataSource. bombing out saying "dataSource" bean
not fond or something.. any ideas?

javaxmlsoapdev wrote:
>
> Here is the complete file where dataSource is the bean definied in another
> dataAccessContext.xml file, loaded by spring.
> <broker brokerName="broker" persistent="false" useJmx="false"
> xmlns="http://activemq.org/config/1.0";>
>
>     <!-- In ActiveMQ 4, you can setup destination policies -->
>     <destinationPolicy>
>       <policyMap><policyEntries>
>
>           <policyEntry topic="FOO.>">
>             <dispatchPolicy>
>               <strictOrderDispatchPolicy />
>             </dispatchPolicy>
>             <subscriptionRecoveryPolicy>
>               <lastImageSubscriptionRecoveryPolicy />
>             </subscriptionRecoveryPolicy>
>           </policyEntry>
>
>       </policyEntries></policyMap>
>     </destinationPolicy>
>
>     <persistenceAdapter>
>       <!--<journaledJDBC journalLogFiles="5"
> dataDirectory="../activemq-data"/>-->
>       <!-- To use a different datasource, use th following syntax : -->
>
>       <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"
> dataSource="#dataSource"/>
>
>     </persistenceAdapter>
>     <!-- <bean id="oracle-ds"
> class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
>               <property
> 
name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property>
>               <property
> name="url"><value>jdbc:oracle:thin:@localhost:1521:XE</value></property>
>               <property name="username"><value>fts</value></property>
>               <property name="password"><value>admin</value></property>
>       </bean> -->
>     <!-- Oracle persistence Journal -->
>     <!-- <persistenceAdapter>
>               <journaledJDBC journalLogFiles="5" 
dataDirectory="../activemq-data"
> dataSource="#dataSource"/>
>     </persistenceAdapter> -->
>
>       <!--  End oracle persistence Journal -->
>
>     <transportConnectors>
>        <transportConnector name="default" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
>        <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
>     </transportConnectors>
>
>     <networkConnectors>
>       <!-- by default just auto discover the other brokers -->
>       <networkConnector name="default" uri="multicast://default"/>
>       <!--
>       <networkConnector name="host1 and host2"
> uri="static://(tcp://host1:61616,tcp://host2:61616)" failover="true"/>
>       -->
>     </networkConnectors>
>
>   </broker>
>
> I also tried creating dataSource bean inside this config file but no
> luck.. same error..
> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
>               <property
> 
name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property>
>               <property
> name="url"><value>jdbc:oracle:thin:@localhost:1521:XE</value></property>
>               <property name="username"><value>mydb</value></property>
>               <property name="password"><value>admin</value></property>
>       </bean>
>
>
> Adrian Co wrote:
>>
>> Hi,
>>
>> Could you post the complete config? Is the oracle-ds bean a inside the
>> broker bean? It should be outside.
>>
>> javaxmlsoapdev wrote:
>>> I have this configuration for JDBC journal. My broker is running from
>>> within
>>> the Spring application.
>>>
>>>  <persistenceAdapter>
>>>
>>>       <journaledJDBC journalLogFiles="5"
>>> dataDirectory="../activemq-data"
>>> dataSource="#oracle-ds"/>
>>>
>>>     </persistenceAdapter>
>>>     <bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource"
>>> destroy-method="close">
>>>             <property
>>> 
name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property>
>>>             <property
>>> name="url"><value>jdbc:oracle:thin:@localhost:1521:XE</value></property>
>>>             <property name="username"><value>mydb</value></property>
>>>             <property name="password"><value>admin</value></property>
>>>     </bean>
>>>
>>> I get following exception
>>>
>>> Caused by:
>>> org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
>>> named 'oracle-ds' is defined
>>>     at
>>> 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(Def
>>>
>>
>>
>>
>
>

--
View this message in context: 
http://www.nabble.com/jdbcJournal-with-oracle-problem-tf2193972.html#a6092443
Sent from the ActiveMQ - User forum at Nabble.com.




--

James
-------
http://radio.weblogs.com/0112098/

Reply via email to