Write a debugger using JDI

Hi,
I am new to JDI and I want to create a debugger to listen to events like
ClassUnloadEvent .
I start the application that I want to debug with:
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=80000 <mailclass>
is this correct ?
I than get the VirtualMachinceManager by:
VirtualMachineManager vmManager = Bootrap.virtualMachineManager();
But than I am lost how to continue and connect to the other VM that I wan to debug.
Anyone has an idea?

I suggest you start by taking a look at the trace example, which (in J2SE 1.4.x or 5.x) will be found in $JAVA_HOME/demo/jpda/examples.jar.
After you unpack examples jar, look for com/sun/tools/example/trace/Trace.java.
After you understand the trace example, take a look at the sample jdb debugger. The source for that will be located under: com/sun/tools/example/debug/tty

Similar Messages

  • How to use JDI handle event, need you help!~

    Hi,
    In our recent project, I need listen some event such as ClassPrepareEvent, MethodEntryEvent using JDI and handle it. I am trying to mend the TTY and let it
    do something simple when MethodEntryEvent occur.
    I just add a print line in the method methodEntryEvent in TTY.java. But I noticed that this method is not invocated after I input "run" commond. I don't konw why? And how can I listen this event? And when the methodEntryEvent method in TTY will be invocated?
    Anyone can help me ???
    Thank you!!!
    PS: methodEntryEvent method is post as follow:
    public void methodEntryEvent(MethodEntryEvent me) {
    Thread.yield(); // fetch output
    //notice:
    //i want print this sentens when every method entry.
    System.out.println("Method Entry:");
    StringBuffer buffer = new StringBuffer("\nMethod Entered: ");
    buffer.append(me.method().declaringType().name());
    buffer.append(".");
    buffer.append(me.method().name());
    buffer.append(" ");
    out.print(buffer.toString());
    otherEvent(me);
    Duan
    SJTU

    You must enable a MethodEntryRequest before any MethodEntryEvent will
    be reported.
    In the jdb/TTY reference debugger, use the 'trace methods [thread]'
    and 'untrace methods [thread]' commands to turn tracing on or off
    for method entry and exit.
    Once you request MethodEntry/Exit notification, then the methodEntryEvent
    handler in TTY.java will be called and you will see the println() you
    added to the code.

  • Any suggestions to implement a rollback wen using jdi

    Im trying to implement rollback in the debugger interface i have devoleped using jdi. This interface is just a GUI which allows u to try and debug and set breakpoints easily. It also has the facility of connecting to a localhost.
    Now im trying to implement a rollback for this. The first step for this will be to generate a trace of all the functions used wen the program is running. is there anyone who knows how to do this.
    thank u
    harsha

    Success!
    I realised I had to change the I.P. address of the printer. This was a mission in itself as Minolta has all but given up on the QMS range of printers so I couldn't find much on their site. However a bit of digging around unearthed the manual for the printer, and I reconfigured the printers I.P. address to be close to my router address.
    I then found another site that mentioned Minolta printers should have the suffix /ps after the address if networking via ethernet (this was posted pre Snow Leopard).
    So after making these two changes I finally got the printer to work using the LPD window. I then reinstalled the QMS driver that was deleted by the Snow Leopard install, and added that as my print driver. All works well so far. 1 day lost but in the end it was worth the stress!!!
    Address: 192.168.1.200
    Queue: ps
    Name: 192.168.1.200
    Location:
    Print Using: QMS 2060 Print System
    I then went to this site to change the name of the printer to something a little more human friendly.
    http://127.0.0.1:631/
    Click on printers on the top menu, then click on your printer name, select modify from the drop down menu, and then you are able to change the name and location to something a little friendlier than I.P. addresses.
    Solved!
    I'm now going to redownload the Epson drivers as it seems from another thread that there was no real need for Snow Leopard to delete these old drivers at all...

  • As a writer I'm using Pages to write my documents but the title shows up on every page.   How do I set-up my page so that it shows up on only the first page?

    As a writer I'm using Pages to write my documents but the title shows up on every page.   How do I set-up my page so that it shows up on only the first page?

    Don't put it in the Header.
    Peter

  • How to create and write a BLOB using ImmediateAccess

    Hi there,
    I'd like to write a BLOB using ScrollableRowSetAccess an ImmediateAccess and thereby want to avoid the use of any SQL-statements.
    The problem is that I can't write to an empty BLOB, so that I have to create a dummy-Blob using BLOBDomain and overwrite it afterwards (see code below).
    It should be possible to avoid the creation of a dummy-BLOB but I don't know how. Could you please send me a corrected version of my code?
    Thanks in advance
    write File with filename to the column with index col /(or the column with name colname, if specified) of the table that is specified by ResultSetInfo rsi
    public static void writeFileToBlob(int col, String colname, ResultSetInfo rsi, String filename, SessionInfo _sessionInfo)
    FileInputStream fin;
    Object obj;
    ScrollableRowsetAccess srsa= _rsi.getRowsetAccess();
    ImmediateAccess ia;
    byte []mybytes;
    BlobDomain
    BLOB blob;
    OutputStream out;
    byte []myBuffer;
    int bytesRead=0;
    try{
    //open file
    fin = new FileInputStream(_filename);
    //lock Row
    srsa.lockRow();
    if (_colname==null)
    ia = (ImmediateAccess)srsa.getColumnItem(_col);
    else
    ia = (ImmediateAccess)srsa.getColumnItem(_colname);
    obj= ia.getValueAsObject();
    //insert a dummy-BLOB of size 1-byte
    mybytes= new byte[1];
    blobDom= new BlobDomain();
    blobDom.setBytes(mybytes); //ein Byte in den BLOB schreiben
    ia.setValue(blobDom); //Wert in Zeile einf|gen
    //commit Data
    _sessionInfo.getApplicationModule().getTransaction().commit();
    //access previously created dummy-Blob
    srsa.lockRow();
    if (_colname==null)
    ia = (ImmediateAccess)srsa.getColumnItem(_col);
    else
    ia = (ImmediateAccess)srsa.getColumnItem(_colname);
    obj= ia.getValueAsObject();
    //assign the BLOB
    blob= (BLOB) obj;
    //open BLOB for writing
    out= blob.getBinaryOutputStream();
    myBuffer= new byte[10*1024];
    //read file and write the BLOB
    while ((bytesRead= fin.read(myBuffer)) !=-1)
    out.write(myBuffer, 0, bytesRead);
    out.flush();
    out.close();
    fin.close();
    ia.setValue(blob);
    //commmit data
    _sessionInfo.getApplicationModule().getTransaction().commit();
    }catch(Exception e){System.out.println("writeblob:"+e);}
    null

    Here are the issues with your usage of BlobDomain:
    1. Streaming support is not implemented in 3.2 version of BlobDomain. It'll be implemented in our next release.
    2. Your casting of object returned from getColumnItem is illegal as the objects will be of type BlobDomain and not BLOB.
    3. When you create an empty BlobDomain you're in-effect meaning to call the empty_blob() method on the sql-row to create a empty blob locator.
    4. You need to use getBytes(), setBytes() to read data out/set data into a blob/clob domain object in JDev 3.2
    5. Casting/using oracle.sql.BLOB may lead to non-portable code (you're binding to the jdbc objects which may not be available in all tiers of deployment).
    Here's the pseudocode you could use for new blobs.
    1. create a new instance of BlobDomain()
    2. setBytes() with actual data read from a stream. (Yes this may not work with real large blobs but we've tested blobs ~2MB in size and for larger needs, we're implementing the streaming support scheduled for our next release).
    3. set the domain object into an attribute.
    4. post/commit your data.
    null

  • Please help to re-write this query using exists or with

    Hi please help to re-write this query using exists or with, i need to write same code for 45 day , 90 days and so on but sub query condition is same for all
    SELECT SUM (DECODE (t_one_mon_c_paid_us, 0, 0, 1)) t_two_y_m_mul_ca_
    FROM (SELECT SUM (one_mon_c_paid_us) t_one_mon_c_paid_us
    FROM (
    SELECT a.individual_id individual_id,
    CASE
    WHEN NVL
    (b.ship_dt,
    TO_DATE ('05-MAY-1955')
    ) >= SYSDATE - 45
    AND a.country_cd = 'US'
    AND b.individual_id in (
    SELECT UNIQUE c.individual_id
    FROM order c
    WHERE c.prod_cd = 'A'
    AND NVL (c.last_payment_dt,
    TO_DATE ('05-MAY-1955')
    ) >= SYSDATE - 745)
    THEN 1
    ELSE 0
    END AS one_mon_c_paid_us
    FROM items b, addr a, product d
    WHERE b.prod_id = d.prod_id
    AND d.affinity_1_cd = 'ADH'
    AND b.individual_id = a.individual_id)
    GROUP BY individual_id)
    Edited by: user4522368 on Aug 23, 2010 9:11 AM

    Please try and place \ before and after you code \Could you not remove the inline column select with the following?
    SELECT a.individual_id individual_id
         ,CASE
            when b.Ship_dt is null then
              3
            WHEN b.ship_dt >= SYSDATE - 90
              3
            WHEN b.ship_dt >= SYSDATE - 45
              2
            WHEN b.ship_dt >= SYSDATE - 30
              1
          END AS one_mon_c_paid_us
    FROM  items           b
         ,addr            a
         ,product         d
         ,order           o
    WHERE b.prod_id       = d.prod_id
    AND   d.affinity_1_cd = 'ADH'
    AND   b.individual_id = a.individual_id
    AND   b.Individual_ID = o.Individual_ID
    and   o.Prod_CD       = 'A'             
    and   NVL (o.last_payment_dt,TO_DATE ('05-MAY-1955') ) >= SYSDATE - 745
    and   a.Country_CD    = 'US'

  • How to write a file using mod pl/sql

    hi,
    i am having a submit button in my procedure. which should inturn create .sql file in a file path.
    is there any way to create a fileusing htp and htf methods.
    Thanks in advance
    Hari

    >
    i am having a submit button in my procedure. which should in turn create .sql file in a file path.
    is there any way to create a file using htp and htf methods.
    >
    Why are you wasting your time coding from scratch using the PL/SQL Web Toolkit instead of the APEX framework?
    From Re: how to write a file using mod pl/sql it appears that you are not using APEX, so a number of the approaches APEX offers are not relevant. You appear to be looking for a file download solution using the <tt>wpg_docload.download_file</tt> method, such as:
    create or replace procedure download_file (
        p_filename  in     varchar2
      , p_mimetype  in     varchar2
      , p_content   in out nocopy blob)
    is
    begin
      -- Set up HTTP header.
      -- Use "application/octet" as default MIME type.
      owa_util.mime_header(nvl(p_mimetype, 'application/octet'), false);
      -- Set the size so the browser knows how much to download.
      htp.p('Content-length: ' || dbms_lob.getlength(p_content));
      -- Filename will be used as default by the browser in "Save as..."
      htp.p('Content-Disposition: attachment; filename="' || p_filename || '"');
      -- Close header.
      owa_util.http_header_close();
      -- Stream the file content to the browser.
      wpg_docload.download_file(p_content);
    end download_file;

  • How to write a application using WDJ with the adobe form ?

    Hi, experts,
    I don't know how to write a application using !!webdynpro for java!! with the adobe form so that I can fill data to the adobe form and get data from the adobe form.
    Note: I have configed the ADS(adobe document services),and I can create a application with a interactiveform in webdynpro for abap and run it successfully, so that I can  fill data to the adobe form and get data from the adobe form.
    Do you give me some hint?
    Thanks a lot.
    Best regards,
    tao
    Edited by: wang tao on Sep 9, 2008 8:59 AM

    Hi,
    Refers the following links.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4fd2d690-0201-0010-de83-b4fa0c93e1a9
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5f27e290-0201-0010-ff82-c21557572da1
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c9a954-aa20-2a10-64bb-ea0835204e03
    Thanks
    Abhilasha.

  • How to write SELECT statement using tables ekko,ekpo and eket?

    Hi,
    I got a problem in  performance tuning using below tables?
    how to write SELECT statement using tables EKKO,EKPO and EKET and in conditon ( WHERE clause)  use only fields 
                        ekko~ebeln       IN ebeln
                       ekko~loekz       EQ ' '
                       ekko~lifnr       IN lifnr
                       ekko~ekorg       IN ekorg
                      ekko~ekgrp       IN ekgrp          
                       ekpo~werks       IN werks
                       ekpo~pstyp       EQ  '3'
                       ekpo~loekz       EQ  space
                       ekpo~elikz       EQ  space
                       ekpo~menge       NE  0
                     eket~rsnum       NE space.
    Thanks in Advance.
    bye.

    Hi,
    ekko~ebeln IN ebeln
    ekko~loekz EQ ' '
    ekko~lifnr IN lifnr
    ekko~ekorg IN ekorg
    ekko~ekgrp IN ekgrp
    ekpo~werks IN werks
    ekpo~pstyp EQ '3'
    ekpo~loekz EQ space
    ekpo~elikz EQ space
    ekpo~menge NE 0          " Remove this from where clause
    eket~rsnum NE space.    " Remove this from where clause
    ' instead delete the entries after fetching into the table
    DELETE it_itab WHERE menge EQ '0' AND rsnum EQ ' '.
    Regards
    Bala Krishna

  • Can I write a booklet using pages?

    Can I write a booklet using Pages   Laid out side by side and
    front and back pages

    I think you mean can you do imposition in Pages?
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=181&highlight=imposi tion&mforum=iworktipsntrick
    Peter

  • Customizing SHRJAV / CRMJAV using JDI 2004s

    We use JDI 2004s sp7 and dev. worplace 2004s sp7.
    After much trouble we are now able to customize (in workplace) the
    shrweb, crmweb and custcrmprj components using the JDI, as described (somewhat) in the ISA extension guide.
    Now there are rare cases where we do need to modify the SAP java code itself (SHRJAV and CRMJAV components).
    I tried adding those to the "Software Components for Development" list in the JDI track.
    After adding them there when opening the track in worplace, i can see shrjav and crmjav in the "inactive DC's" view, however they are empty and no DC's show inside. (I can see in the CBS that many things did not build correctly when importing with those two components in the "software componenets for development" instaed of being just "requred components"
    What is the proper way to add the sap java code to the JDI, so that it can be modified.
    We do know how to extend it as explained in the ISA
    guide, but here we want to be able to modify it directly when needed (and that does not seem to be covered in any doc i know of).
    Also not having the java code available in the workplace makes debugging difficult as well.
    Thank you.

    am new to SAP DC Concept.
    We use NWDI 2004s SP9, NWDS and have local J2EE Engine installed.
    So far we can connect to NWDI from NWDS and can see the sap.com_SAP-SHRWEB_1 DC and many subfolders start with crm/isa/web/ (crm/isa/web/b2c, crm/isa/web/b2b for e.g) in the Inactive view.
    Can you please help me with the detail steps after this in order to do some customization and generate either war/ear project to test locally?
    Should I create each projects from sap.com_SAP-SHRWEB_1->crm/isa/web/b2c or create new DC from sap.com_SAP-SHRWEB_1?
    Thank in advance for all your help!!!

  • What blueray writer can I use with my MacBook pro

    What blueray writer can I use with my MacBook Pro

    Apple Compatible Mac Webcams
    iChatUSBCam.  The manufacturer’s website also has a *free* demo of its product & a complete list of USB webcams compatible w/macs & its product.
    For more suggestions, check out EZJim’s website which can be found HERE. <--Clicky click

  • Hi I just updated from Snow Leopard to Mountain Lion. I write DVD's using Final Cut Pro, creating a DVD that plays HD and Standard Definition on one disk. My problem is when I used load the disk on my G5 it would ask if you want High Definition or Standar

    Hi I just updated from Snow Leopard to Mountain Lion.
    I write DVD's using Final Cut Pro, creating a DVD that plays HD and Standard Definition on one disk.
    My problem is when I used load the disk on my G5 it would ask if you want High Definition or Standard Definition, now it just defaults to Standard Definition.(I'm using Apple's DVD Player)
    Can I fix this problem?

    Addendum: I read on a post here (http://forums.macrumors.com/showthread.php?t=420169) about removing some kext files in order to trick OSX into thinking that there were no FireWire ports.
    I followed the instructions and removed from /System/Library/Extensions/ the following files:
    IOFireWireSerialBusProtocolTransport.kext
    IOFireWireAVC.kext
    IOFireWireFamily.kext
    IOFireWireIP.kext
    IOFireWireSBP2.kext
    I restarted and BAM...Snow Leopard booted crazy fast and the mouse and keyboard worked instantly.
    The System Profiler says "No FireWire ports were found."
    So this tells me that the FW port is probably the culprit and is messing up the installation.
    So how do I hack the Mountain Lion installer and tell it to ignore the FW port, which is obviously quite dead? Or is there something I can do to the Base system that is similar?

  • How to write the query using Index

    Hi All,
    I have to fetch the records from Database table using Index, how can i write the query using Index. Can any body plz send me the sample code.
    Help Me,
    Balu.

    Hi,
    See the below Example.
    select * from vbak up to 100 rows
    into table t_vbak
    where vbeln > v_vbeln.
    sort t_vbak by vbeln descending.
    read table t_vbak index 1.
    Regards,
    Ram
    Pls reward points if helpful.

  • Cannot attach the debugger using enterprise 8.1 ide

    I am trying to attach the debugger using the following params:
    Debugger = JPDA Debugger
    Connector = SharedMemoryAttach
    Transport = dt_shmem
    Name = jdbconn
    Timeout = 100
    I get the following message:
    shmemBase_attach failed: The system cannot find the file specified
    Can anybody help please.
    Thanks in advance
    StuartC_1

    First, don't use a static IP Address.
    Troubleshooting:
    Turn Off iPad and iPhones, WiFi router (remove from power), and Printer (remove from power).
    Turn on WiFi router
    Wait 30 seconds
    Turn on printer
    Wait 30 seconds
    Turn on iPad
    Try to print.

Maybe you are looking for

  • JVC Everio .mod files on FCP

    I want to purchase a JVC Everio camcorder that records to hard disk. The problem is I've heard people have to convert the .mod files it creates to be able to edit with them. Their website says they record "High-Quality MPEG-2 Video Recording (up to 7

  • Adobe could not open

    adobe reader could not open the file may be damaged are not supported what do i need to do  it use to open the file i am speaking of.

  • Update 2.0.1 Made my Apps Useless

    I ran the update two days ago. Since running the update none of my apps work. All the App icons are still there but when you select an app it just tries to start but is unsuccessful and just pops back to the home screen. ALL DOWNLOADED APPS ARE DOING

  • FCE & iDVD

    i've searched the internet the last 2 days and am unable to find the anser to my problems. can anyone help? problem 1) I created a video in FCE. 16:9. I want to export so I can upload to a website. When I try every combination of export (quicktime co

  • Audio stops in iTunes during play

    I'm having a consistent problem with iTunes 10.5.2 for the mac.  I'll select a playlist to play music, and that works fine for awhile.  Then the audio stops while the timeline continues to move.  Eventually, the audio comes back, but it might take as