Charles,

In the Spring XML syntax, you have to replace & with & in the URIs

Regards,

Gert

cmoulliard wrote:
IT works now except that I have a mysterious error :

<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.0.xsd
       http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring-1.3.0.xsd";>
        
         <camelContext xmlns="http://activemq.apache.org/camel/schema/spring";>
 <route>
  <from uri="timer://myTimer?fixedRate=true&delay=0&period=2000" />

Error

43org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 9 in XML document from URL
[bundleentry://12/META-INF/spring/camelservice.xml] is invalid; nested
exception is org.xml.sax.SAXParseException: The reference to entity "delay"
must end with the ';' delimiter.
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)


cmoulliard wrote:
I'm offline.
;-)

gnodet wrote:
The problem is that spring can not find the schema.
Are you working online ? Or you may change the location of the schema
inside the schemaLocation attribute to
   http://activemq.apache.org/camel/schema/spring/camel-spring-1.3.0.xsd
which should work better, as spring will recognize it and map it to
the schema inside the jar instead of having
to go the main activemq web site.

On Wed, May 28, 2008 at 4:50 PM, cmoulliard <[EMAIL PROTECTED]> wrote:
Guillaume,

I don't see the error.

Here is the content of the example :

<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.0.xsd
      http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd";>

 <camelContext xmlns="http://activemq.apache.org/camel/schema/spring";>

My xml file is the same as this one. So, where is the mistake ?


gnodet wrote:
Because you did not follow the example.
You need to add the schema to the xsi:schemaLocation attribute.

On Wed, May 28, 2008 at 3:26 PM, cmoulliard <[EMAIL PROTECTED]>
wrote:
Sorry but I forget also to mention that the namespece declaration that
you
mention does not work :

<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.0.xsd
      http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd";>

        <camelContext
xmlns="http://activemq.apache.org/camel/schema/spring";>
 <route>
 <from uri="timer://myTimer?fixedRate=true&period=2000" />
 <bean ref="myTransform" method="transform" />
 <to uri="log:ExampleRouter" />
 </route>
 </camelContext>

 <bean id="myTransform" class="org.apache.camel.impl.MyTransform">
 <property name="prefix" value="MyTransform" />
 </bean>

</beans>

Error :

Line 9 in XML document from URL
[bundleentry://12/META-INF/spring/camelservice.xml] is invalid; nested
exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c:
The
matching wildcard is strict, but no declaration can be found for
element
'camelContext'.




gnodet wrote:
You can find some examples at:

http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml?view=co&content-type=text%2Fplain

Note the defaut namespace on the camelContext element and the
namespace declaration on the top element.

On Wed, May 28, 2008 at 2:45 PM, cmoulliard <[EMAIL PROTECTED]>
wrote:
I try also to deploy my Camel project inside Spring-DM and I have
another
errors even if I follow your recommendation. See hereafter the two
cases
tested :

1) Case 1 :

<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>
 <route>
 <from uri="timer://myTimer?fixedRate=true&period=2000" />
 <bean ref="myTransform" method="transform" />
 <to uri="log:ExampleRouter" />
 </route>
 </camelContext>

 <bean id="myTransform" class="org.apache.camel.impl.MyTransform">
 <property name="prefix" value="MyTransform" />
 </bean>

</beans>


Line 9 in XML document from URL
[bundleentry://12/META-INF/spring/camelservice.xml] is invalid;
nested
exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:
Invalid
content was found starting with element 'camelContext'. One of
'{"http://www.springframework.org/schema/beans":description,
"http://www.springframework.org/schema/beans":import,
"http://www.springframework.org/schema/beans":alias,
"http://www.springframework.org/schema/beans":bean,
WC[##other:"http://www.springframework.org/schema/beans"]}' is
expected.

2) Case 2
<beans 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>
 <route>
 <from uri="timer://myTimer?fixedRate=true&period=2000" />
 <bean ref="myTransform" method="transform" />
 <to uri="log:ExampleRouter" />
 </route>
 </camelContext>

 <bean id="myTransform" class="org.apache.camel.impl.MyTransform">
 <property name="prefix" value="MyTransform" />
 </bean>

</beans>

Caused by: org.xml.sax.SAXParseException: The prefix "xsi" for
attribute
"xsi:schemaLocation" associated with an element type "beans" is not
bound.

So, what are the correct namespace declarations to run Camel over
spring-DM
?

Charles


gnodet wrote:
You need to add the namespace declaration and schema uri, as spring
use
strict matching, which means it mandates all the schema have a
valid
xsd
available.
Take a look at the xsi:schemaLocation as in the available example:

http://svn.apache.org/repos/asf/activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml

On Dec 4, 2007 7:48 PM, dlaidlaw <[EMAIL PROTECTED]> wrote:

I am trying to load up a CamelContext in the equinox OSGi engine
using
Spring-DM-rc1. I have all the dependencies satisfied, with
camel-core,
camel-spring, camel-jms and servicemix's jaxb-api bundles. All
these
bundles
start OK.

In my bundle using the Spring-DM stuff to create a spring context
I
added:


       <bean id="jms"
class="org.apache.camel.component.jms.JmsComponent">
               <property name="connectionFactory"
ref="connectionFactory"/>
       </bean>

       <camelContext id="camel"
                               xmlns="
http://activemq.apache.org/camel/schema/spring";
                               useJmx="false"
       >
               <route>
                       <from uri="jms:queue:test.queue.1" />
                       <to uri="file://test.queue.1?noop=true"/>
               </route>
       </camelContext>

But when the bundle is loading and Spring is creating the context
I
get:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line
67 in XML document from OSGi
res[/META-INF/spring/bundle-context.xml|61|symName=don.sample.listener]
is
invalid; nested exception is org.xml.sax.SAXParseException:
cvc-complex-type.2.4.c: The matching wildcard is strict, but no
declaration
can be found for element 'camelContext'.

For some reason, the camelContext element will not resolve.

Any hints?
--
View this message in context:
http://www.nabble.com/Camel-with-Spring-DM-rc1-and-equinox-tf4944939s22882.html#a14156945
Sent from the Camel - Users mailing list archive at Nabble.com.


--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/


--
View this message in context:
http://www.nabble.com/Camel-with-Spring-DM-rc1-and-equinox-tp14156945s22882p17511812.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/


--
View this message in context:
http://www.nabble.com/Camel-with-Spring-DM-rc1-and-equinox-tp14156945s22882p17512647.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/


--
View this message in context:
http://www.nabble.com/Camel-with-Spring-DM-rc1-and-equinox-tp14156945s22882p17514480.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/




Reply via email to