You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by niteshjain132 <ni...@gmail.com> on 2014/12/17 12:00:39 UTC

The XML doesn't validates in ServiceMix

Runtime : ServiceMix 4.5

XML validates in a XML Editor, but not in server (Jboss Fuse 6.0)

Unable to parse the *camel_context.xml* when called from a java code as
below. i don't get any such error when i run in eclipse.


ApplicationContext ac = new
ClassPathXmlApplicationContext("*camel_context.xml*");

CamelContext context = SpringCamelContext.springCamelContext(ac);

*camel_context.xml:*

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tool="http://www.springframework.org/schema/tool"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/tool
http://www.springframework.org/schema/tool/spring-tool-2.5.xsd">
    <bean id="testRoute"
class="com.hp.som.devicecapabilities.actions.TestRouter" />
</beans>


log:

2014-12-16 10:35:57,969 | INFO  | ClassPathXmlApplicationContext   | 128 -
org.apache.servicemix.bundles.spring-context - 3.2.8.RELEASE_1 | Refreshing
org.springframework.context.support.ClassPathXmlApplicationContext@302d6c6e:
startup date [Tue Dec 16 10:35:57 IST 2014]; root of context hierarchy

2014-12-16 10:35:57,969 | INFO  | XmlBeanDefinitionReader          | 131 -
org.apache.servicemix.bundles.spring-beans - 3.2.8.RELEASE_1 | Loading XML
bean definitions from class path resource [camel_context.xml]

2014-12-16 10:36:24,310 | WARN  | XmlBeanDefinitionReader          | 131 -
org.apache.servicemix.bundles.spring-beans - 3.2.8.RELEASE_1 | Ignored XML
validation warning

Caused by: org.xml.sax.SAXParseException: cvc-elt.1.a: Cannot find the
declaration of element 'beans'.
        at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)[:]
        at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
Source)[:]
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)[:]
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)[:]
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)[:]
        at
org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
Source)[:]
        at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
Source)[:]
        at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)[:]
        at
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
Source)[:]
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)[:]
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)[:]
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)[:]
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)[:]
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)[:]
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)[:]
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
Source)[:]
        at
org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)[131:org.apache.servicemix.bundles.spring-beans:3.2.8.RELEASE_1]
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)[131:org.apache.servicemix.bundles.spring-beans:3.2.8.RELEASE_1] 



--
View this message in context: http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: The XML doesn't validates in ServiceMix

Posted by Krzysztof Sobkowiak <kr...@gmail.com>.
Please look at this sample:
https://github.com/apache/camel/tree/master/examples/camel-example-pojo-messaging
And here a short description of this sample:
http://camel.apache.org/pojo-messaging-example.html

Regards
Krzysztof

On 21.12.2014 12:37, niteshjain132 wrote:
> Hi,
>
> I don't get it, can you please share a snippet of how to accomplish that.
>
> Thanks,
> Nitesh
>
> On 3:20PM, Sun, 21 Dec 2014 ksobkowiak [via ServiceMix] <
> ml-node+s396122n5722012h58@n5.nabble.com> wrote:
>
>> Hi
>>
>> If you are in a Spring bean, you can just inject the CamelContext or the
>> ProducerTemplate into the Spring bean without retrieving the using
>> ApplicationContext.
>>
>> Regards
>> Krzysztof
>>
>> On 21.12.2014 06:50, niteshjain132 wrote:
>>
>>> Context.xml is in the same bundle,
>>> how can i access the beans without loading via ApplicationContext.
>>>
>>> i'm trying this -
>>>
>>>        ApplicationContext ac = new
>>> ClassPathXmlApplicationContext("META-INF/spring/camel_spring-ws.xml");
>>> CamelContext context = ac.getBean("camel",CamelContext.class);
>>>
>>> Exchange myExchange = new DefaultExchange(context);
>>> exchange.getIn().setBody("Hello");
>>>
>>> ProducerTemplate template = context.createProducerTemplate();
>>> template.send("direct:start", myExchange);
>>>
>>> to invoke a router defined in camelContext.xml
>>>
>>>
>>>
>>> --
>>> View this message in context:
>> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722010.html
>>
>>> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>>>
>>>
>>>
>>> ------------------------------
>>>  If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722012.html
>>>  To unsubscribe from The XML doesn't validates in ServiceMix, click here
>>> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5721993&code=bml0ZXNoamFpbjEzMkBnbWFpbC5jb218NTcyMTk5M3wxNTcxMDAyOTM2>
>>> .
>>> NAML
>>> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722013.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


-- 
Krzysztof Sobkowiak

JEE & OSS Architect | Senior Solution Architect @ Capgemini | Committer
@ ASF
Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
<http://www.pl.capgemini-sdm.com/> | Wroclaw
e-mail: krzys.sobkowiak@gmail.com <ma...@gmail.com> |
Twitter: @KSobkowiak
Calendar: http://goo.gl/yvsebC

Re: The XML doesn't validates in ServiceMix

Posted by niteshjain132 <ni...@gmail.com>.
Hi,

I don't get it, can you please share a snippet of how to accomplish that.

Thanks,
Nitesh

On 3:20PM, Sun, 21 Dec 2014 ksobkowiak [via ServiceMix] <
ml-node+s396122n5722012h58@n5.nabble.com> wrote:

> Hi
>
> If you are in a Spring bean, you can just inject the CamelContext or the
> ProducerTemplate into the Spring bean without retrieving the using
> ApplicationContext.
>
> Regards
> Krzysztof
>
> On 21.12.2014 06:50, niteshjain132 wrote:
>
> > Context.xml is in the same bundle,
> > how can i access the beans without loading via ApplicationContext.
> >
> > i'm trying this -
> >
> >        ApplicationContext ac = new
> > ClassPathXmlApplicationContext("META-INF/spring/camel_spring-ws.xml");
> > CamelContext context = ac.getBean("camel",CamelContext.class);
> >
> > Exchange myExchange = new DefaultExchange(context);
> > exchange.getIn().setBody("Hello");
> >
> > ProducerTemplate template = context.createProducerTemplate();
> > template.send("direct:start", myExchange);
> >
> > to invoke a router defined in camelContext.xml
> >
> >
> >
> > --
> > View this message in context:
> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722010.html
>
> > Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>
>
> --
> Krzysztof Sobkowiak
>
> JEE & OSS Architect | Senior Solution Architect @ Capgemini | Committer
> @ ASF
> Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
> <http://www.pl.capgemini-sdm.com/> | Wroclaw
> e-mail: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5722012&i=0> <mailto:[hidden
> email] <http:///user/SendEmail.jtp?type=node&node=5722012&i=1>> |
> Twitter: @KSobkowiak
> Calendar: http://goo.gl/yvsebC
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722012.html
>  To unsubscribe from The XML doesn't validates in ServiceMix, click here
> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5721993&code=bml0ZXNoamFpbjEzMkBnbWFpbC5jb218NTcyMTk5M3wxNTcxMDAyOTM2>
> .
> NAML
> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722013.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: The XML doesn't validates in ServiceMix

Posted by Krzysztof Sobkowiak <kr...@gmail.com>.
Hi

If you are in a Spring bean, you can just inject the CamelContext or the
ProducerTemplate into the Spring bean without retrieving the using
ApplicationContext.

Regards
Krzysztof

On 21.12.2014 06:50, niteshjain132 wrote:
> Context.xml is in the same bundle, 
> how can i access the beans without loading via ApplicationContext.
>
> i'm trying this -
>
>        ApplicationContext ac = new
> ClassPathXmlApplicationContext("META-INF/spring/camel_spring-ws.xml");
> 		CamelContext context = ac.getBean("camel",CamelContext.class);
>
> 		Exchange myExchange = new DefaultExchange(context);
> 		exchange.getIn().setBody("Hello");
> 		
> 		ProducerTemplate template = context.createProducerTemplate();
> 		template.send("direct:start", myExchange);
>
> to invoke a router defined in camelContext.xml
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722010.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


-- 
Krzysztof Sobkowiak

JEE & OSS Architect | Senior Solution Architect @ Capgemini | Committer
@ ASF
Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
<http://www.pl.capgemini-sdm.com/> | Wroclaw
e-mail: krzys.sobkowiak@gmail.com <ma...@gmail.com> |
Twitter: @KSobkowiak
Calendar: http://goo.gl/yvsebC

Re: The XML doesn't validates in ServiceMix

