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 suresh <su...@vergiltech.com> on 2001/12/04 07:57:17 UTC

XERCES EXCEPTION

please help me out with this error

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x77f99c14
Function name=strtoul
Library=C:\WINNT\System32\ntdll.dll

Current Java thread:
        at Dispatcher.cppParser(Native Method)
        at Dispatcher.DispatchPPT(Dispatcher.java:52)
        at DurableSubscriber.onMessage(DurableSubscriber.java:108)
        at com.pramati.jms.client.SubscriberTaskQueue.run(SubscriberTaskQueu
va:56)
        at java.lang.Thread.run(Unknown Source)

Dynamic libraries:
0x00400000 - 0x00405000         C:\WINNT\system32\java.exe
0x77F80000 - 0x77FFB000         C:\WINNT\System32\ntdll.dll
0x77DB0000 - 0x77E0B000         C:\WINNT\system32\ADVAPI32.dll
0x77E80000 - 0x77F35000         C:\WINNT\system32\KERNEL32.DLL
0x77D40000 - 0x77DB0000         C:\WINNT\system32\RPCRT4.DLL
0x78000000 - 0x78046000         C:\WINNT\system32\MSVCRT.dll
0x6D420000 - 0x6D4EF000         C:\Program Files\JavaSoft\JRE\1.3.1\bin\hots
jvm.dll
0x77E10000 - 0x77E74000         C:\WINNT\system32\USER32.dll
0x77F40000 - 0x77F7C000         C:\WINNT\system32\GDI32.DLL
0x77570000 - 0x775A0000         C:\WINNT\system32\WINMM.dll
0x75E60000 - 0x75E7A000         C:\WINNT\System32\IMM32.DLL
0x681A0000 - 0x681A7000         C:\WINNT\system32\serwvdrv.dll
0x66740000 - 0x66747000         C:\WINNT\system32\umdmxfrm.dll
0x6D220000 - 0x6D227000         C:\Program Files\JavaSoft\JRE\1.3.1\bin\hpi.
0x6D3B0000 - 0x6D3BD000         C:\Program Files\JavaSoft\JRE\1.3.1\bin\veri
ll
0x6D250000 - 0x6D266000         C:\Program Files\JavaSoft\JRE\1.3.1\bin\java

0x6D3C0000 - 0x6D3CD000         C:\Program Files\JavaSoft\JRE\1.3.1\bin\zip.
0x10000000 - 0x10036000         D:\JNITEST\LoadParser.dll
0x12000000 - 0x12138000         C:\WINNT\system32\xerces-c_1_5.dll
0x6D340000 - 0x6D348000         C:\Program Files\JavaSoft\JRE\1.3.1\bin\net.
0x75050000 - 0x75058000         C:\WINNT\system32\WSOCK32.dll
0x75030000 - 0x75043000         C:\WINNT\system32\WS2_32.DLL
0x75020000 - 0x75028000         C:\WINNT\system32\WS2HELP.DLL
0x785C0000 - 0x785CC000         C:\WINNT\System32\rnr20.dll
0x77980000 - 0x779A4000         C:\WINNT\system32\DNSAPI.DLL
0x77340000 - 0x77353000         C:\WINNT\system32\iphlpapi.dll
0x77520000 - 0x77525000         C:\WINNT\system32\ICMP.DLL
0x77320000 - 0x77337000         C:\WINNT\system32\MPRAPI.DLL
0x75150000 - 0x75160000         C:\WINNT\system32\SAMLIB.DLL
0x75170000 - 0x751BF000         C:\WINNT\system32\NETAPI32.DLL
0x77BE0000 - 0x77BEF000         C:\WINNT\system32\SECUR32.DLL
0x751C0000 - 0x751C6000         C:\WINNT\system32\NETRAP.DLL
0x77950000 - 0x77979000         C:\WINNT\system32\WLDAP32.DLL
0x77A50000 - 0x77B46000         C:\WINNT\system32\OLE32.DLL
0x779B0000 - 0x77A4B000         C:\WINNT\system32\OLEAUT32.DLL
0x773B0000 - 0x773DE000         C:\WINNT\system32\ACTIVEDS.DLL
0x77380000 - 0x773A2000         C:\WINNT\system32\ADSLDPC.DLL
0x77830000 - 0x7783E000         C:\WINNT\system32\RTUTILS.DLL
0x77880000 - 0x7790D000         C:\WINNT\system32\SETUPAPI.DLL
0x77C10000 - 0x77C6D000         C:\WINNT\system32\USERENV.DLL
0x774E0000 - 0x77512000         C:\WINNT\system32\RASAPI32.DLL
0x774C0000 - 0x774D1000         C:\WINNT\system32\RASMAN.DLL
0x77530000 - 0x77552000         C:\WINNT\system32\TAPI32.DLL
0x77B50000 - 0x77BD9000         C:\WINNT\system32\COMCTL32.DLL
0x77C70000 - 0x77CBA000         C:\WINNT\system32\SHLWAPI.DLL
0x77360000 - 0x77379000         C:\WINNT\system32\DHCPCSVC.DLL
0x775A0000 - 0x77625000         C:\WINNT\system32\CLBCATQ.DLL
0x777E0000 - 0x777E8000         C:\WINNT\System32\winrnr.dll
0x74FD0000 - 0x74FEF000         C:\WINNT\system32\msafd.dll
0x75010000 - 0x75017000         C:\WINNT\System32\wshtcpip.dll
0x777F0000 - 0x777F5000         C:\WINNT\system32\rasadhlp.dll
0x09420000 - 0x0943A000         D:\JNITEST\bridge2java.dll
0x770F0000 - 0x772A7000         C:\WINNT\system32\msi.dll
0x77920000 - 0x77943000         C:\WINNT\system32\imagehlp.dll
0x72A00000 - 0x72A2D000         C:\WINNT\system32\DBGHELP.dll
0x690A0000 - 0x690AB000         C:\WINNT\system32\PSAPI.DLL

