You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by chevy <ch...@target.com> on 2016/08/09 14:39:46 UTC

IgniteException on starting node from Jar

Hi,

 When I start ignite node from my eclipse IDE it starts without any issues
but when I export my code to jar and execute the code, I get below mentioned
error. I am using same config even when I am running directly from IDE.

Error:

Exception in thread "main" class org.apache.ignite.IgniteException: Failed
to instantiate Spring XML application context
[springUrl=file:/opt/ignite/apache-ignite-fabric-1.6.0-bin/config/mpm-ignite.xml,
err=Line 9 in XML document from URL
[file:/opt/ignite/apache-ignite-fabric-1.6.0-bin/config/mpm-ignite.xml] is
invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 9;
columnNumber: 72; cvc-elt.1: Cannot find the declaration of element
'beans'.]


Config:

<?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.xsd">
    
    <import resource="mpm-default.xml"/>

    <bean parent="ignite.cfg"/>
</beans>




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: IgniteException on starting node from Jar

Posted by vkulichenko <va...@gmail.com>.
chevy wrote
> So, when I run it from eclipse it picks this config path but from jar it
> refers to IGNITE_HOME which I want to avoid.

You can put the config file into the JAR under META-INF folder (instead of
IGNITE_HOME). Will this work for you?

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6936.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: IgniteException on starting node from Jar

Posted by Alisher Alimov <al...@gmail.com>.
Could you provide project example or jar file and command how you run it  to reproduce problem?


With best regards
Alisher Alimov
alimovalisher@gmail.com




> On 10 авг. 2016 г., at 14:32, chevy <ch...@target.com> wrote:
> 
> I am not using complete path to my config. The example you have provided is
> to start node externally. I am starting node by using ->
> Ignition.start("config/mpm-ignite.xml”); where config folder (which is also
> a source folder holds xml files) is directly under my project folder.
> 
> So, when I run it from eclipse it picks this config path but from jar it
> refers to IGNITE_HOME which I want to avoid.
> 
> 
> 
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6921.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: IgniteException on starting node from Jar

Posted by chevy <ch...@target.com>.
I am not using complete path to my config. The example you have provided is
to start node externally. I am starting node by using ->
Ignition.start("config/mpm-ignite.xml”); where config folder (which is also
a source folder holds xml files) is directly under my project folder.

So, when I run it from eclipse it picks this config path but from jar it
refers to IGNITE_HOME which I want to avoid.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6921.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: IgniteException on starting node from Jar

Posted by Alisher Alimov <al...@gmail.com>.
Ok, I understand.

Seems that when you are running  application you specify full path to mpm-ignite.xml, in mpm-ignite.xml defined not absolute path to mpm-default.xml and thats why Spring can’t locate resource, you must specify full path to mpm-default.xml or place configuration files in resources directory and use relative path

Please read more about passing configuration file to Ignite here: https://apacheignite.readme.io/docs/getting-started#section-passing-configuration-file

With best regards
Alisher Alimov
alimovalisher@gmail.com




> On 10 авг. 2016 г., at 13:30, chevy <ch...@target.com> wrote:
> 
> I am using just the config and I think the details provided by ignite.sh are
> provided by ignite maven dependences. When I run through my ide it just
> refers to config and performs node startup. Can I replicate similar behavior
> through my jar itself? Otherwise it points to xml which is available under
> IGNITE_HOME and not inside the jar.
> 
> 
> 
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6916.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: IgniteException on starting node from Jar

Posted by chevy <ch...@target.com>.
I am using just the config and I think the details provided by ignite.sh are
provided by ignite maven dependences. When I run through my ide it just
refers to config and performs node startup. Can I replicate similar behavior
through my jar itself? Otherwise it points to xml which is available under
IGNITE_HOME and not inside the jar.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6916.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: IgniteException on starting node from Jar

Posted by Alisher Alimov <al...@gmail.com>.
Hi!

I tried to reproduce your problem, but can't whether I try to run it from IDE or jar file. But at first time I didn’t pay attention that you are using apache-fabric, then I tried to change mpm-ignite.xm and provide not existing file name (<bean parent="ignite.cfg1"/>) and catch exception as you.  Seems that XmlBeanDefinitionReader can’t locate ignite.cfg file

Can you provide more details about how your try to startup application from JAR?


With best regards
Alisher Alimov
alimovalisher@gmail.com




> On 10 авг. 2016 г., at 8:20, chevy <ch...@target.com> wrote:
> 
> Please find the attached config files. It is working when I run my code from eclipse and not through jar.
> --
> Regards,
> Chetan.
> 
> From: "vkulichenko [via Apache Ignite Users]" <[hidden email] <x-msg://6/user/SendEmail.jtp?type=node&node=6908&i=0>>
> Date: Wednesday, August 10, 2016 at 4:53 AM
> To: "Chetan.V.Yadav" <[hidden email] <x-msg://6/user/SendEmail.jtp?type=node&node=6908&i=1>>
> Subject: Re: IgniteException on starting node from Jar
> 
> Hi,
> 
> Spring is used under the hood when you use Spring XML to configure Ignite. Please attach (not copy-paste to avoid mistakes) both mpm-default.xml and mpm-ignite.xml files and I will try to run with them.
> 
> -Val
> 
> If you reply to this email, your message will be added to the discussion below:
> http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6887.html <http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6887.html>
> To unsubscribe from IgniteException on starting node from Jar, click here <applewebdata://83563C47-17F6-4E39-9F80-6EF1BBC99A94>.
> NAML <http://apache-ignite-users.70518.x6.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>
> 
>  mpm-ignite.xml (732 bytes) Download Attachment <http://apache-ignite-users.70518.x6.nabble.com/attachment/6908/0/mpm-ignite.xml>
>  mpm-default.xml (4K) Download Attachment <http://apache-ignite-users.70518.x6.nabble.com/attachment/6908/1/mpm-default.xml>
> View this message in context: Re: IgniteException on starting node from Jar <http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6908.html>
> Sent from the Apache Ignite Users mailing list archive <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com.


Re: IgniteException on starting node from Jar

Posted by chevy <ch...@target.com>.
Please find the attached config files. It is working when I run my code from eclipse and not through jar.
--
Regards,
Chetan.

From: "vkulichenko [via Apache Ignite Users]" <ml...@n6.nabble.com>>
Date: Wednesday, August 10, 2016 at 4:53 AM
To: "Chetan.V.Yadav" <Ch...@target.com>>
Subject: Re: IgniteException on starting node from Jar

Hi,

Spring is used under the hood when you use Spring XML to configure Ignite. Please attach (not copy-paste to avoid mistakes) both mpm-default.xml and mpm-ignite.xml files and I will try to run with them.

-Val

________________________________
If you reply to this email, your message will be added to the discussion below:
http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6887.html
To unsubscribe from IgniteException on starting node from Jar, click here<http://apache-ignite-users.70518.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=6881&code=Y2hldGFuLnYueWFkYXZAdGFyZ2V0LmNvbXw2ODgxfC02OTIwMTYzODA=>.
NAML<http://apache-ignite-users.70518.x6.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>


mpm-ignite.xml (732 bytes) <http://apache-ignite-users.70518.x6.nabble.com/attachment/6908/0/mpm-ignite.xml>
mpm-default.xml (4K) <http://apache-ignite-users.70518.x6.nabble.com/attachment/6908/1/mpm-default.xml>




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6908.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: IgniteException on starting node from Jar

Posted by chevy <ch...@target.com>.
Please find the attached config files. It is working when I run my code from eclipse and not through jar.
--
Regards,
Chetan.

From: "vkulichenko [via Apache Ignite Users]" <ml...@n6.nabble.com>>
Date: Wednesday, August 10, 2016 at 4:53 AM
To: "Chetan.V.Yadav" <Ch...@target.com>>
Subject: Re: IgniteException on starting node from Jar

Hi,

Spring is used under the hood when you use Spring XML to configure Ignite. Please attach (not copy-paste to avoid mistakes) both mpm-default.xml and mpm-ignite.xml files and I will try to run with them.

-Val

________________________________
If you reply to this email, your message will be added to the discussion below:
http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6887.html
To unsubscribe from IgniteException on starting node from Jar, click here<http://apache-ignite-users.70518.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=6881&code=Y2hldGFuLnYueWFkYXZAdGFyZ2V0LmNvbXw2ODgxfC02OTIwMTYzODA=>.
NAML<http://apache-ignite-users.70518.x6.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://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6906.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: IgniteException on starting node from Jar

Posted by vkulichenko <va...@gmail.com>.
Hi,

Spring is used under the hood when you use Spring XML to configure Ignite.
Please attach (not copy-paste to avoid mistakes) both mpm-default.xml and
mpm-ignite.xml files and I will try to run with them.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6887.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: IgniteException on starting node from Jar

Posted by Vladislav Pyatkov <vl...@gmail.com>.
Hello,

If you do not use Spring, you can not use xml configuration.
Configure Ignite programmatically (through java code).
See here [1] on Java tab.
Also, look at the method
Ignition#start(org.apache.ignite.configuration.IgniteConfiguration)

[1]
https://apacheignite.readme.io/docs/clients-vs-servers#configuring-clients-and-servers


On Tue, Aug 9, 2016 at 6:15 PM, chevy <ch...@target.com> wrote:

> I am not using spring framework for my code and it is in plain Java. So, I
> do
> not have any spring version to specify explicitly. Also, how can i make my
> code use config inside jar rather than pick it from $IGNITE_HOME?
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/IgniteException-on-starting-
> node-from-Jar-tp6881p6883.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov

Re: IgniteException on starting node from Jar

Posted by chevy <ch...@target.com>.
I am not using spring framework for my code and it is in plain Java. So, I do
not have any spring version to specify explicitly. Also, how can i make my
code use config inside jar rather than pick it from $IGNITE_HOME?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881p6883.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: IgniteException on starting node from Jar

Posted by Alisher Alimov <al...@gmail.com>.
Hi!

Current problem doesn’t related to Ignite, I think that problem in spring, check your spring version and try to specify version of spring-beans schema directly (ex. spring-beans-3.1.xsd )


With best regards
Alisher Alimov
alimovalisher@gmail.com




> On 9 авг. 2016 г., at 17:39, chevy <ch...@target.com> wrote:
> 
> Hi,
> 
> When I start ignite node from my eclipse IDE it starts without any issues
> but when I export my code to jar and execute the code, I get below mentioned
> error. I am using same config even when I am running directly from IDE.
> 
> Error:
> 
> Exception in thread "main" class org.apache.ignite.IgniteException: Failed
> to instantiate Spring XML application context
> [springUrl=file:/opt/ignite/apache-ignite-fabric-1.6.0-bin/config/mpm-ignite.xml,
> err=Line 9 in XML document from URL
> [file:/opt/ignite/apache-ignite-fabric-1.6.0-bin/config/mpm-ignite.xml] is
> invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 9;
> columnNumber: 72; cvc-elt.1: Cannot find the declaration of element
> 'beans'.]
> 
> 
> Config:
> 
> <?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.xsd">
> 
>    <import resource="mpm-default.xml"/>
> 
>    <bean parent="ignite.cfg"/>
> </beans>
> 
> 
> 
> 
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteException-on-starting-node-from-Jar-tp6881.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.