You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Esther Parrilla Endrino <es...@deimos-space.com> on 2003/08/14 11:04:53 UTC

Xerces C++ and JNI

Hi all,

Well my question is related to Xerces and to JNI too, I apologize if 
maybe this is not the correst list to ask for...

I am doing and application in java that must use one class made in C++, 
this class calls Xerces C++ to validate files.
Everything is OK using JNI, but the only method that crashes is the one 
that calls Xerces... :(

It crashes when it executes:
	 parser->parse(xmlFile);

I have checked that the file name is read ok in the C++ class from the 
java application but when in this C++ class I try to parse the file it 
crashes...

Does someone found the same error somewhere?
Do you know a debugging tool that I can use with JNI?

Thanks in advance,

esther

-- 
Esther Parrilla Endrino
Ground Segment Systems Division
DEIMOS SPACE S.L. http://www.deimos-space.com
e-mail: esther.parrilla@deimos-space.com
tel:    00 34 91 806 34 57

~ Code matters more than comercials ~

--


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Xerces C++ and JNI

Posted by Esther Parrilla Endrino <es...@deimos-space.com>.
Hi!

Yes, I am using j2sdk 1.4 and this is a constrain in my project so I 
cannot change it... and my platform is Linux Red Hat 7.3...

esther

Miroslaw Dobrzanski-Neumann wrote:
> On Thu, Aug 14, 2003 at 11:04:53AM +0200, Esther Parrilla Endrino wrote:
> 
>>Hi all,
>>
>>Well my question is related to Xerces and to JNI too, I apologize if 
>>maybe this is not the correst list to ask for...
>>
>>I am doing and application in java that must use one class made in C++, 
>>this class calls Xerces C++ to validate files.
>>Everything is OK using JNI, but the only method that crashes is the one 
>>that calls Xerces... :(
>>
>>It crashes when it executes:
>>	 parser->parse(xmlFile);
>>
>>I have checked that the file name is read ok in the C++ class from the 
>>java application but when in this C++ class I try to parse the file it 
>>crashes...
>>
>>Does someone found the same error somewhere?
>>Do you know a debugging tool that I can use with JNI?
>>
>>Thanks in advance,
>>
>>esther
> 
> 
> Do you use SUN JVM under Linux?
> if so switch to IBM's one
> 
> 	Mirosław



-- 
Esther Parrilla Endrino
Ground Segment Systems Division
DEIMOS SPACE S.L. http://www.deimos-space.com
e-mail: esther.parrilla@deimos-space.com
tel:    00 34 91 806 34 57

~ Code matters more than comercials ~

--


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Xerces C++ and JNI

Posted by Miroslaw Dobrzanski-Neumann <mn...@mosaic-ag.com>.
On Thu, Aug 14, 2003 at 11:04:53AM +0200, Esther Parrilla Endrino wrote:
> Hi all,
> 
> Well my question is related to Xerces and to JNI too, I apologize if 
> maybe this is not the correst list to ask for...
> 
> I am doing and application in java that must use one class made in C++, 
> this class calls Xerces C++ to validate files.
> Everything is OK using JNI, but the only method that crashes is the one 
> that calls Xerces... :(
> 
> It crashes when it executes:
> 	 parser->parse(xmlFile);
> 
> I have checked that the file name is read ok in the C++ class from the 
> java application but when in this C++ class I try to parse the file it 
> crashes...
> 
> Does someone found the same error somewhere?
> Do you know a debugging tool that I can use with JNI?
> 
> Thanks in advance,
> 
> esther

Do you use SUN JVM under Linux?
if so switch to IBM's one

	Mirosław
-- 
Mirosław Dobrzański-Neumann
E-mail: mne@mosaic-ag.com

This message is utf-8 encoded

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: Xerces C++ and JNI

Posted by Peter Guyatt <pg...@telesoft-technologies.com>.
Hi,

	Just a thought but are you pointing the JVM at the xerces library as well
as the library that calls the Xerces library ?

Thanks

Pete

-----Original Message-----
From: Esther Parrilla Endrino [mailto:esther.parrilla@deimos-space.com]
Sent: 14 August 2003 11:20
To: xerces-c-dev@xml.apache.org
Subject: Re: Xerces C++ and JNI


I do not use Java parser because I have to link with this C++ API which
is the one that calls Xerces.

Peter Guyatt wrote:
> Hi,
>
> 	Why dont you use the Xerces java parser ?
>
> Pete
>
> -----Original Message-----
> From: Esther Parrilla Endrino [mailto:esther.parrilla@deimos-space.com]
> Sent: 14 August 2003 11:00
> To: xerces-c-dev@xml.apache.org
> Subject: Re: Xerces C++ and JNI
>
>
> Hi Pete,
>
> yes I am doing:
>
>      // Initialize the XML4C system
>      try {
>          XMLPlatformUtils::Initialize();
>      }
>      catch (const XMLException& toCatch) {
>
>           cerr << "Error during initialization! :\n"
>                << StrX(toCatch.getMessage()) << endl;
>      }
>
> and at the end:
>
> 	XMLPlatformUtils::Terminate();
>
> Thanks anyway, I cannot understand why it crashes as I have called the
> C++ class from a C library and it works fine!!!
>
> esther
>
>
> Peter Guyatt wrote:
>
>>Hi,
>>
>>	This may sound like a stupid comment to make but have you initialised the
>>Xerces library by using the XMLPlatformUtils::Initialize(); method ?
>>
>>if the class with the JNI interface is not in a thread that keeps a
>
> constant
>
>>handle on the library, it will be garbage collected, so you would need to
>>initialize and terminate the Xerces library every time you call the native
>>method.
>>
>>Thanks
>>
>>Pete
>>
>>
>>
>>-----Original Message-----
>>From: Esther Parrilla Endrino [mailto:esther.parrilla@deimos-space.com]
>>Sent: 14 August 2003 10:05
>>To: xerces-c-dev@xml.apache.org
>>Subject: Xerces C++ and JNI
>>
>>
>>Hi all,
>>
>>Well my question is related to Xerces and to JNI too, I apologize if
>>maybe this is not the correst list to ask for...
>>
>>I am doing and application in java that must use one class made in C++,
>>this class calls Xerces C++ to validate files.
>>Everything is OK using JNI, but the only method that crashes is the one
>>that calls Xerces... :(
>>
>>It crashes when it executes:
>>	 parser->parse(xmlFile);
>>
>>I have checked that the file name is read ok in the C++ class from the
>>java application but when in this C++ class I try to parse the file it
>>crashes...
>>
>>Does someone found the same error somewhere?
>>Do you know a debugging tool that I can use with JNI?
>>
>>Thanks in advance,
>>
>>esther
>>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>



--
Esther Parrilla Endrino
Ground Segment Systems Division
DEIMOS SPACE S.L. http://www.deimos-space.com
e-mail: esther.parrilla@deimos-space.com
tel:    00 34 91 806 34 57

~ Code matters more than comercials ~

--


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Xerces C++ and JNI

Posted by Esther Parrilla Endrino <es...@deimos-space.com>.
I do not use Java parser because I have to link with this C++ API which 
is the one that calls Xerces.

Peter Guyatt wrote:
> Hi,
> 
> 	Why dont you use the Xerces java parser ?
> 
> Pete
> 
> -----Original Message-----
> From: Esther Parrilla Endrino [mailto:esther.parrilla@deimos-space.com]
> Sent: 14 August 2003 11:00
> To: xerces-c-dev@xml.apache.org
> Subject: Re: Xerces C++ and JNI
> 
> 
> Hi Pete,
> 
> yes I am doing:
> 
>      // Initialize the XML4C system
>      try {
>          XMLPlatformUtils::Initialize();
>      }
>      catch (const XMLException& toCatch) {
> 
>           cerr << "Error during initialization! :\n"
>                << StrX(toCatch.getMessage()) << endl;
>      }
> 
> and at the end:
> 
> 	XMLPlatformUtils::Terminate();
> 
> Thanks anyway, I cannot understand why it crashes as I have called the
> C++ class from a C library and it works fine!!!
> 
> esther
> 
> 
> Peter Guyatt wrote:
> 
>>Hi,
>>
>>	This may sound like a stupid comment to make but have you initialised the
>>Xerces library by using the XMLPlatformUtils::Initialize(); method ?
>>
>>if the class with the JNI interface is not in a thread that keeps a
> 
> constant
> 
>>handle on the library, it will be garbage collected, so you would need to
>>initialize and terminate the Xerces library every time you call the native
>>method.
>>
>>Thanks
>>
>>Pete
>>
>>
>>
>>-----Original Message-----
>>From: Esther Parrilla Endrino [mailto:esther.parrilla@deimos-space.com]
>>Sent: 14 August 2003 10:05
>>To: xerces-c-dev@xml.apache.org
>>Subject: Xerces C++ and JNI
>>
>>
>>Hi all,
>>
>>Well my question is related to Xerces and to JNI too, I apologize if
>>maybe this is not the correst list to ask for...
>>
>>I am doing and application in java that must use one class made in C++,
>>this class calls Xerces C++ to validate files.
>>Everything is OK using JNI, but the only method that crashes is the one
>>that calls Xerces... :(
>>
>>It crashes when it executes:
>>	 parser->parse(xmlFile);
>>
>>I have checked that the file name is read ok in the C++ class from the
>>java application but when in this C++ class I try to parse the file it
>>crashes...
>>
>>Does someone found the same error somewhere?
>>Do you know a debugging tool that I can use with JNI?
>>
>>Thanks in advance,
>>
>>esther
>>
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 



-- 
Esther Parrilla Endrino
Ground Segment Systems Division
DEIMOS SPACE S.L. http://www.deimos-space.com
e-mail: esther.parrilla@deimos-space.com
tel:    00 34 91 806 34 57

~ Code matters more than comercials ~

--


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: Xerces C++ and JNI

Posted by Peter Guyatt <pg...@telesoft-technologies.com>.
Hi,

	Why dont you use the Xerces java parser ?

Pete

-----Original Message-----
From: Esther Parrilla Endrino [mailto:esther.parrilla@deimos-space.com]
Sent: 14 August 2003 11:00
To: xerces-c-dev@xml.apache.org
Subject: Re: Xerces C++ and JNI


Hi Pete,

yes I am doing:

     // Initialize the XML4C system
     try {
         XMLPlatformUtils::Initialize();
     }
     catch (const XMLException& toCatch) {

          cerr << "Error during initialization! :\n"
               << StrX(toCatch.getMessage()) << endl;
     }

and at the end:

	XMLPlatformUtils::Terminate();

Thanks anyway, I cannot understand why it crashes as I have called the
C++ class from a C library and it works fine!!!

esther


Peter Guyatt wrote:
> Hi,
>
> 	This may sound like a stupid comment to make but have you initialised the
> Xerces library by using the XMLPlatformUtils::Initialize(); method ?
>
> if the class with the JNI interface is not in a thread that keeps a
constant
> handle on the library, it will be garbage collected, so you would need to
> initialize and terminate the Xerces library every time you call the native
> method.
>
> Thanks
>
> Pete
>
>
>
> -----Original Message-----
> From: Esther Parrilla Endrino [mailto:esther.parrilla@deimos-space.com]
> Sent: 14 August 2003 10:05
> To: xerces-c-dev@xml.apache.org
> Subject: Xerces C++ and JNI
>
>
> Hi all,
>
> Well my question is related to Xerces and to JNI too, I apologize if
> maybe this is not the correst list to ask for...
>
> I am doing and application in java that must use one class made in C++,
> this class calls Xerces C++ to validate files.
> Everything is OK using JNI, but the only method that crashes is the one
> that calls Xerces... :(
>
> It crashes when it executes:
> 	 parser->parse(xmlFile);
>
> I have checked that the file name is read ok in the C++ class from the
> java application but when in this C++ class I try to parse the file it
> crashes...
>
> Does someone found the same error somewhere?
> Do you know a debugging tool that I can use with JNI?
>
> Thanks in advance,
>
> esther
>





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Xerces C++ and JNI

Posted by Esther Parrilla Endrino <es...@deimos-space.com>.
Hi Pete,

yes I am doing:

     // Initialize the XML4C system
     try {
         XMLPlatformUtils::Initialize();
     }
     catch (const XMLException& toCatch) {

          cerr << "Error during initialization! :\n"
               << StrX(toCatch.getMessage()) << endl;
     }

and at the end:

	XMLPlatformUtils::Terminate();

Thanks anyway, I cannot understand why it crashes as I have called the 
C++ class from a C library and it works fine!!!

esther


Peter Guyatt wrote:
> Hi,
> 
> 	This may sound like a stupid comment to make but have you initialised the
> Xerces library by using the XMLPlatformUtils::Initialize(); method ?
> 
> if the class with the JNI interface is not in a thread that keeps a constant
> handle on the library, it will be garbage collected, so you would need to
> initialize and terminate the Xerces library every time you call the native
> method.
> 
> Thanks
> 
> Pete
> 
> 
> 
> -----Original Message-----
> From: Esther Parrilla Endrino [mailto:esther.parrilla@deimos-space.com]
> Sent: 14 August 2003 10:05
> To: xerces-c-dev@xml.apache.org
> Subject: Xerces C++ and JNI
> 
> 
> Hi all,
> 
> Well my question is related to Xerces and to JNI too, I apologize if
> maybe this is not the correst list to ask for...
> 
> I am doing and application in java that must use one class made in C++,
> this class calls Xerces C++ to validate files.
> Everything is OK using JNI, but the only method that crashes is the one
> that calls Xerces... :(
> 
> It crashes when it executes:
> 	 parser->parse(xmlFile);
> 
> I have checked that the file name is read ok in the C++ class from the
> java application but when in this C++ class I try to parse the file it
> crashes...
> 
> Does someone found the same error somewhere?
> Do you know a debugging tool that I can use with JNI?
> 
> Thanks in advance,
> 
> esther
> 





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: Xerces C++ and JNI

Posted by Peter Guyatt <pg...@telesoft-technologies.com>.
Hi,

	This may sound like a stupid comment to make but have you initialised the
Xerces library by using the XMLPlatformUtils::Initialize(); method ?

if the class with the JNI interface is not in a thread that keeps a constant
handle on the library, it will be garbage collected, so you would need to
initialize and terminate the Xerces library every time you call the native
method.

Thanks

Pete



-----Original Message-----
From: Esther Parrilla Endrino [mailto:esther.parrilla@deimos-space.com]
Sent: 14 August 2003 10:05
To: xerces-c-dev@xml.apache.org
Subject: Xerces C++ and JNI


Hi all,

Well my question is related to Xerces and to JNI too, I apologize if
maybe this is not the correst list to ask for...

I am doing and application in java that must use one class made in C++,
this class calls Xerces C++ to validate files.
Everything is OK using JNI, but the only method that crashes is the one
that calls Xerces... :(

It crashes when it executes:
	 parser->parse(xmlFile);

I have checked that the file name is read ok in the C++ class from the
java application but when in this C++ class I try to parse the file it
crashes...

Does someone found the same error somewhere?
Do you know a debugging tool that I can use with JNI?

Thanks in advance,

esther

--
Esther Parrilla Endrino
Ground Segment Systems Division
DEIMOS SPACE S.L. http://www.deimos-space.com
e-mail: esther.parrilla@deimos-space.com
tel:    00 34 91 806 34 57

~ Code matters more than comercials ~

--


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org