Local Time = Tue Dec 04 12:17:05 2001
Elapsed Time = 20
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)
#
# An error report file has been saved as hs_err_pid1700.log.
# Please refer to the file for further information.
#



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

Posted by suresh <su...@vergiltech.com>.
Thanks a million erik.I struggled for two days without knowing this.

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

Posted by Erik Rydgren <er...@mandarinen.se>.
It looks like that you call XMLPlatformUtils::Initialize() and
XMLPlatformUtils::Terminate() several times (in XMLParser::parse).
Once you have called Terminate you can't Initialize again. I'm not sure but
it might be fixed in the newest version. Check it out
or just do not call terminate until it is really time to unload the Xerces
dll.

Regards

Erik Rydgren
Mandarinen systems AB
Sweden


-----Original Message-----
From: suresh [mailto:suresh.n@vergiltech.com]
Sent: den 4 december 2001 10:27
To: xerces-c-dev@xml.apache.org
Subject: RE: XERCES EXCEPTION HELP


hi all,

	I have a JNI application running on PIII win2000.The java application loads
a runtime vc dll that parses the content.


i pick up the a message from the queue and call dispatcher(java) which loads
the parser dll and returns back info.
this all happens fine for the first time but on receiving data for the
second time


try{
        m_parser = XMLReaderFactory::createXMLReader();

	catch(...)
    {
             cout << "Error during initialization! :\n";
    }


	this part of the code seems to throw up an exception . plz help me out .



**********************************************************
/* onMessage is called when message arrives in the queue */
*********************************************************

public void onMessage(Message msg)
	{
			if (!(msg instanceof TextMessage))
				{
					return;
				}

				try
				{
					TextMessage txtMsg = (TextMessage)msg;
					String str = txtMsg.getText();
					System.out.println("Received:"+str);


				------------------------------------------------------------
					i create a dispatch object here and call methods of it
				--------------------------------------------------------------

					objDispatch.Initialize();
					objDispatch.xmlData = str;
					System.out.println("here");
					objDispatch.DispatchPPT();
					System.out.println("here");

				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
	}

-----------------
Dispatcher class
-----------------




public class Dispatcher
{
	private native void init();
	private native void cppParser(String xmlData);
    	private native String getText();
	private native void cleanUp();
	private int ptr;
	public String xmlData = "";
	public IPowerpoint objPowerPoint;
	public IXlsXml	objIXlsXml;
	public  boolean ppt;
	private DurableSubscriber objDurableSubscriber;


	public void Initialize()
	{
		init();
	}


	public String getXmlData()
	{
		return xmlData;
	}


	Dispatcher(String Data)
	{
			xmlData = Data;
			init();
	}

	public Dispatcher(DurableSubscriber refDurableSubscriber)
	{
			System.out.println("INITIALIZED...............n\n\n\n");
			init();
			objDurableSubscriber = refDurableSubscriber;
	}

	void DispatchPPT()
	{
						String Text = "must get it from xml";

						cppParser(xmlData);

						System.out.println(Text);
	}


	public static void main(String arg[])
	{
		String Text;

		Dispatcher objDispatcher  = new Dispatcher("");

		objDispatcher.xmlData = arg[0];

       if	(objDispatcher.xmlData.indexOf ("xls",0)  == -1)
		{
			System.out.println("true");
			objDispatcher.ppt = true;
		}
		else
		{
			System.out.println("false");
			objDispatcher.ppt = false;
		}
		objDispatcher.DispatchPPT();
	}

	 static {
		System.loadLibrary("LoadParser");
	}

	}

----------------
End of dispatcher
----------------


----------------------
Native implementation
----------------------


JNIEXPORT void JNICALL Java_Dispatcher_init
                (JNIEnv * m_environment,jobject jobj)
{
    try
    {

            XMLParser* objParser = new XMLParser();
            cout<<"THE value of add of the parser is"<<objParser<<endl;
            jclass cls = m_environment->GetObjectClass(jobj);

            jfieldID memberId = m_environment->GetFieldID(cls, "ptr", "I");
            jint ptr = m_environment->GetIntField(jobj,memberId);

            //stores the pointer value of objParser into a java class
            //member ptr(int)

             m_environment->SetIntField(jobj,memberId,(long) objParser);


    }catch(...)
    {
         cout<<"Exception Here0"<<endl;
    }
}

//native implementation of cppParser() method

//functions uses the object created in init and
//parses the string passed in and stores the result
//in a message format object

JNIEXPORT void JNICALL Java_Dispatcher_cppParser
  (JNIEnv * m_environment, jobject jobj, jstring m_jxmlData)
{
    try
    {

        jclass cls = m_environment->GetObjectClass(jobj);
        jfieldID memberId = m_environment->GetFieldID(cls, "ptr", "I");
        XMLParser* objParser = (XMLParser*)
m_environment->GetIntField(jobj,memberId);
        const char* m_xmlData = m_environment->GetStringUTFChars(m_jxmlData,
0);
        MessageFormat objMessageFormat;
        objMessageFormat.setpptName(m_xmlData);
        m_xmlData  = (objMessageFormat.getXmlData()).c_str();
        cout<<m_xmlData;
        objMessageFormat = objParser->parse(m_xmlData);
    }catch(...)
    {
	-------------------------------------------------------

		An exception is caught here
	-----------------------------------------------------------


        cout<<"Exception Here1"<<endl;
    }

}

*************************************************************8888
xerces implementation

********************************************************************88


MessageFormat XMLParser::parse(string strParseBuffer)
{

	try {
        XMLPlatformUtils::Initialize();
    }
    catch (const XMLException& toCatch) {
             cout << "Error during initialization! :\n"
                     << toCatch.getMessage() << "\n";
    }

	SAXParser::ValSchemes    valScheme = SAXParser::Val_Auto;
    bool doNamespaces    = false;
    bool doSchema        = false;

    **************************************************************88
	Exception caught here when called second time from the queue
*************************************************************************8
    try{
        m_parser = XMLReaderFactory::createXMLReader();
    }catch (const XMLException& toCatch) {
             cout << "Error during initialization! :\n"
                     << toCatch.getMessage() << "\n";
    }
    catch(...)
    {
             cout << "Error during initialization! :\n";
    }


    cout<<"Parsing.......4"<<endl;

    XmlFunctionHandler m_Handler;

	m_parser->setContentHandler(&m_Handler);
	m_parser->setLexicalHandler(&m_Handler);
    m_parser->setErrorHandler(&m_Handler);

    cout<<"Parsing.......5"<<endl;

	m_DataBuf = strParseBuffer.c_str();

	m_ParseBuf = new MemBufInputSource (
		(const XMLByte*)m_DataBuf
        ,strlen(m_DataBuf)
        ,m_MemBufId
        ,true
    );
        cout<<"Parsing.......6"<<endl;

    try {

             cout<<"Parsing......."<<endl;

		m_parser->parse(*m_ParseBuf);

        //     cout<<"Parse Complete......."<<endl;

		}
    catch (const XMLException& toCatch) {
             cout << "\nFile not found: '" <<"'\n"
                 << "Exception message is: \n"
             << toCatch.getMessage() << "\n" ;
    }
	 catch (...)
    {
        cerr << "\nUnexpected exception during parsing: '"<< "'\n";
    }

    XMLPlatformUtils::Terminate();

	m_objMessageFormat = m_Handler.getMessageFormat();

    return m_objMessageFormat;

}







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

Posted by suresh <su...@vergiltech.com>.
hi all,

	I have a JNI application running on PIII win2000.The java application loads
a runtime vc dll that parses the content.


i pick up the a message from the queue and call dispatcher(java) which loads
the parser dll and returns back info.
this all happens fine for the first time but on receiving data for the
second time


try{
        m_parser = XMLReaderFactory::createXMLReader();

	catch(...)
    {
             cout << "Error during initialization! :\n";
    }


	this part of the code seems to throw up an exception . plz help me out .



**********************************************************
/* onMessage is called when message arrives in the queue */
*********************************************************

public void onMessage(Message msg)
	{
			if (!(msg instanceof TextMessage))
				{
					return;
				}

				try
				{
					TextMessage txtMsg = (TextMessage)msg;
					String str = txtMsg.getText();
					System.out.println("Received:"+str);


				------------------------------------------------------------
					i create a dispatch object here and call methods of it
				--------------------------------------------------------------

					objDispatch.Initialize();
					objDispatch.xmlData = str;
					System.out.println("here");
					objDispatch.DispatchPPT();
					System.out.println("here");

				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
	}

-----------------
Dispatcher class
-----------------




public class Dispatcher
{
	private native void init();
	private native void cppParser(String xmlData);
    	private native String getText();
	private native void cleanUp();
	private int ptr;
	public String xmlData = "";
	public IPowerpoint objPowerPoint;
	public IXlsXml	objIXlsXml;
	public  boolean ppt;
	private DurableSubscriber objDurableSubscriber;


	public void Initialize()
	{
		init();
	}


	public String getXmlData()
	{
		return xmlData;
	}


	Dispatcher(String Data)
	{
			xmlData = Data;
			init();
	}

	public Dispatcher(DurableSubscriber refDurableSubscriber)
	{
			System.out.println("INITIALIZED...............n\n\n\n");
			init();
			objDurableSubscriber = refDurableSubscriber;
	}

	void DispatchPPT()
	{
						String Text = "must get it from xml";

						cppParser(xmlData);

						System.out.println(Text);
	}


	public static void main(String arg[])
	{
		String Text;

		Dispatcher objDispatcher  = new Dispatcher("");

		objDispatcher.xmlData = arg[0];

       if	(objDispatcher.xmlData.indexOf ("xls",0)  == -1)
		{
			System.out.println("true");
			objDispatcher.ppt = true;
		}
		else
		{
			System.out.println("false");
			objDispatcher.ppt = false;
		}
		objDispatcher.DispatchPPT();
	}

	 static {
		System.loadLibrary("LoadParser");
	}

	}

----------------
End of dispatcher
----------------


----------------------
Native implementation
----------------------


JNIEXPORT void JNICALL Java_Dispatcher_init
                (JNIEnv * m_environment,jobject jobj)
{
    try
    {

            XMLParser* objParser = new XMLParser();
            cout<<"THE value of add of the parser is"<<objParser<<endl;
            jclass cls = m_environment->GetObjectClass(jobj);

            jfieldID memberId = m_environment->GetFieldID(cls, "ptr", "I");
            jint ptr = m_environment->GetIntField(jobj,memberId);

            //stores the pointer value of objParser into a java class
            //member ptr(int)

             m_environment->SetIntField(jobj,memberId,(long) objParser);


    }catch(...)
    {
         cout<<"Exception Here0"<<endl;
    }
}

//native implementation of cppParser() method

//functions uses the object created in init and
//parses the string passed in and stores the result
//in a message format object

JNIEXPORT void JNICALL Java_Dispatcher_cppParser
  (JNIEnv * m_environment, jobject jobj, jstring m_jxmlData)
{
    try
    {

        jclass cls = m_environment->GetObjectClass(jobj);
        jfieldID memberId = m_environment->GetFieldID(cls, "ptr", "I");
        XMLParser* objParser = (XMLParser*)
m_environment->GetIntField(jobj,memberId);
        const char* m_xmlData = m_environment->GetStringUTFChars(m_jxmlData,
0);
        MessageFormat objMessageFormat;
        objMessageFormat.setpptName(m_xmlData);
        m_xmlData  = (objMessageFormat.getXmlData()).c_str();
        cout<<m_xmlData;
        objMessageFormat = objParser->parse(m_xmlData);
    }catch(...)
    {
	-------------------------------------------------------

		An exception is caught here
	-----------------------------------------------------------


        cout<<"Exception Here1"<<endl;
    }

}

*************************************************************8888
xerces implementation

********************************************************************88


MessageFormat XMLParser::parse(string strParseBuffer)
{

	try {
        XMLPlatformUtils::Initialize();
    }
    catch (const XMLException& toCatch) {
             cout << "Error during initialization! :\n"
                     << toCatch.getMessage() << "\n";
    }

	SAXParser::ValSchemes    valScheme = SAXParser::Val_Auto;
    bool doNamespaces    = false;
    bool doSchema        = false;

    **************************************************************88
	Exception caught here when called second time from the queue
*************************************************************************8
    try{
        m_parser = XMLReaderFactory::createXMLReader();
    }catch (const XMLException& toCatch) {
             cout << "Error during initialization! :\n"
                     << toCatch.getMessage() << "\n";
    }
    catch(...)
    {
             cout << "Error during initialization! :\n";
    }


    cout<<"Parsing.......4"<<endl;

    XmlFunctionHandler m_Handler;

	m_parser->setContentHandler(&m_Handler);
	m_parser->setLexicalHandler(&m_Handler);
    m_parser->setErrorHandler(&m_Handler);

    cout<<"Parsing.......5"<<endl;

	m_DataBuf = strParseBuffer.c_str();

	m_ParseBuf = new MemBufInputSource (
		(const XMLByte*)m_DataBuf
        ,strlen(m_DataBuf)
        ,m_MemBufId
        ,true
    );
        cout<<"Parsing.......6"<<endl;

    try {

             cout<<"Parsing......."<<endl;

		m_parser->parse(*m_ParseBuf);

        //     cout<<"Parse Complete......."<<endl;

		}
    catch (const XMLException& toCatch) {
             cout << "\nFile not found: '" <<"'\n"
                 << "Exception message is: \n"
             << toCatch.getMessage() << "\n" ;
    }
	 catch (...)
    {
        cerr << "\nUnexpected exception during parsing: '"<< "'\n";
    }

    XMLPlatformUtils::Terminate();

	m_objMessageFormat = m_Handler.getMessageFormat();

    return m_objMessageFormat;

}







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

Posted by Miroslaw Dobrzanski-Neumann <mn...@mosaic-ag.com>.
With Java 2 you are not allowed to throw any exception in jni code.
It is one more reason to look for other programming languages.

On Tue, Dec 04, 2001 at 12:27:17PM +0530, suresh wrote:
> please help me out with this error
> 
> An unexpected exception has been detected in native code outside the VM.
> Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x77f99c14
> Function name=strtoul
> Library=C:\WINNT\System32\ntdll.dll
> 
> Current Java thread:
>         at Dispatcher.cppParser(Native Method)
>         at Dispatcher.DispatchPPT(Dispatcher.java:52)
>         at DurableSubscriber.onMessage(DurableSubscriber.java:108)
>         at com.pramati.jms.client.SubscriberTaskQueue.run(SubscriberTaskQueu
> va:56)
>         at java.lang.Thread.run(Unknown Source)
--
Miroslaw Dobrzanski-Neumann

MOSAIC SOFTWARE AG
Base Development and Research
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