You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by kojak <ke...@gmail.com> on 2011/02/03 16:51:48 UTC

Error: com.ibm.tools.attach.AttachNotSupportedException

Hi,

I've written a simple program to persist a bean using OpenJPA 2.0.1.  The
code works fine with the Sun JRE; however, with  the IBM JRE (both are 1.6). 
I receive the following error. Does anyone have any ideas as to what could
be going on?

com.ibm.tools.attach.AttachNotSupportedException: target not found
at
com.ibm.tools.attach.javaSE.VirtualMachineImpl.tryAttachTarget(VirtualMachineImpl.java:303)
at
com.ibm.tools.attach.javaSE.VirtualMachineImpl.attachTarget(VirtualMachineImpl.java:86)
at
com.ibm.tools.attach.javaSE.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:37)
at
ibm.tools.attach.J9AttachProvider.attachVirtualMachine(J9AttachProvider.java:60)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:221)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at
org.apache.openjpa.enhance.InstrumentationFactory.loadAgent(InstrumentationFactory.java:286)
at
org.apache.openjpa.enhance.InstrumentationFactory.access$300(InstrumentationFactory.java:51)
at
org.apache.openjpa.enhance.InstrumentationFactory$1.run(InstrumentationFactory.java:118)
at java.security.AccessController.doPrivileged(AccessController.java:202)
at
org.apache.openjpa.enhance.InstrumentationFactory.getInstrumentation(InstrumentationFactory.java:90)
at
org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:95)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:324)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:100)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:154)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:65)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:152)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:72)




IBM JRE:
java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build pxi3260sr9-20101125_01(SR9))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32
jvmxi3260sr9-20101124_69295 (JIT enabled, AOT enabled)
J9VM - 20101124_069295
JIT - r9_20101028_17488ifx2
GC - 20101027_AA)
JCL - 20101119_01

Sun JRE
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Server VM (build 19.0-b09, mixed mode) 

Thanks in advance...
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Error-com-ibm-tools-attach-AttachNotSupportedException-tp5989284p5989284.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Error: com.ibm.tools.attach.AttachNotSupportedException

Posted by Tobias Trelle <to...@codecentric.de>.
Using bytecode enhancement at build time and the

    -Dopenjpa.DynamicEnhancementAgent=false

switch at runtime solved the problem without the need to change the JAR's
manifest or something else.

Thanks to all
Tobias

--
View this message in context: http://openjpa.208410.n2.nabble.com/Error-com-ibm-tools-attach-AttachNotSupportedException-tp5989284p6629665.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Error: com.ibm.tools.attach.AttachNotSupportedException

Posted by Rick Curtis <cu...@gmail.com>.
> enhancing the classes at build time, so no runtime enhancing would be
necessary.
+1 that gets my vote.

You'll need to set the property openjpa.DynamicEnhancementAgent=false to
tell the runtime to not try to use the AttachAPI.

Thanks,
Rick

On Mon, Jul 25, 2011 at 5:04 AM, Tobias Trelle <tobias.trelle@codecentric.de
> wrote:

> A colleague came up with the following idea: enhancing the classes at build
> time, so no runtime enhancing would be necessary. We will try this and I'll
> report later.
>
> Did you try this already?
>
> Cheers,
> Tobias
>
> --
>



-- 
*Rick Curtis*

Re: Error: com.ibm.tools.attach.AttachNotSupportedException

Posted by Tobias Trelle <to...@codecentric.de>.
A colleague came up with the following idea: enhancing the classes at build
time, so no runtime enhancing would be necessary. We will try this and I'll
report later.

Did you try this already?

Cheers,
Tobias

--
View this message in context: http://openjpa.208410.n2.nabble.com/Error-com-ibm-tools-attach-AttachNotSupportedException-tp5989284p6617732.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Error: com.ibm.tools.attach.AttachNotSupportedException

Posted by kojak <ke...@gmail.com>.
AFAIK, the only way to accomplish this is add that attribute or convince IBM
that they should implement that feature in their JRE.

Cheers,
Keith

--
View this message in context: http://openjpa.208410.n2.nabble.com/Error-com-ibm-tools-attach-AttachNotSupportedException-tp5989284p6617456.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Error: com.ibm.tools.attach.AttachNotSupportedException

Posted by Tobias Trelle <to...@codecentric.de>.
I'm encountering the same error:

 com.ibm.tools.attach.AttachNotSupportedException: target not found
 	at
com.ibm.tools.attach.javaSE.VirtualMachineImpl.tryAttachTarget(VirtualMachineImpl.java:303)
 	at
com.ibm.tools.attach.javaSE.VirtualMachineImpl.attachTarget(VirtualMachineImpl.java:86)
 	at
com.ibm.tools.attach.javaSE.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:37)
 	at
ibm.tools.attach.J9AttachProvider.attachVirtualMachine(J9AttachProvider.java:60)
 	at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:221)
 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
 	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
 	at java.lang.reflect.Method.invoke(Method.java:611)
 	at
org.apache.openjpa.enhance.InstrumentationFactory.loadAgent(InstrumentationFactory.java:286)
 	at
org.apache.openjpa.enhance.InstrumentationFactory.access$300(InstrumentationFactory.java:51)
 	at
org.apache.openjpa.enhance.InstrumentationFactory$1.run(InstrumentationFactory.java:118)
 	at java.security.AccessController.doPrivileged(AccessController.java:202)
 	at
org.apache.openjpa.enhance.InstrumentationFactory.getInstrumentation(InstrumentationFactory.java:90)
 	at
org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:95)
 	at
org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:324)
 	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:100)
 	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:154)
 	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:65)
 	at javax.persistence.Persistence.createEntityManagerFactory(Unknown
Source)
...

using OpenJPA 2.0.1 on z/OS using this JVM:

JVMJZBL1001N JZOS batch Launcher Version: 2.3.0 2008-05-12                      
JVMJZBL1002N Copyright (C) IBM Corp. 2005. All rights reserved.                 
java version "1.6.0"                                                            
Java(TM) SE Runtime Environment (build pmz3160sr9ifx-20110208_02
(SR9+PM18528+IZ
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 z/OS s390-31
jvmmz3160sr9-20101209_70
J9VM - 20101209_070480                                                          
JIT  - r9_20101028_17488ifx3                                                    
GC   - 20101027_AA)

Do I really have to modify the Can-Retransform-Classes property in the
manifest file or can this be overridden by a JVM startup parameter?

TIA,
Tobias



--
View this message in context: http://openjpa.208410.n2.nabble.com/Error-com-ibm-tools-attach-AttachNotSupportedException-tp5989284p6617309.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Error: com.ibm.tools.attach.AttachNotSupportedException

Posted by kojak <ke...@gmail.com>.
Rick,

Sorry about the delayed response, but setting "Can-Retransform-Classes:
false" in the manifest file *did* fix the problem.

Apparently, the IBM JRE does not support runtime class re-transformation
(which you probably already know).  Based on this information, I'm assuming
that it would be a best practice to manually run
"org.apache.openjpa.enhance.PCEnhancer" if you are expecting to run with the
IBM JRE so that OpenJPA can take advantage of the enhanced classes for the
IBM JRE, correct?

Also, apparently you can query the JRE to determine it's capabilities via
the 
http://download.oracle.com/javase/1.5.0/docs/guide/jvmti/jvmti.html#GetCapabilities
JVM TI .  This would allow you to determine (at runtime) if the JRE was
capable of class re-transformation; however, I suspect you'd have to write a
JNI interface to get to it which might not be acceptable for a pure Java
solution.


Cheers,
Keith
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Error-com-ibm-tools-attach-AttachNotSupportedException-tp5989284p6025413.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Error: com.ibm.tools.attach.AttachNotSupportedException

Posted by Rick Curtis <cu...@gmail.com>.
Can you try changing Can-Retransform-Classes to false?

Thanks,
Rick

On Thu, Feb 3, 2011 at 12:21 PM, kojak <ke...@gmail.com> wrote:

>
> Rick,
>
> Sorry that didn't fix it.  Also, I read the bug at the link you posted.  I
> checked the manifest in apache-openjpa-2.1.0-20110201.173954-119-binary.zip
> and noticed that it was still set to...
> Can-Retransform-Classes: true
>
> I'm not sure if you intended to set it to false in the fix or if you're
> inspecting the JRE at runtime to see if it is IBM and then deciding what to
> do.
>
> OpenJPA version used: apache-openjpa-2.1.0-20110201.173954-119-binary.zip
>
> Error:
>
> INFO: Java Version: 1.6.0 from IBM Corporation
> Exception in thread "Attachment 54431"
> java.lang.UnsupportedOperationException: cannot get the capability,
> performing dispose of the retransforming environment
>        at
> com.ibm.tools.attach.javaSE.Attachment.loadAgentLibraryImpl(Native
> Method)
>        at
>
> com.ibm.tools.attach.javaSE.Attachment.loadAgentLibrary(Attachment.java:243)
>        at
> com.ibm.tools.attach.javaSE.Attachment.parseLoadAgent(Attachment.java:221)
>        at
> com.ibm.tools.attach.javaSE.Attachment.doCommand(Attachment.java:140)
>        at com.ibm.tools.attach.javaSE.Attachment.run(Attachment.java:101)
> 399  HSQLDBTest  INFO   [main] openjpa.Runtime - OpenJPA dynamically loaded
> the class enhancer. Any classes that were not enhanced at build time will
> be
> enhanced when they are loaded by the JVM.
> 532  HSQLDBTest  INFO   [main] openjpa.Runtime - OpenJPA dynamically loaded
> a validation provider.
> 569  HSQLDBTest  INFO   [main] openjpa.Runtime - Starting OpenJPA
> 2.1.0-SNAPSHOT
> -

Re: Error: com.ibm.tools.attach.AttachNotSupportedException

Posted by kojak <ke...@gmail.com>.
Rick,

Sorry that didn't fix it.  Also, I read the bug at the link you posted.  I
checked the manifest in apache-openjpa-2.1.0-20110201.173954-119-binary.zip
and noticed that it was still set to...
Can-Retransform-Classes: true

I'm not sure if you intended to set it to false in the fix or if you're
inspecting the JRE at runtime to see if it is IBM and then deciding what to
do.

OpenJPA version used: apache-openjpa-2.1.0-20110201.173954-119-binary.zip

Error:

INFO: Java Version: 1.6.0 from IBM Corporation
Exception in thread "Attachment 54431"
java.lang.UnsupportedOperationException: cannot get the capability,
performing dispose of the retransforming environment
	at com.ibm.tools.attach.javaSE.Attachment.loadAgentLibraryImpl(Native
Method)
	at
com.ibm.tools.attach.javaSE.Attachment.loadAgentLibrary(Attachment.java:243)
	at
com.ibm.tools.attach.javaSE.Attachment.parseLoadAgent(Attachment.java:221)
	at com.ibm.tools.attach.javaSE.Attachment.doCommand(Attachment.java:140)
	at com.ibm.tools.attach.javaSE.Attachment.run(Attachment.java:101)
399  HSQLDBTest  INFO   [main] openjpa.Runtime - OpenJPA dynamically loaded
the class enhancer. Any classes that were not enhanced at build time will be
enhanced when they are loaded by the JVM.
532  HSQLDBTest  INFO   [main] openjpa.Runtime - OpenJPA dynamically loaded
a validation provider.
569  HSQLDBTest  INFO   [main] openjpa.Runtime - Starting OpenJPA
2.1.0-SNAPSHOT
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Error-com-ibm-tools-attach-AttachNotSupportedException-tp5989284p5989868.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Error: com.ibm.tools.attach.AttachNotSupportedException

Posted by Rick Curtis <cu...@gmail.com>.
Can you try running on 2.1.0.SNAPSHOT or trunk? I added support[1] for the
IBM jdk in 2.1.0.

[1] https://issues.apache.org/jira/browse/OPENJPA-1734

Thanks,
Rick

On Thu, Feb 3, 2011 at 9:51 AM, kojak <ke...@gmail.com> wrote:

>
> Hi,
>
> I've written a simple program to persist a bean using OpenJPA 2.0.1.  The
> code works fine with the Sun JRE; however, with  the IBM JRE (both are
> 1.6).
> I receive the following error. Does anyone have any ideas as to what could
> be going on?
>
> com.ibm.tools.attach.AttachNotSupportedException: target not found
> at
>
> com.ibm.tools.attach.javaSE.VirtualMachineImpl.tryAttachTarget(VirtualMachineImpl.java:303)
> at
>
> com.ibm.tools.attach.javaSE.VirtualMachineImpl.attachTarget(VirtualMachineImpl.java:86)
> at
>
> com.ibm.tools.attach.javaSE.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:37)
> at
>
> ibm.tools.attach.J9AttachProvider.attachVirtualMachine(J9AttachProvider.java:60)
> at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:221)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
> at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
> at java.lang.reflect.Method.invoke(Method.java:611)
> at
>
> org.apache.openjpa.enhance.InstrumentationFactory.loadAgent(InstrumentationFactory.java:286)
> at
>
> org.apache.openjpa.enhance.InstrumentationFactory.access$300(InstrumentationFactory.java:51)
> at
>
> org.apache.openjpa.enhance.InstrumentationFactory$1.run(InstrumentationFactory.java:118)
> at java.security.AccessController.doPrivileged(AccessController.java:202)
> at
>
> org.apache.openjpa.enhance.InstrumentationFactory.getInstrumentation(InstrumentationFactory.java:90)
> at
>
> org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:95)
> at
>
> org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:324)
> at
>
> org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:100)
> at
>
> org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:154)
> at
>
> org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:65)
> at
>
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:152)
> at
>
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:72)
>
>
>
>
> IBM JRE:
> java -version
> java version "1.6.0"
> Java(TM) SE Runtime Environment (build pxi3260sr9-20101125_01(SR9))
> IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32
> jvmxi3260sr9-20101124_69295 (JIT enabled, AOT enabled)
> J9VM - 20101124_069295
> JIT - r9_20101028_17488ifx2
> GC - 20101027_AA)
> JCL - 20101119_01
>
> Sun JRE
> java version "1.6.0_23"
> Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
> Java HotSpot(TM) Server VM (build 19.0-b09, mixed mode)
>

Re: Error: com.ibm.tools.attach.AttachNotSupportedException (update)

Posted by kojak <ke...@gmail.com>.
After doing some googleing, I found a post with a similar problem.
Apparently, the IBM JRE creates a folder in /tmp called
.com_ibm_tools_attach. This folder was created after I installed the JRE and
ran "java -version" to test the installed version. Apparently, the
permissions on the folder were root as I ran "java -version" as root.

drwxr-xr-x 2 root root 4096 Feb 2 10:45 .com_ibm_tools_attach

I have now removed the folder and it has been recreated with permissions
associated with the user running the application (i.e. me)...

drwxrwxrwt 2 me me 4096 Feb 3 11:00 .com_ibm_tools_attach

Unfortunately, now I am receiving a different error...
Exception in thread "Attachment 60134"
java.lang.UnsupportedOperationException: cannot get the capability,
performing dispose of the retransforming environment
	at com.ibm.tools.attach.javaSE.Attachment.loadAgentLibraryImpl(Native
Method)
	at
com.ibm.tools.attach.javaSE.Attachment.loadAgentLibrary(Attachment.java:243)
	at
com.ibm.tools.attach.javaSE.Attachment.parseLoadAgent(Attachment.java:221)
	at com.ibm.tools.attach.javaSE.Attachment.doCommand(Attachment.java:140)
	at com.ibm.tools.attach.javaSE.Attachment.run(Attachment.java:101)
430  HSQLDBTest  INFO   [main] openjpa.Runtime - OpenJPA dynamically loaded
the class enhancer. Any classes that were not enhanced at build time will be
enhanced when they are loaded by the JVM.
489  HSQLDBTest  INFO   [main] openjpa.Runtime - Starting OpenJPA 2.0.1
599  HSQLDBTest  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.HSQLDictionary".

I also attempted to supply the "-Dcom.ibm.tools.attach.enable=no" argument
to the IBM JRE and received the same exception described in the first post. 
Argh...


-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Error-com-ibm-tools-attach-AttachNotSupportedException-tp5989284p5989379.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.