Posted by niteshjain132 <ni...@gmail.com>.
Context.xml is in the same bundle, 
how can i access the beans without loading via ApplicationContext.

i'm trying this -

       ApplicationContext ac = new
ClassPathXmlApplicationContext("META-INF/spring/camel_spring-ws.xml");
		CamelContext context = ac.getBean("camel",CamelContext.class);

		Exchange myExchange = new DefaultExchange(context);
		exchange.getIn().setBody("Hello");
		
		ProducerTemplate template = context.createProducerTemplate();
		template.send("direct:start", myExchange);

to invoke a router defined in camelContext.xml



--
View this message in context: http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722010.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: The XML doesn't validates in ServiceMix

Posted by niteshjain132 <ni...@gmail.com>.
can you please look at this

https://github.com/niteshjain132/CamelSpring-WS

Regards,
Nitesh

On 10:10PM, Sat, 20 Dec 2014 Gert Vanthienen [via ServiceMix] <
ml-node+s396122n5722007h3@n5.nabble.com> wrote:

> L.S.,
>
>
> If these other Spring files are already in the same bundle, you should
> be able to access the beans without having to load those files again
> from the classpath: they should be available for dependency injection
> in Spring, but you should also be able to find them through the Camel
> Registry.  If they're not, you should probably look into using the
> OSGi Service Registry for reusing those beans in another bundle.
>
> If you could share some (pseudo-)code of what the Processor is trying
> to do with the other route, we can probably provide you with some
> pointers on what the best solution for that would be in an OSGi
> bundle.
>
>
> Regards,
>
> Gert Vanthienen
>
>
> On Sat, Dec 20, 2014 at 8:59 AM, niteshjain132 <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5722007&i=0>> wrote:
>
> > Agreed, But my scenario is - invoking a specific router defined in camel
> > context.xml (which is under META-INF/spring ) from a Processor.
> > Thats why I was tring to create ApplicationContext and call a router but
> I
> > get SAXParseException when deployed in server, whereas runs like a charm
> in
> > eclipse.
> >
> > On 6:49PM, Fri, 19 Dec 2014 Gert Vanthienen [via ServiceMix] <
> > [hidden email] <http:///user/SendEmail.jtp?type=node&node=5722007&i=1>>
> wrote:
> >
> >> L.S.,
> >>
> >>
> >> When deploying a Spring XML file in Apache ServiceMix, you should use
> >> the Spring extender instead of trying to create the Spring
> >> ApplicationContext yourself. The extender is aware of the OSGi
> >> environment and will take care of handling those namespace URI
> >> references correctly for you.
> >>
> >> This actually makes things a bit easier for you, because you only have
> >> to make sure the Spring XML files are in the META-INF/spring directory
> >> inside your bundle and the container will do the rest, cfr.
> >>
> >>
> http://servicemix.apache.org/docs/4.5.x/camel/deployment/osgi-bundle-spring.html
> >>
> >>
> >> Regards,
> >>
> >> Gert Vanthienen
> >>
> >>
> >> On Wed, Dec 17, 2014 at 12:00 PM, niteshjain132 <[hidden email]
> >> <http:///user/SendEmail.jtp?type=node&node=5722000&i=0>> wrote:
> >>
> >> > Runtime : ServiceMix 4.5
> >> >
> >> > XML validates in a XML Editor, but not in server (Jboss Fuse 6.0)
> >> >
> >> > Unable to parse the *camel_context.xml* when called from a java code
> as
> >> > below. i don't get any such error when i run in eclipse.
> >> >
> >> >
> >> > ApplicationContext ac = new
> >> > ClassPathXmlApplicationContext("*camel_context.xml*");
> >> >
> >> > CamelContext context = SpringCamelContext.springCamelContext(ac);
> >> >
> >> > *camel_context.xml:*
> >> >
> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> >> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> > xmlns:tool="http://www.springframework.org/schema/tool"
> >> >     xsi:schemaLocation="http://www.springframework.org/schema/beans
> >> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >> >             http://www.springframework.org/schema/tool
> >> > http://www.springframework.org/schema/tool/spring-tool-2.5.xsd">
> >> >     <bean id="testRoute"
> >> > class="com.hp.som.devicecapabilities.actions.TestRouter" />
> >> > </beans>
> >> >
> >> >
> >> > log:
> >> >
> >> > 2014-12-16 10:35:57,969 | INFO  | ClassPathXmlApplicationContext   |
> 128
> >> -
> >> > org.apache.servicemix.bundles.spring-context - 3.2.8.RELEASE_1 |
> >> Refreshing
> >> >
> >>
> org.springframework.context.support.ClassPathXmlApplicationContext@302d6c6e:
>
> >>
> >> > startup date [Tue Dec 16 10:35:57 IST 2014]; root of context
> hierarchy
> >> >
> >> > 2014-12-16 10:35:57,969 | INFO  | XmlBeanDefinitionReader          |
> 131
> >> -
> >> > org.apache.servicemix.bundles.spring-beans - 3.2.8.RELEASE_1 |
> Loading
> >> XML
> >> > bean definitions from class path resource [camel_context.xml]
> >> >
> >> > 2014-12-16 10:36:24,310 | WARN  | XmlBeanDefinitionReader          |
> 131
> >> -
> >> > org.apache.servicemix.bundles.spring-beans - 3.2.8.RELEASE_1 |
> Ignored
> >> XML
> >> > validation warning
> >> >
> >> > Caused by: org.xml.sax.SAXParseException: cvc-elt.1.a: Cannot find
> the
> >> > declaration of element 'beans'.
> >> >         at
> >> >
> >>
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> >> > Source)[:]
> >> >         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
> >> > Source)[:]
> >> >         at
> org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> >> > Source)[:]
> >> >         at
> org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> >> > Source)[:]
> >> >         at
> org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> >> > Source)[:]
> >> >         at
> >> >
> org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
> >> > Source)[:]
> >> >         at
> >> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
> >> > Source)[:]
> >> >         at
> >> >
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> >> > Source)[:]
> >> >         at
> >> >
> >>
> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
>
> >>
> >> > Source)[:]
> >> >         at
> >> >
> >>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
>
> >>
> >> > Source)[:]
> >> >         at
> >> >
> >>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> >> > Source)[:]
> >> >         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> >> > Source)[:]
> >> >         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> >> > Source)[:]
> >> >         at org.apache.xerces.parsers.XMLParser.parse(Unknown
> Source)[:]
> >> >         at org.apache.xerces.parsers.DOMParser.parse(Unknown
> Source)[:]
> >> >         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
> >> > Source)[:]
> >> >         at
> >> >
> >>
> org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)[131:org.apache.servicemix.bundles.spring-beans:3.2.8.RELEASE_1]
>
> >>
> >> >         at
> >> >
> >>
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)[131:org.apache.servicemix.bundles.spring-beans:3.2.8.RELEASE_1]
>
> >>
> >> >
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >>
> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993.html
> >> > Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
> >>  Regards,
> >>
> >> Gert Vanthienen
> >> ------------------------
> >> Open Source SOA: http://fusesource.com
> >> Blog: http://gertvanthienen.blogspot.com/
> >>
> >>
> >> ------------------------------
> >>  If you reply to this email, your message will be added to the
> discussion
> >> below:
> >>
> >>
> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722000.html
> >>  To unsubscribe from The XML doesn't validates in ServiceMix, click
> here
> >> <
>
> >> .
> >> NAML
> >> <
> http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
> >>
> >
> >
> >
> >
> > --
> > View this message in context:
> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722005.html
>
> > Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>  Regards,
>
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722007.html
>  To unsubscribe from The XML doesn't validates in ServiceMix, click here
> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5721993&code=bml0ZXNoamFpbjEzMkBnbWFpbC5jb218NTcyMTk5M3wxNTcxMDAyOTM2>
> .
> NAML
> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722009.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: The XML doesn't validates in ServiceMix

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,


If these other Spring files are already in the same bundle, you should
be able to access the beans without having to load those files again
from the classpath: they should be available for dependency injection
in Spring, but you should also be able to find them through the Camel
Registry.  If they're not, you should probably look into using the
OSGi Service Registry for reusing those beans in another bundle.

If you could share some (pseudo-)code of what the Processor is trying
to do with the other route, we can probably provide you with some
pointers on what the best solution for that would be in an OSGi
bundle.


Regards,

Gert Vanthienen


On Sat, Dec 20, 2014 at 8:59 AM, niteshjain132 <ni...@gmail.com> wrote:
> Agreed, But my scenario is - invoking a specific router defined in camel
> context.xml (which is under META-INF/spring ) from a Processor.
> Thats why I was tring to create ApplicationContext and call a router but I
> get SAXParseException when deployed in server, whereas runs like a charm in
> eclipse.
>
> On 6:49PM, Fri, 19 Dec 2014 Gert Vanthienen [via ServiceMix] <
> ml-node+s396122n5722000h86@n5.nabble.com> wrote:
>
>> L.S.,
>>
>>
>> When deploying a Spring XML file in Apache ServiceMix, you should use
>> the Spring extender instead of trying to create the Spring
>> ApplicationContext yourself. The extender is aware of the OSGi
>> environment and will take care of handling those namespace URI
>> references correctly for you.
>>
>> This actually makes things a bit easier for you, because you only have
>> to make sure the Spring XML files are in the META-INF/spring directory
>> inside your bundle and the container will do the rest, cfr.
>>
>> http://servicemix.apache.org/docs/4.5.x/camel/deployment/osgi-bundle-spring.html
>>
>>
>> Regards,
>>
>> Gert Vanthienen
>>
>>
>> On Wed, Dec 17, 2014 at 12:00 PM, niteshjain132 <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=5722000&i=0>> wrote:
>>
>> > Runtime : ServiceMix 4.5
>> >
>> > XML validates in a XML Editor, but not in server (Jboss Fuse 6.0)
>> >
>> > Unable to parse the *camel_context.xml* when called from a java code as
>> > below. i don't get any such error when i run in eclipse.
>> >
>> >
>> > ApplicationContext ac = new
>> > ClassPathXmlApplicationContext("*camel_context.xml*");
>> >
>> > CamelContext context = SpringCamelContext.springCamelContext(ac);
>> >
>> > *camel_context.xml:*
>> >
>> > <beans xmlns="http://www.springframework.org/schema/beans"
>> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > xmlns:tool="http://www.springframework.org/schema/tool"
>> >     xsi:schemaLocation="http://www.springframework.org/schema/beans
>> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>> >             http://www.springframework.org/schema/tool
>> > http://www.springframework.org/schema/tool/spring-tool-2.5.xsd">
>> >     <bean id="testRoute"
>> > class="com.hp.som.devicecapabilities.actions.TestRouter" />
>> > </beans>
>> >
>> >
>> > log:
>> >
>> > 2014-12-16 10:35:57,969 | INFO  | ClassPathXmlApplicationContext   | 128
>> -
>> > org.apache.servicemix.bundles.spring-context - 3.2.8.RELEASE_1 |
>> Refreshing
>> >
>> org.springframework.context.support.ClassPathXmlApplicationContext@302d6c6e:
>>
>> > startup date [Tue Dec 16 10:35:57 IST 2014]; root of context hierarchy
>> >
>> > 2014-12-16 10:35:57,969 | INFO  | XmlBeanDefinitionReader          | 131
>> -
>> > org.apache.servicemix.bundles.spring-beans - 3.2.8.RELEASE_1 | Loading
>> XML
>> > bean definitions from class path resource [camel_context.xml]
>> >
>> > 2014-12-16 10:36:24,310 | WARN  | XmlBeanDefinitionReader          | 131
>> -
>> > org.apache.servicemix.bundles.spring-beans - 3.2.8.RELEASE_1 | Ignored
>> XML
>> > validation warning
>> >
>> > Caused by: org.xml.sax.SAXParseException: cvc-elt.1.a: Cannot find the
>> > declaration of element 'beans'.
>> >         at
>> >
>> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
>> > Source)[:]
>> >         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
>> > Source)[:]
>> >         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
>> > Source)[:]
>> >         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
>> > Source)[:]
>> >         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
>> > Source)[:]
>> >         at
>> > org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
>> > Source)[:]
>> >         at
>> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
>> > Source)[:]
>> >         at
>> > org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
>> > Source)[:]
>> >         at
>> >
>> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
>>
>> > Source)[:]
>> >         at
>> >
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
>>
>> > Source)[:]
>> >         at
>> >
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
>> > Source)[:]
>> >         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
>> > Source)[:]
>> >         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
>> > Source)[:]
>> >         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)[:]
>> >         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)[:]
>> >         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
>> > Source)[:]
>> >         at
>> >
>> org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)[131:org.apache.servicemix.bundles.spring-beans:3.2.8.RELEASE_1]
>>
>> >         at
>> >
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)[131:org.apache.servicemix.bundles.spring-beans:3.2.8.RELEASE_1]
>>
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993.html
>> > Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>>  Regards,
>>
>> Gert Vanthienen
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722000.html
>>  To unsubscribe from The XML doesn't validates in ServiceMix, click here
>> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5721993&code=bml0ZXNoamFpbjEzMkBnbWFpbC5jb218NTcyMTk5M3wxNTcxMDAyOTM2>
>> .
>> NAML
>> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722005.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: The XML doesn't validates in ServiceMix

Posted by niteshjain132 <ni...@gmail.com>.
Agreed, But my scenario is - invoking a specific router defined in camel
context.xml (which is under META-INF/spring ) from a Processor.
Thats why I was tring to create ApplicationContext and call a router but I
get SAXParseException when deployed in server, whereas runs like a charm in
eclipse.

On 6:49PM, Fri, 19 Dec 2014 Gert Vanthienen [via ServiceMix] <
ml-node+s396122n5722000h86@n5.nabble.com> wrote:

> L.S.,
>
>
> When deploying a Spring XML file in Apache ServiceMix, you should use
> the Spring extender instead of trying to create the Spring
> ApplicationContext yourself. The extender is aware of the OSGi
> environment and will take care of handling those namespace URI
> references correctly for you.
>
> This actually makes things a bit easier for you, because you only have
> to make sure the Spring XML files are in the META-INF/spring directory
> inside your bundle and the container will do the rest, cfr.
>
> http://servicemix.apache.org/docs/4.5.x/camel/deployment/osgi-bundle-spring.html
>
>
> Regards,
>
> Gert Vanthienen
>
>
> On Wed, Dec 17, 2014 at 12:00 PM, niteshjain132 <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5722000&i=0>> wrote:
>
> > Runtime : ServiceMix 4.5
> >
> > XML validates in a XML Editor, but not in server (Jboss Fuse 6.0)
> >
> > Unable to parse the *camel_context.xml* when called from a java code as
> > below. i don't get any such error when i run in eclipse.
> >
> >
> > ApplicationContext ac = new
> > ClassPathXmlApplicationContext("*camel_context.xml*");
> >
> > CamelContext context = SpringCamelContext.springCamelContext(ac);
> >
> > *camel_context.xml:*
> >
> > <beans xmlns="http://www.springframework.org/schema/beans"
> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:tool="http://www.springframework.org/schema/tool"
> >     xsi:schemaLocation="http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >             http://www.springframework.org/schema/tool
> > http://www.springframework.org/schema/tool/spring-tool-2.5.xsd">
> >     <bean id="testRoute"
> > class="com.hp.som.devicecapabilities.actions.TestRouter" />
> > </beans>
> >
> >
> > log:
> >
> > 2014-12-16 10:35:57,969 | INFO  | ClassPathXmlApplicationContext   | 128
> -
> > org.apache.servicemix.bundles.spring-context - 3.2.8.RELEASE_1 |
> Refreshing
> >
> org.springframework.context.support.ClassPathXmlApplicationContext@302d6c6e:
>
> > startup date [Tue Dec 16 10:35:57 IST 2014]; root of context hierarchy
> >
> > 2014-12-16 10:35:57,969 | INFO  | XmlBeanDefinitionReader          | 131
> -
> > org.apache.servicemix.bundles.spring-beans - 3.2.8.RELEASE_1 | Loading
> XML
> > bean definitions from class path resource [camel_context.xml]
> >
> > 2014-12-16 10:36:24,310 | WARN  | XmlBeanDefinitionReader          | 131
> -
> > org.apache.servicemix.bundles.spring-beans - 3.2.8.RELEASE_1 | Ignored
> XML
> > validation warning
> >
> > Caused by: org.xml.sax.SAXParseException: cvc-elt.1.a: Cannot find the
> > declaration of element 'beans'.
> >         at
> >
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> > Source)[:]
> >         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
> > Source)[:]
> >         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> > Source)[:]
> >         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> > Source)[:]
> >         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> > Source)[:]
> >         at
> > org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
> > Source)[:]
> >         at
> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
> > Source)[:]
> >         at
> > org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> > Source)[:]
> >         at
> >
> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
>
> > Source)[:]
> >         at
> >
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
>
> > Source)[:]
> >         at
> >
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> > Source)[:]
> >         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> > Source)[:]
> >         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> > Source)[:]
> >         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)[:]
> >         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)[:]
> >         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
> > Source)[:]
> >         at
> >
> org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)[131:org.apache.servicemix.bundles.spring-beans:3.2.8.RELEASE_1]
>
> >         at
> >
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)[131:org.apache.servicemix.bundles.spring-beans:3.2.8.RELEASE_1]
>
> >
> >
> >
> > --
> > View this message in context:
> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993.html
> > Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>  Regards,
>
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722000.html
>  To unsubscribe from The XML doesn't validates in ServiceMix, click here
> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5721993&code=bml0ZXNoamFpbjEzMkBnbWFpbC5jb218NTcyMTk5M3wxNTcxMDAyOTM2>
> .
> NAML
> <http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993p5722005.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: The XML doesn't validates in ServiceMix

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,


When deploying a Spring XML file in Apache ServiceMix, you should use
the Spring extender instead of trying to create the Spring
ApplicationContext yourself. The extender is aware of the OSGi
environment and will take care of handling those namespace URI
references correctly for you.

This actually makes things a bit easier for you, because you only have
to make sure the Spring XML files are in the META-INF/spring directory
inside your bundle and the container will do the rest, cfr.
http://servicemix.apache.org/docs/4.5.x/camel/deployment/osgi-bundle-spring.html


Regards,

Gert Vanthienen


On Wed, Dec 17, 2014 at 12:00 PM, niteshjain132 <ni...@gmail.com> wrote:
> Runtime : ServiceMix 4.5
>
> XML validates in a XML Editor, but not in server (Jboss Fuse 6.0)
>
> Unable to parse the *camel_context.xml* when called from a java code as
> below. i don't get any such error when i run in eclipse.
>
>
> ApplicationContext ac = new
> ClassPathXmlApplicationContext("*camel_context.xml*");
>
> CamelContext context = SpringCamelContext.springCamelContext(ac);
>
> *camel_context.xml:*
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:tool="http://www.springframework.org/schema/tool"
>     xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>             http://www.springframework.org/schema/tool
> http://www.springframework.org/schema/tool/spring-tool-2.5.xsd">
>     <bean id="testRoute"
> class="com.hp.som.devicecapabilities.actions.TestRouter" />
> </beans>
>
>
> log:
>
> 2014-12-16 10:35:57,969 | INFO  | ClassPathXmlApplicationContext   | 128 -
> org.apache.servicemix.bundles.spring-context - 3.2.8.RELEASE_1 | Refreshing
> org.springframework.context.support.ClassPathXmlApplicationContext@302d6c6e:
> startup date [Tue Dec 16 10:35:57 IST 2014]; root of context hierarchy
>
> 2014-12-16 10:35:57,969 | INFO  | XmlBeanDefinitionReader          | 131 -
> org.apache.servicemix.bundles.spring-beans - 3.2.8.RELEASE_1 | Loading XML
> bean definitions from class path resource [camel_context.xml]
>
> 2014-12-16 10:36:24,310 | WARN  | XmlBeanDefinitionReader          | 131 -
> org.apache.servicemix.bundles.spring-beans - 3.2.8.RELEASE_1 | Ignored XML
> validation warning
>
> Caused by: org.xml.sax.SAXParseException: cvc-elt.1.a: Cannot find the
> declaration of element 'beans'.
>         at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> Source)[:]
>         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
> Source)[:]
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)[:]
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)[:]
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)[:]
>         at
> org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
> Source)[:]
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
> Source)[:]
>         at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source)[:]
>         at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
> Source)[:]
>         at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)[:]
>         at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)[:]
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)[:]
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)[:]
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)[:]
>         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)[:]
>         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
> Source)[:]
>         at
> org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)[131:org.apache.servicemix.bundles.spring-beans:3.2.8.RELEASE_1]
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)[131:org.apache.servicemix.bundles.spring-beans:3.2.8.RELEASE_1]
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/The-XML-doesn-t-validates-in-ServiceMix-tp5721993.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.