aspose file tools*
The moose likes Java in General and the fly likes com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize" Watch "com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize" New topic
Author

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

Michel Legris
Greenhorn

Joined: Feb 21, 2012
Posts: 19
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

Joined: Oct 27, 2005
Posts: 19696
    
  20

Is the class in a package called Com? I don't see that in your class definition.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Michel Legris
Greenhorn

Joined: Feb 21, 2012
Posts: 19
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

Joined: Oct 27, 2005
Posts: 19696
    
  20

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize