Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4420882

C++ app hosting ActiveX component generated from Java Bean crashes on exit

XMLWordPrintable

    • 04
    • x86
    • windows_98, windows_nt



        Name: boT120536 Date: 03/01/2001


        C:\>java -version> .txt
        java version "1.3.0"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
        Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

        I also have BDK1.1 and JDK1.3 installed.

        1. Following the instructions on
        http://java.sun.com/docs/books/tutorial/javabeans/writingbean/index.html
        create a simple java bean.
        For example:-

        import java.lang.String;
        import java.io.*;

        public class TestBean implements Serializable
        {
          int i;

          // We must provide default ctr for JAVA/COM bridge
          public TestBean() {};
        }

        2. Following the instructions on
        http://java.sun.com/products/plugin/1.1.1/docs/script.html generate an
        ActiveX/COM object from this Java Bean.

        3. From within a Visual C++ 6.0 application, instantiate and destory the
        generated COM object. For example:-

        CoInitialize( NULL );
        TestBeanDispatchPtr pTest( _T("TestBean.Bean") );
        pTest = NULL;
        CoUninitialize();
          
        4. Run the application. The bean is instantiated ok, and I can call methods
        with no problems. However, when the application terminates (during
        ExitProcess) there is an access violation in jpishare.dll (0x50301321)
        (Review ID: 116699)
        ======================================================================

        Name: boT120536 Date: 03/14/2001


        When the VB 6 application is run on the Win98 system it runs ok but when I exit
        the tool i get the following error.
        **********
        VB6 caused an invalid page fault in
        module JPISHARE.DLL at 015f:50301f00.
        Registers:
        EAX=030004d0 CS=015f EIP=50301f00 EFLGS=00010202
        EBX=50300000 SS=0167 ESP=1038fc34 EBP=1038fc70
        ECX=50144b28 DS=0167 ESI=02ef2468 FS=7b77
        EDX=c00195d0 ES=0167 EDI=02ef31b0 GS=0000
        Bytes at CS:EIP:
        ff 51 14 8b 46 08 50 8b 08 ff 51 08 83 66 08 00
        Stack dump:
        030004d0 02ef2460 50301cf1 00000001 02ef2460 50303a9d 02ef2460 00000000
        50304e63 50300000 00000000 00000001 00000000 50300000 817fa2fc 1038fe38

        ****************************************
        When I compile and run the same code on NT 4 with SP 6 I get the following
        error when I exit the application.

        *******
        The instruction at "0x50301f00" referenced memory at "0x50144b3c". The memory
        could not
        be "read"

        Microsoft Windows NT Server Verison 4.0 (Build 1381: Service Pack 6)
        ************

        I Have a very simple Test Bean (invisible) code that I am converting into
        ActiveX control. I am using the JRE ver 1.3.0_02 to convert the beans. I drop
        the bean in a VB 6 application and call a method on the bean when a button on
        the VB form is clicked. It works just fine. Then I save and remove the project
        and exit the VB6 application. That is when I see the error as shown above. I
        see the same result when I create an executable and run it and shut it down.
        The Source code for test bean is as follows.

        *****************************
        //This is a test bean
        import java.beans.*;
        import java.io.*;


        public class Test implements Serializable
        {
        public Test()
        {
        name = new String("John");
        }

        public String whoAreYou()
        {
        return name;
        }

        public void setName(String str)
        {
        name = str;
        }

        public String getName()
        {
        return name;
        }

        private String name = null;
        }


        **************************
        Beaninfo class source code
        **************************
        import java.beans.*;
        import java.lang.reflect.Method;
        import java.util.Properties;

        public class TestBeanInfo extends SimpleBeanInfo
        {
        public MethodDescriptor[] getMethodDescriptors()
        {
        Method m = null;
        try
        {
        m=Test.class.getMethod("whoAreYou", null);
        }catch(Exception e)
        {
        System.out.println("Exception" + e);
        }
        return new MethodDescriptor[] {new MethodDescriptor(m)};
        }

        }

        ***************************
        Manifest file
        ************************
        Manifest-Version: 1.0

        Name: Test.class
        Java-Bean: True

        ************************************

        I am not able to pinpoint what the problem is?
        (Review ID: 118437)
        ======================================================================

              djayaramsunw Devananda Jayaraman (Inactive)
              bonealsunw Bret O'neal (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: