Hi Harald,

I don't think the VirtualMachine class (the class we're looking for in
tools.jar) has moved. I compared 1.6.0_22 and 1.6.0_25 and it's in the same
location - JDK_HOME/lib/tools.jar.

The problem here is that java.home is pointing to the JRE location instead
of the JDK location (which is what we've been doing in developing OpenJPA).

This looks like something we can fix by swizzling the classpath, but the
documentation does indicate that you need a JDK, or SDK to run :
 2.4.  Enhancing Dynamically at Runtime

If a javaagent is not provided via the command line and OpenJPA is running
on the Oracle 1.6 SDK or IBM 1.6 JDK (SR8+), OpenJPA will attempt to
dynamically load the Enhancer that was mentioned in the previous section.
This support is provided as an ease of use feature and it is not recommended
for use in a production system. Using this method of enhancement has the
following caveats:

<snip>

It doesn't mention the issue about JAVA_HOME though - we'll have to get that
updated.

In the mean time, can you use a javaagent instead?

-mike


On Thu, Jun 16, 2011 at 8:21 AM, Harald Wellmann <harald.wellm...@gmx.de>wrote:

> There's a problem with setting up dynamic enhancement for OpenJPA 2.1.0
> with recent Oracle JDKs on Linux, related to the java.home system property.
>
> org.apache.openjpa.enhance.InstrumentationFactory.findToolsJar()
> attempts to load the tools.jar from ${java.home}/lib/tools.jar.
>
> The problem is that even when running under the JDK, java.home points to
> /usr/lib/jvm/java-6-sun/jre instead of /usr/lib/jvm/java-6-sun.
>
> Just to rule out that Ubuntu's packaging might cause the problem, I
> downloaded the latest JDK 1.6.0_24, installed it in my home folder and
> ran a System.println(System.getProperty("java.home")  both from
> [java_install]/bin/java and [java_install]/jre/bin/java, and in both
> cases, the result was [java_install]/jre.
>
>
> So it appears the special case
>             if (JavaVendors.getCurrentVendor().isIBM()) {
>
> in findToolsJar() is now also required for Oracle's JDK.
>
> This looks like a bug or at least an incompatible change in the JDK to
> me, but then again, the structure of a JDK installation is vendor
> dependent, and I'm not sure that OpenJPA's lookup logic is failsafe.
>
> For now, I just created a symlink in my JDK so that OpenJPA finds
> tools.jar under .../jre/lib.
>
> Are there any better solutions? Should I file an issue in JIRA?
>
> Regards,
> Harald
>
> --
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
>

Reply via email to