New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBM JDK Support #15

Closed
eostermueller opened this Issue Jan 3, 2012 · 10 comments

Comments

Projects
None yet
2 participants
@eostermueller
Contributor

eostermueller commented Jan 3, 2012

The InTrace javaagent throws an exception and fails to start with an IBM JDK.
Some of this is documented here:

#12 (comment)

Here is the JVM that was used:

java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build pxa6460sr7ifix-20100220_02(SR7+IZ69890+IZ70326))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux amd64-64 jvmxa6460sr7-20100219_54097 (JIT enabled, AOT enabled)
J9VM - 20100219_054097
JIT - r9_20091123_13891
GC - 20100216_AA)
JCL - 20091202_01

Here is the full exception, which is also at the above link:

Buildfile: build.xml

init:

run:
[java] ## Loaded InTrace Agent.
[java] Exception in thread "main" java.lang.UnsupportedOperationException: cannot get the capability, performing dispose of the retransforming environment
[java] at sun.instrument.InstrumentationImpl.isRetransformClassesSupported0(Native Method)
[java] at sun.instrument.InstrumentationImpl.isRetransformClassesSupported(InstrumentationImpl.java:124)
[java] at sun.instrument.InstrumentationImpl.addTransformer(InstrumentationImpl.java:79)
[java] at org.intrace.agent.AgentInit.initialize(AgentInit.java:41)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[java] at java.lang.reflect.Method.invoke(Method.java:600)
[java] at org.intrace.agent.Agent.initialize(Agent.java:66)
[java] at org.intrace.agent.Agent.premain(Agent.java:26)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[java] at java.lang.reflect.Method.invoke(Method.java:600)
[java] at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:335)
[java] at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:350)
[java] Exception in thread "main" java.lang.reflect.InvocationTargetException
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[java] at java.lang.reflect.Method.invoke(Method.java:600)
[java] at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:335)
[java] at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:350)
[java] Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[java] at org.intrace.agent.Agent.initialize(Agent.java:70)
[java] at org.intrace.agent.Agent.premain(Agent.java:26)
[java] ... 6 more
[java] Caused by: java.lang.reflect.InvocationTargetException
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[java] at java.lang.reflect.Method.invoke(Method.java:600)
[java] at org.intrace.agent.Agent.initialize(Agent.java:66)
[java] ... 7 more
[java] Caused by: java.lang.UnsupportedOperationException: adding retransformable transformers is not supported in this environment
[java] at sun.instrument.InstrumentationImpl.addTransformer(InstrumentationImpl.java:80)
[java] at org.intrace.agent.AgentInit.initialize(AgentInit.java:41)
[java] ... 12 more

 [java] Fatal error: processing of -javaagent failed

BUILD SUCCESSFUL
Total time: 0 seconds

@mchr3k

This comment has been minimized.

Show comment
Hide comment
@mchr3k

mchr3k Jan 3, 2012

Owner

Try the following file: http://intracesite.appspot.com/files/intrace-agent-beta.jar

This should disable the use of retransformation.

Owner

mchr3k commented Jan 3, 2012

Try the following file: http://intracesite.appspot.com/files/intrace-agent-beta.jar

This should disable the use of retransformation.

@eostermueller

This comment has been minimized.

Show comment
Hide comment
@eostermueller

eostermueller Jan 3, 2012

Contributor

You're quick and that worked, thanks.
But still need to hide this one exception:

 [java] ## Loaded InTrace Agent.****

 [java] Exception in thread "main"

java.lang.UnsupportedOperationException: cannot get the capability,
performing dispose of the retransforming environment****

 [java]     at

sun.instrument.InstrumentationImpl.isRetransformClassesSupported0(Native
Method)****

 [java]     at

sun.instrument.InstrumentationImpl.isRetransformClassesSupported(InstrumentationImpl.java:124)


 [java]     at org.intrace.agent.AgentInit.initialize(AgentInit.java:41)

 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native

Method)****

 [java]     at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)


 [java]     at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)


[java]     at java.lang.reflect.Method.invoke(Method.java:600)****

 [java]     at org.intrace.agent.Agent.initialize(Agent.java:66)****

 [java]     at org.intrace.agent.Agent.premain(Agent.java:26)****

 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native

Method)****

 [java]     at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)


 [java]     at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)


 [java]     at java.lang.reflect.Method.invoke(Method.java:600)****

 [java]     at

sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:335)


 [java]     at

sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:350)


 [java] ## Retransform classes is not supported...****

 [java] ## InTrace Agent listening on port 9123****

[tp@spedl36018 build]$****

**

On Tue, Jan 3, 2012 at 3:40 PM, mchr3k <
reply@reply.github.com

wrote:

Try the following file:
http://intracesite.appspot.com/files/intrace-agent-beta.jar

This should disable the use of retransformation.


Reply to this email directly or view it on GitHub:
#15 (comment)

Contributor

eostermueller commented Jan 3, 2012

You're quick and that worked, thanks.
But still need to hide this one exception:

 [java] ## Loaded InTrace Agent.****

 [java] Exception in thread "main"

java.lang.UnsupportedOperationException: cannot get the capability,
performing dispose of the retransforming environment****

 [java]     at

sun.instrument.InstrumentationImpl.isRetransformClassesSupported0(Native
Method)****

 [java]     at

sun.instrument.InstrumentationImpl.isRetransformClassesSupported(InstrumentationImpl.java:124)


 [java]     at org.intrace.agent.AgentInit.initialize(AgentInit.java:41)

 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native

Method)****

 [java]     at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)


 [java]     at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)


[java]     at java.lang.reflect.Method.invoke(Method.java:600)****

 [java]     at org.intrace.agent.Agent.initialize(Agent.java:66)****

 [java]     at org.intrace.agent.Agent.premain(Agent.java:26)****

 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native

Method)****

 [java]     at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)


 [java]     at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)


 [java]     at java.lang.reflect.Method.invoke(Method.java:600)****

 [java]     at

sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:335)


 [java]     at

sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:350)


 [java] ## Retransform classes is not supported...****

 [java] ## InTrace Agent listening on port 9123****

[tp@spedl36018 build]$****

**

On Tue, Jan 3, 2012 at 3:40 PM, mchr3k <
reply@reply.github.com

wrote:

Try the following file:
http://intracesite.appspot.com/files/intrace-agent-beta.jar

This should disable the use of retransformation.


Reply to this email directly or view it on GitHub:
#15 (comment)

@eostermueller

This comment has been minimized.

Show comment
Hide comment
@eostermueller

eostermueller Jan 4, 2012

Contributor

After looking at this closer, IBM doc advertises support for the features being flagged as "unsupported" in the stacktrace.

I've posted the following question to IBM with the details, including how to reproduce the problem:
https://www.ibm.com/developerworks/forums/thread.jspa?threadID=413792

Contributor

eostermueller commented Jan 4, 2012

After looking at this closer, IBM doc advertises support for the features being flagged as "unsupported" in the stacktrace.

I've posted the following question to IBM with the details, including how to reproduce the problem:
https://www.ibm.com/developerworks/forums/thread.jspa?threadID=413792

@mchr3k

This comment has been minimized.

Show comment
Hide comment
@mchr3k

mchr3k Jan 5, 2012

Owner

I've just read your post and spotted a mistake. InTrace is not a JVMTI agent. InTrace is a Java Agent.

Owner

mchr3k commented Jan 5, 2012

I've just read your post and spotted a mistake. InTrace is not a JVMTI agent. InTrace is a Java Agent.

@eostermueller

This comment has been minimized.

Show comment
Hide comment
@eostermueller

eostermueller Jan 5, 2012

Contributor

thx checking that.

I knew I was taking a leap when I wrote that, but help me understand.
So is a "java agent" something that abides by this:
http://docs.oracle.com/javase/6/docs/api/java/lang/instrument/package-summary.html
?

Does that mean that both "Java agents" and JVMTI programs have
"RetransformClasses" functionality? like this:

http://docs.oracle.com/javase/6/docs/platform/jvmti/jvmti.html#RetransformClasses

--Erik

On Thu, Jan 5, 2012 at 12:12 PM, mchr3k <
reply@reply.github.com

wrote:

I've just read your post and spotted a mistake. InTrace is not a JVMTI
agent. InTrace is a Java Agent.


Reply to this email directly or view it on GitHub:
#15 (comment)

Contributor

eostermueller commented Jan 5, 2012

thx checking that.

I knew I was taking a leap when I wrote that, but help me understand.
So is a "java agent" something that abides by this:
http://docs.oracle.com/javase/6/docs/api/java/lang/instrument/package-summary.html
?

Does that mean that both "Java agents" and JVMTI programs have
"RetransformClasses" functionality? like this:

http://docs.oracle.com/javase/6/docs/platform/jvmti/jvmti.html#RetransformClasses

--Erik

On Thu, Jan 5, 2012 at 12:12 PM, mchr3k <
reply@reply.github.com

wrote:

I've just read your post and spotted a mistake. InTrace is not a JVMTI
agent. InTrace is a Java Agent.


Reply to this email directly or view it on GitHub:
#15 (comment)

@mchr3k

This comment has been minimized.

Show comment
Hide comment
@mchr3k

mchr3k Jan 5, 2012

Owner

Yes a Java Agent is based on the java.lang.instrument package.

This page from another one of my projects gives an overview of the various developer APIs in the JVM: http://mchr3k.github.com/org.inmemprofiler/implementationdetails.html

JVMTI is a native API for doing bytecode instrumentation (amongst many other things). Java Agents are a way of doing a subset of what JVMTI does but in pure Java.

Owner

mchr3k commented Jan 5, 2012

Yes a Java Agent is based on the java.lang.instrument package.

This page from another one of my projects gives an overview of the various developer APIs in the JVM: http://mchr3k.github.com/org.inmemprofiler/implementationdetails.html

JVMTI is a native API for doing bytecode instrumentation (amongst many other things). Java Agents are a way of doing a subset of what JVMTI does but in pure Java.

@eostermueller

This comment has been minimized.

Show comment
Hide comment
@eostermueller

eostermueller Jan 5, 2012

Contributor

thanks for that education, very helpful.
I just replied to my IBM forum question, correcting this point.

On Thu, Jan 5, 2012 at 1:19 PM, mchr3k <
reply@reply.github.com

wrote:

Yes a Java Agent is based on the java.lang.instrument package.

This page from another one of my projects gives an overview of the various
developer APIs in the JVM:
http://mchr3k.github.com/org.inmemprofiler/implementationdetails.html

JVMTI is a native API for doing bytecode instrumentation (amongst many
other things). Java Agents are a way of doing a subset of what JVMTI does
but in pure Java.


Reply to this email directly or view it on GitHub:
#15 (comment)

Contributor

eostermueller commented Jan 5, 2012

thanks for that education, very helpful.
I just replied to my IBM forum question, correcting this point.

On Thu, Jan 5, 2012 at 1:19 PM, mchr3k <
reply@reply.github.com

wrote:

Yes a Java Agent is based on the java.lang.instrument package.

This page from another one of my projects gives an overview of the various
developer APIs in the JVM:
http://mchr3k.github.com/org.inmemprofiler/implementationdetails.html

JVMTI is a native API for doing bytecode instrumentation (amongst many
other things). Java Agents are a way of doing a subset of what JVMTI does
but in pure Java.


Reply to this email directly or view it on GitHub:
#15 (comment)

@eostermueller

This comment has been minimized.

Show comment
Hide comment
@eostermueller

eostermueller Jan 6, 2012

Contributor

Ok, I fixed it.

I downloaded the regular intrace-agent.jar and added the following to the MANIFEST.MF:
Can-Retransform-Classes: true

...and now it all works great on the IBM JDK. Agent starts w/o error and can dynamically add/remove instrumented classes.

So it looks like the Oracle JDK doesn't pay attention to this attribute and IBM does.
Could you add this attribute?

Thanks,
--Erik

Contributor

eostermueller commented Jan 6, 2012

Ok, I fixed it.

I downloaded the regular intrace-agent.jar and added the following to the MANIFEST.MF:
Can-Retransform-Classes: true

...and now it all works great on the IBM JDK. Agent starts w/o error and can dynamically add/remove instrumented classes.

So it looks like the Oracle JDK doesn't pay attention to this attribute and IBM does.
Could you add this attribute?

Thanks,
--Erik

@mchr3k

This comment has been minimized.

Show comment
Hide comment
@mchr3k

mchr3k Jan 6, 2012

Owner

Well spotted. The problem file is line 89 of https://github.com/mchr3k/org.intrace/blob/master/org.intrace/build.xml. I will get this fixed in the next couple of days.

Owner

mchr3k commented Jan 6, 2012

Well spotted. The problem file is line 89 of https://github.com/mchr3k/org.intrace/blob/master/org.intrace/build.xml. I will get this fixed in the next couple of days.

@mchr3k

This comment has been minimized.

Show comment
Hide comment
Owner

mchr3k commented Jan 14, 2012

@mchr3k mchr3k closed this Jan 14, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment