Skip to content
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

Trouble starting JVM while pointing to a specific jar #1175

Open
dmorales6m opened this issue Mar 1, 2024 · 1 comment
Open

Trouble starting JVM while pointing to a specific jar #1175

dmorales6m opened this issue Mar 1, 2024 · 1 comment

Comments

@dmorales6m
Copy link

I've developed a custom utility in Python that leverages JPype for accessing the Document Foundation Class via the dfc.jar file. Locally, my utility operates as expected without any issues. However, I've encountered a problem when deploying and running it on a client server machine. Specifically, the utility crashes when attempting to start the JVM with the classpath pointed at the dfc.jar file.

Currently the utility is just trying to connect to a Documentum Server, I have compiled to an .exe using pyinstaller and placed the dfc.jar file under the same directory in a folder titled 'dfc_jar'.

Here's the code snippet where the utility fails on the server:

  def start_jvm(self):
      exe_dir = os.path.dirname(sys.executable)
      jar_path = os.path.join(exe_dir, r"dfc_jar\dfc.jar")
      
      jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.class.path=" + jar_path) # CRASHING HERE.
      
      if jpype.isJVMStarted():
        print("JVM started successfully with default JVM.")

I have Verified the path to dfc.jar on the server is correct.
Tried adjusting JVM start-up parameters and classpath formatting to no avail.

Are there known compatibility issues with JPype when accessing specific jar files like dfc.jar on server environments?
Is there a recommended approach to diagnose or log more detailed information about the failure to start the JVM in such cases?

I greatly appreciate any insights, suggestions, or guidance the community can offer.
Thank you for your time and assistance!

@Thrameos
Copy link
Contributor

Thrameos commented Mar 2, 2024

I am not sure what you mean by crash. It did't find the jar? It segfaulted?

Also use the classpath keyword rather than setting it manually. Manual setting is not portable across architectures as the path separator changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants