Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize

 
Michel Legris
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are trying to make a **simple** hello World agent class but the agent cannot be initialized

ex:

ex: (the AgentClass)

The manifest look like this :
Manifest-Version: 1.0
Premain-Class: Com.MyAgent
Agent-Class: Com.MyAgent
Created-By: 1.6.0_06 (Sun Microsystems Inc.)

Note : I tried with premain, agentmain etc... any possible way and it's not working

We always get the error : com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize

How the hell the loaded agent jar can be correctly initialized ??? I know there is many possible cause but we tried almost anything

Thanks

Michel
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the class in a package called Com? I don't see that in your class definition.
 
Michel Legris
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob for trying to help.

the "com" was an error for the posted example (sorry my bad)

We finally found the problem....we need to restart the application (the one to "inject" the agent) or the old jar (from a previous compilation) will be used instead.

I was not really comfortable with java packaging and even java in general so I had to learn a little bit more to make it work

Thanks again

Michel
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic