Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: How to Use Instrumentation API

  1. #1
    Member
    Join Date
    Mar 2011
    Posts
    84
    My Mood
    Daring
    Thanks
    17
    Thanked 1 Time in 1 Post

    Question How to Use Instrumentation API

    Hi
    I want to check the memory allocation of my objects. As far as I know that java has a concept of agent which need to be passed to the JVM during startup.
    Well I'm trying to use an API viz. classmexer which need to be passed to jvm as described there.
    I did all those things as told ( so far the notion I have is I need to create a agent so that I can have a instance of instrumentation from JVM).

    before I show what I did here are the some facts about my application.

    Application server using : Resin 4.0.38
    JDK in use : 1.6.10
    using ant for build and deployment.
    Passing jvm argument in servers config file as below:

    Note : able to compile successfully.

    HTML Code:
    <resin xmlns="http://caucho.com/ns/resin"
           xmlns:resin="http://caucho.com/ns/resin/core">
    
      <resin:import path="${resin.home}/conf/base.xml"/>
    
      <cluster id="app-tier">
    
        <resin:import path="${resin.home}/conf/base-cluster.xml"/>
        <dependency-check-interval>1s</dependency-check-interval>
    
        <server-default>
    
          <!--
             - The JVM arguments
            -->
          <jvm-arg>-Xmx512m</jvm-arg>
          <jvm-arg>-Xss1m</jvm-arg>
          <jvm-arg>-Xdebug</jvm-arg>
          <jvm-arg>-XX:MaxPermSize=128m</jvm-arg>
          <jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>
            <jvm-arg>-javaagent:classmexer.jar</jvm-arg>------------------------>> is the jar file which is located in application's lib folder


    when I start my server I get following Error on servers console:


    HTML Code:
    Error opening zip file or JAR manifest missing : classmexer.jar
    Error occurred during initialization of VM
    agent library failed to init: instrument

    This classmexer.jar contains a manifest file under manifest folder.

    all I want is a helping hand to start JVM with this agent!!!
    Kiindly tell me where I got it wrong?

    Thanking you in advance.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: How to Use Instrumentation API

    I don't know anything about this agent stuff you're talking about, but if you want to analyze the memory usage of your program, I recommend using eclipse's memory analyzer tool: Eclipse Memory Analyzer Open Source Project
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. The Following User Says Thank You to KevinWorkman For This Useful Post:

    arvindbis (September 5th, 2014)

  4. #3
    Member
    Join Date
    Mar 2011
    Posts
    84
    My Mood
    Daring
    Thanks
    17
    Thanked 1 Time in 1 Post

    Default Re: How to Use Instrumentation API

    Thank for your wonderful suggestion.

    But Question Comes here that we should a article about the instrumentation API available in Java.
    What do you say?

  5. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: How to Use Instrumentation API

    I would say, "What's the question?"

  6. #5
    Member
    Join Date
    Mar 2011
    Posts
    84
    My Mood
    Daring
    Thanks
    17
    Thanked 1 Time in 1 Post

    Default Re: How to Use Instrumentation API

    Quote Originally Posted by GregBrannon View Post
    I would say, "What's the question?"
    Sorry Typing mistake.
    The Question is :

    Should we create an article about the instrumentation API here on JPF?

  7. #6
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: How to Use Instrumentation API

    A tutorial perhaps? Did you have one in mind? Were you offering to post one, or are you looking for one from someone else?

Similar Threads

  1. Is this code an API? Beginner learning to write an API and decoupling.
    By Learning2Java in forum Java Theory & Questions
    Replies: 3
    Last Post: April 22nd, 2014, 12:59 PM
  2. jdbc instrumentation using 'asm' byte code manipulation framework
    By Rashmi123456 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: September 25th, 2013, 09:58 AM
  3. In need of API
    By Flamz in forum Java Theory & Questions
    Replies: 1
    Last Post: April 7th, 2013, 08:45 AM
  4. Bytecode Instrumentation
    By rohitdhall07 in forum Java Theory & Questions
    Replies: 2
    Last Post: July 28th, 2011, 10:22 AM
  5. Difference between Speech API and Sound API
    By zeeshanmirza in forum Java SE APIs
    Replies: 1
    Last Post: October 22nd, 2009, 12:22 AM