Jpype on RHEL v3

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • benchline

    #1

    Jpype on RHEL v3

    I have been trying out jpype for python to java work and love it. It
    works great on my gentoo box with the java 1.4.2 blackdown sdk.

    I am now trying it on Red Hat Enterprise Linux 3 for access to business
    intelligence tools (JasperReports, Mondrian, Pentaho, etc) for which we
    don't have analogous tools in cpython yet. My idea it to use jpype in
    a cherrypy application server to tie these java BI tools into a website
    interface without having to delve into the more complex java J2EE
    application servers and lose all the python libraries that I know and
    love.

    Here is my problem.

    When trying to start the jvm with the sun jre I get this error.

    [root@servername root]# python2.4
    Python 2.4.2 (#1, Dec 1 2005, 05:44:04)
    [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-53)] on linux2
    Type "help", "copyright" , "credits" or "license" for more information.[color=blue][color=green][color=darkred]
    >>> import jpype
    >>> jpype.startJVM( '/usr/lib/jvm/java-1.4.2-sun/jre/lib/i386/client/libjvm.so')[/color][/color][/color]
    Error occurred during initialization of VM
    Unable to load native library: libjvm.so: cannot open shared object
    file: No such file or directory

    and then python dies.

    When I try to start the jvm with the ibm jre I get this error.

    [root@servername root]# python2.4
    Python 2.4.2 (#1, Dec 1 2005, 05:44:04)
    [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-53)] on linux2
    Type "help", "copyright" , "credits" or "license" for more information.[color=blue][color=green][color=darkred]
    >>> import jpype
    >>> jpype.startJVM( '/usr/lib/jvm/java-1.4.2-ibm-1.4.2.2/jre/bin/classic/libjvm.so')[/color][/color][/color]
    Unable to find UTE, path used libjava.so/libute.so
    JVMCI170: Please check the path to shared libraries
    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "/usr/lib/python2.4/site-packages/jpype/_core.py", line 25, in
    startJVM
    _jpype.startup( jvm, tuple(args), True)
    RuntimeError: Unable to start JVM at src/native/common/jp_env.cpp:54

    but the python interpreter is still running.

    Can anyone point me in the right direction so I can fix this?

    Thanks

  • benchline

    #2
    Re: Jpype on RHEL v3

    I found the problem. So if anyone else has it here is the fix.

    In the documentation distributed with JPype 0.5.1 in the examples/linux
    directory, there is a file that describes a problem with loading the
    jvm on linux. So one needs to modify the LD_LIBRARY_PATH environment
    variable to fix it.

    I did that after changing one line in
    /usr/lib/python2.4/site-packages/jpype/_linux.py line 37 to

    return "/etc/alternatives/java_sdk/jre/lib/i386/client/libjvm.so"

    so that jpype.getDefaul tJVMPath() would return the correct libjvm.so
    path for my install.

    Then I did

    export
    LD_LIBRARY_PATH =/etc/alternatives/java_sdk/jre/lib/i386:/etc/alternatives/java_sdk/jre/lib/i386/client

    after doing that the sun 1.4.2 jre loaded just fine with:
    [root@servername root]# python2.4
    Python 2.4.2 (#1, Dec 1 2005, 05:44:04)
    [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-53)] on linux2
    Type "help", "copyright" , "credits" or "license" for more information.[color=blue][color=green][color=darkred]
    >>> import jpype
    >>> jpype.startJVM( jpype.getDefaul tJVMPath())
    >>>[/color][/color][/color]

    Comment

    Working...