Since the <camelContext> overrides the default XML namespace - moving
it to the bottom of the file should fix it.

On 18/03/2008, cmoulliard <[EMAIL PROTECTED]> wrote:
>
>  Here is the camel context James :
>
>  <?xml version="1.0" encoding="UTF-8"?>
>  <beans xmlns="http://www.springframework.org/schema/beans";
>         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-2.5.xsd
>        http://activemq.apache.org/camel/schema/spring
>  http://activemq.apache.org/camel/schema/spring/camel-spring.xsd";>
>
>         <camelContext id="camel" useJmx="false" mbeanServer="mbeanServer"
>                 xmlns="http://activemq.apache.org/camel/schema/spring";>
>                 <package>org.apache.camel.example.spring</package>
>         </camelContext>
>
>         <!-- lets configure the default ActiveMQ broker URL -->
>         <bean id="test-jms"
>                 class="org.apache.camel.component.jms.JmsComponent">
>                 <property name="connectionFactory">
>                         <bean
>                                 
> class="org.apache.activemq.ActiveMQConnectionFactory">
>                                 <property name="brokerURL"
>                                         
> value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"
>  />
>                         </bean>
>                 </property>
>         </bean>
>
>         <bean id="Converter" class="com.xpectis.transform.Converter" />
>
>
>         <!-- DB connection and persistence layer -->
>
>         <!-- DataSource Definition -->
>         <bean id="dataSource"
>                 class="org.apache.commons.dbcp.BasicDataSource"
>                 destroy-method="close">
>                 <property name="driverClassName">
>                         <value>com.mysql.jdbc.Driver</value>
>                 </property>
>                 <property name="url">
>                         <value>jdbc:mysql:///test</value>
>                 </property>
>                 <property name="username">
>                         <value>root</value>
>                 </property>
>                 <property name="password">
>                         <value></value>
>                 </property>
>         </bean>
>
>         <!-- Hibernate SessionFactory Definition -->
>         <bean id="sessionFactory"
>                 
> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>                 <property name="mappingResources">
>                         <list>
>                                 <value>
>                                         com/xpectis/model/order.hbm.xml
>                                 </value>
>                         </list>
>                 </property>
>
>                 <property name="hibernateProperties">
>                         <props>
>                                 <prop key="hibernate.dialect">
>                                         org.hibernate.dialect.MySQLDialect
>                                 </prop>
>                                 <prop key="hibernate.show_sql">true</prop>
>                                 <prop key="hibernate.format_sql">true</prop>
>                                 <prop 
> key="hibernate.default_schema">test</prop>
>                                 <prop 
> key="hibernate.cglib.use_reflection_optimizer">
>                                         true
>                                 </prop>
>                                 <prop key="hibernate.cache.provider_class">
>                                         
> org.hibernate.cache.HashtableCacheProvider
>                                 </prop>
>                         </props>
>                 </property>
>
>                 <property name="dataSource">
>                         <ref bean="dataSource" />
>                 </property>
>         </bean>
>
>         <!-- Hibernate Template Defintion
>                 <bean id="hibernateTemplate"
>  class="org.springframework.orm.hibernate3.HibernateTemplate">
>
>                 <property name="sessionFactory"><ref 
> bean="sessionFactory"/></property>
>
>                 <property name="jdbcExceptionTranslator"><ref
>  bean="jdbcExceptionTranslator"/></property>
>                 </bean> -->
>
>
>         <!-- Catalog DAO Definition: Hibernate implementation -->
>         <bean id="orderDAO"
>                 class="com.xpectis.dao.OrderDAOHibernateImpl">
>                 <property name="sessionFactory">
>                         <ref bean="sessionFactory" />
>                 </property>
>         </bean>
>
>
>         <!-- Hibernate Transaction Manager Definition -->
>         <bean id="transactionManager"
>                 
> class="org.springframework.orm.hibernate3.HibernateTransactionManager">
>                 <property name="sessionFactory">
>                         <ref local="sessionFactory" />
>                 </property>
>         </bean>
>
>         <!-- Spring Data Access Exception Translator Defintion -->
>         <bean id="jdbcExceptionTranslator"
>
>  class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator">
>                 <property name="dataSource">
>                         <ref bean="dataSource" />
>                 </property>
>         </bean>
>
>         <!--
>                 <bean id="Order" class="com.xpectis.model.Order" />
>                 <bean id="registry"
>  class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
>                 <property name="port" value="1099" />
>                 </bean>
>                 <bean id="serverConnector"
>  class="org.springframework.jmx.support.ConnectorServerFactoryBean"
>  depends-on="registry">
>                 <property name="objectName" value="connector:name=rmi" />
>                 <property name="serviceUrl"
>  value="service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi" />
>                 <property name="threaded" value="true" />
>                 <property name="daemon" value="true" />
>                 </bean>
>         -->
>
>  </beans>
>
>
>
>
>  James.Strachan wrote:
>  >
>  > Any chance you could show us the whole spring XML file? Am wondering
>  > if its something to do with namespaces?
>  >
>  > On 18/03/2008, cmoulliard <[EMAIL PROTECTED]> wrote:
>  >>
>  >>  Hi,
>  >>
>  >>  I try from one of my java class to inject an HibernateDAOImplementation
>  >>  defined as a bean in the CamelContext file. Unfortunately, I receive a
>  >> null
>  >>  pointer exception at the following line :
>  >>
>  >>  orderDAO = (OrderDAOHibernateImpl)this.beanFactory.getBean("orderDAO");
>  >>
>  >>  the beanFactory object is null
>  >>
>  >>  import org.springframework.beans.BeansException;
>  >>  import org.springframework.beans.factory.BeanFactory;
>  >>  import org.springframework.beans.factory.BeanFactoryAware;
>  >>  import org.springframework.dao.DataIntegrityViolationException;
>  >>
>  >>  import com.xpectis.dao.OrderDAO;
>  >>  import com.xpectis.dao.OrderDAOHibernateImpl;
>  >>  import com.xpectis.model.Order;
>  >>
>  >>  public class SaveOrder implements BeanFactoryAware {
>  >>
>  >>         private BeanFactory beanFactory;
>  >>         private OrderDAO orderDAO;
>  >>
>  >>         public SaveOrder() {
>  >>         }
>  >>
>  >>         public void save(Order order) {
>  >>
>  >>
>  >>                 orderDAO =
>  >> (OrderDAOHibernateImpl)this.beanFactory.getBean("orderDAO");
>  >>
>  >>                 try {
>  >>                         this.orderDAO.addOrder(order);
>  >>                         System.out.println("Order saved : " +
>  >> order.toString());
>  >>                 } catch (DataIntegrityViolationException de) {
>  >>                         System.out.println("Could not save product,
>  >> duplicate product id");
>  >>                 } catch (Exception e) {
>  >>                         System.out.println("Could not save product " +
>  >> e.toString());
>  >>                 }
>  >>         }
>  >>
>  >>         public void setBeanFactory(BeanFactory beanFactory) {
>  >>                 this.beanFactory = beanFactory;
>  >>         }
>  >>
>  >>         public OrderDAO getOrderDAO() {
>  >>                 return orderDAO;
>  >>         }
>  >>
>  >>         public void setOrderDAO(OrderDAO orderDAO) {
>  >>                 this.orderDAO = orderDAO;
>  >>         }
>  >>
>  >>  }
>  >>
>  >>  Here is the camelcontext file where my bean is declared.
>  >>
>  >>         <!-- Catalog DAO Definition: Hibernate implementation -->
>  >>         <bean id="orderDAO"
>  >>                 class="com.xpectis.dao.OrderDAOHibernateImpl">
>  >>                 <property name="sessionFactory">
>  >>                         <ref bean="sessionFactory" />
>  >>                 </property>
>  >>         </bean>
>  >>
>  >>
>  >>  When this code runs in Spring context, it works. So, where is the issue
>  >> with
>  >>  Camel ??
>  >>
>  >>  Regards,
>  >>
>  >>  Charles
>  >>
>  >>
>  >>  --
>  >>  View this message in context:
>  >> 
> http://www.nabble.com/BeanFactoryAware-%28Spring%29-tp16122107s22882p16122107.html
>  >>  Sent from the Camel - Users mailing list archive at Nabble.com.
>  >>
>  >>
>  >
>  >
>  > --
>  > James
>  > -------
>  > http://macstrac.blogspot.com/
>  >
>  > Open Source Integration
>  > http://open.iona.com
>  >
>  >
>
>
> --
>  View this message in context: 
> http://www.nabble.com/BeanFactoryAware-%28Spring%29-tp16122107s22882p16124218.html
>
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Reply via email to