Skip to main content

developerWorks >  Java technology  >  Forums  >  IBM Java Runtimes and SDKs  >  developerWorks

problems with java.lang.instrument APIs in 1.6 JRE    Point your RSS reader here for a feed of the latest messages in this thread


Tags for this thread: 

     

 
 

My developerWorks
 Welcome, Guest
Sign in or register
Permlink Replies: 5 - Pages: 1 - Last Post: Nov 17, 2009 11:53 AM Last Post By: ChrisBailey
seanfay

Posts: 3
Registered: Nov 02, 2009 01:23:42 PM
problems with java.lang.instrument APIs in 1.6 JRE
Posted: Nov 13, 2009 09:04:13 PM
Click to report abuse...   Click to reply to this thread Reply
I'm developing an application that makes use of the javaagent/java.lang.instrument APIs. In testing, I'm seeing what appears to be buggy behavior in the IBM 1.6 JRE when I make use of the redefineClasses() or retransformClasses() functionality.

When running an application with our agent, a legal and successful call to redefineClasses() causes the program to behave in unexpected ways, namely
-- causes the JRE to crash if the class that was redefined is a ClassLoader
-- causes the program to throw exceptions of the form “ClassCastException: X incompatible with X”, where X is the class that has been redefined
-- causes other less obvious runtime exceptions which I haven’t investigated in detail
Not all classes exhibit this problem. Some can be redefined without issue, and the symptoms do not reproduce with a simple test case.

The latest SR of the 1.5 JRE does not exhibit the same symptoms.

I have not yet opened a PMR as we do not have a support contract.
Ben Hardill

Posts: 578
Registered: Dec 02, 2004 09:25:48 AM
Re: problems with java.lang.instrument APIs in 1.6 JRE
Posted: Nov 16, 2009 05:45:49 AM   in response to: seanfay in response to: seanfay's post
Click to report abuse...   Click to reply to this thread Reply
Hi,

Since you can't open a pmr can you supply some more information:

1) The output of java -version for the java 6.0 you are using
2) What platform you are seeing this on
3) A more detailed description of one the 3 failure modes you have mentioned. If possible some sample code that demonstrates the problem.
4) Can you attach the javacores/standard error output from the failures?

Ben

ChrisBailey

Posts: 137
Registered: Dec 02, 2004 09:07:58 AM
Re: problems with java.lang.instrument APIs in 1.6 JRE
Posted: Nov 16, 2009 09:24:37 AM   in response to: Ben Hardill in response to: Ben Hardill's post
Click to report abuse...   Click to reply to this thread Reply
Hi:

You also say that the problem doesn't occur in the latest Java 5.0 SR. Does this mean the problem did exist in Java 5.0 previously? If so, at which level?
seanfay

Posts: 3
Registered: Nov 02, 2009 01:23:42 PM
Re: problems with java.lang.instrument APIs in 1.6 JRE
Posted: Nov 16, 2009 11:44:42 AM   in response to: Ben Hardill in response to: Ben Hardill's post
Click to report abuse...   Click to reply to this thread Reply
Here are two java versions I've tested with, both on Windows 2003 x86:

java version "1.6.0"
Java(TM) SE Runtime Environment (build pwi3260sr5ifix-20090623_01(SR5+151659+151951+151086+151619+151750+152177+152017+152507))
IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Windows Server 2003 x86-32 jvmwi3260sr5ifx-20090612_37149 (JIT enabled, AOT enabled)
J9VM - 20090612_037149_lHdSMr
JIT - r9_20090518_2017
GC - 20090417_AA)
JCL - 20090623_01

java version "1.6.0"
Java(TM) SE Runtime Environment (build pwi3260sr2-20080818_01(SR2))
IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Windows Server 2003 x86-32 jvmwi3260-20080816_22093 (JIT enabled, AOT enabled)
J9VM - 20080816_022093_lHdSMr
JIT - r9_20080721_1330ifx2
GC - 20080724_AA)
JCL - 20080808_02

I'm attaching javacore output from a crash. I'll work to provide more detail in the form of some demonstration code.
seanfay

Posts: 3
Registered: Nov 02, 2009 01:23:42 PM
Re: problems with java.lang.instrument APIs in 1.6 JRE
Posted: Nov 16, 2009 11:49:56 AM   in response to: ChrisBailey in response to: ChrisBailey's post
Click to report abuse...   Click to reply to this thread Reply
We noticed problems when testing on earlier Java 5.0 SRs, but I haven't looked at them in enough detail to say if they are of the same nature or not. I will try to investigate in more detail.
ChrisBailey

Posts: 137
Registered: Dec 02, 2004 09:07:58 AM
Re: problems with java.lang.instrument APIs in 1.6 JRE
Posted: Nov 17, 2009 11:53:25 AM   in response to: seanfay in response to: seanfay's post
Click to report abuse...   Click to reply to this thread Reply
Hi Sean:

Out of interest, are you trying to redefine core API classes (those loaded by the bootstrap class looader) or application classes?
If your redefining core classes, I'd suggest running with the following command line option:
-Xverify:all

To make sure that the redefinition of those classes are verified as well (by default there's no verification of the core classes as they are deemed to be "trusted").
 Tags
Help

Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular type of content or application that you're viewing.

My tags shows your tags for this particular type of content or application that you're viewing.

 

MoreLess 


Point your RSS reader here for a feed of the latest messages in all forums