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 Andrew Ferayorni <An...@onsemi.com> on 2002/07/24 18:38:03 UTC

Problem with JNI and Xerces-c

I have a SOAP service written in Java that uses JNI to use a C++ shared
object library.  My C++ library contains classes that build and validate
XML reports using the Xerces C++ package.  The problem I am encountering
is only when I try to use the library via JNI.  I have run the C++ code
standalone and it works great, however when I try to use it via JNI from
a Java application I get the following error:

[
An unexpected exception has been detected in native code outside the VM.

Unexpected Signal : 11 occurred at PC=0x405C44FA
Function=__cplus_type_matcher+0x1A
Library=/usr/lib/libstdc++-libc6.1-1.so.2

Current Java thread:
        at DataAccess.getFetData(Native Method)
        at DataAccess.getData(DataAccess.java:81)
        at DataAccess.main(DataAccess.java:107)
]


  I was able to debug the application, and traced the problem to be
related to handling the DTD used in validating my XML reports.  It seems
that when Xerces finds a problem with the DTD, it is throwing an
exception, which in turn causes the signal 11 to be sent. In fact, I was
able to determine that WHENEVER Xerces throws an exception (while
parsing an XML document) it sends the signal.  The signal is aborting
the application.

  Has anyone run into this problem with JNI and Xerces-C++?  I would
greatly appreciate your thoughts and suggestions on this matter.


I am using Xerces-c v1.8, with Java 1.4

Thank you,
Andrew


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


Re: Problem with JNI and Xerces-c

Posted by Miroslaw Dobrzanski-Neumann <mn...@mosaic-ag.com>.
On Wed, Jul 24, 2002 at 09:38:03AM -0700, Andrew Ferayorni wrote:
> 
> I have a SOAP service written in Java that uses JNI to use a C++ shared
> object library.  My C++ library contains classes that build and validate
> XML reports using the Xerces C++ package.  The problem I am encountering
> is only when I try to use the library via JNI.  I have run the C++ code
> standalone and it works great, however when I try to use it via JNI from
> a Java application I get the following error:
> 
> [
> An unexpected exception has been detected in native code outside the VM.
> 
> Unexpected Signal : 11 occurred at PC=0x405C44FA
> Function=__cplus_type_matcher+0x1A
> Library=/usr/lib/libstdc++-libc6.1-1.so.2
> 
> Current Java thread:
>         at DataAccess.getFetData(Native Method)
>         at DataAccess.getData(DataAccess.java:81)
>         at DataAccess.main(DataAccess.java:107)
> ]
> 
> 
>   I was able to debug the application, and traced the problem to be
> related to handling the DTD used in validating my XML reports.  It seems
> that when Xerces finds a problem with the DTD, it is throwing an
> exception, which in turn causes the signal 11 to be sent. In fact, I was
> able to determine that WHENEVER Xerces throws an exception (while
> parsing an XML document) it sends the signal.  The signal is aborting
> the application.
> 
>   Has anyone run into this problem with JNI and Xerces-C++?  I would
> greatly appreciate your thoughts and suggestions on this matter.
> 
> 
> I am using Xerces-c v1.8, with Java 1.4

DO NOT USE JAVA2 FROM SUN

Sun installs an exception catcher which says:
"You are not allowed to throw _any_ exception inside jni call!!"

It is a BUG and already reported (Java 1.2) but has not been fixed til now.
If you like to make pressure on Sun feel free to report this bug once more.

The IBM Java2 implementation (currently Java 1.3) works fine with C++,
exceptions, ...
-- 
Miroslaw Dobrzanski-Neumann

MOSAIC SOFTWARE AG
Abteilung Basisentwicklung und Forschung
Tel +49-2225-882-291
Fax +49-2225-882-201
E-mail: mne@mosaic-ag.com


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


RE: Problem with JNI and Xerces-c

Posted by Alfredo Munoz <am...@eversystems.com>.
It is not Xerces.....It is a Java issue.

Sun does _not_ allow to throw exceptions in a JNI Call with C++. It is a
serious BUG, that
completely make the use of JNI with C++ useless in serious applications...

alfredo



-----Original Message-----
From: Andrew Ferayorni [mailto:Andrew.Ferayorni@onsemi.com]
Sent: Miercoles, 24 de Julio de 2002 12:38 p.m.
To: xerces-c-dev@xml.apache.org
Subject: Problem with JNI and Xerces-c



I have a SOAP service written in Java that uses JNI to use a C++ shared
object library.  My C++ library contains classes that build and validate
XML reports using the Xerces C++ package.  The problem I am encountering
is only when I try to use the library via JNI.  I have run the C++ code
standalone and it works great, however when I try to use it via JNI from
a Java application I get the following error:

[
An unexpected exception has been detected in native code outside the VM.

Unexpected Signal : 11 occurred at PC=0x405C44FA
Function=__cplus_type_matcher+0x1A
Library=/usr/lib/libstdc++-libc6.1-1.so.2

Current Java thread:
        at DataAccess.getFetData(Native Method)
        at DataAccess.getData(DataAccess.java:81)
        at DataAccess.main(DataAccess.java:107)
]


  I was able to debug the application, and traced the problem to be
related to handling the DTD used in validating my XML reports.  It seems
that when Xerces finds a problem with the DTD, it is throwing an
exception, which in turn causes the signal 11 to be sent. In fact, I was
able to determine that WHENEVER Xerces throws an exception (while
parsing an XML document) it sends the signal.  The signal is aborting
the application.

  Has anyone run into this problem with JNI and Xerces-C++?  I would
greatly appreciate your thoughts and suggestions on this matter.


I am using Xerces-c v1.8, with Java 1.4

Thank you,
Andrew


---------------------------------------------------------------------
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