0

I have small gear with tomcat cartridge. When I try to execute war that that generate images with Java3D I get following exception:

Caused by: java.lang.ClassNotFoundException: javax.media.j3d.Node

As a first think I tried to add Java3D at classpath, I have added to my pom.xml:

<dependency>
    <groupId>java3d</groupId>
    <artifactId>j3d-core-utils</artifactId>
    <version>1.3.1</version>
    <scope>compile</scope>
</dependency>

This added to final war following artifacts:

[INFO] +- java3d:j3d-core-utils:jar:1.3.1:compile
[INFO] |  +- java3d:vecmath:jar:1.3.1:compile
[INFO] |  \- java3d:j3d-core:jar:1.3.1:compile

When I deployd adjusted war following exception raised:

Caused by: java.lang.UnsatisfiedLinkError: no J3D in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)

As far as I understand exception, it says that there are no native Java3D libraries at java.library.path. So I installed Java3D from suggested link, I also updated j3dcore.jar, j3dutils.jar and vecmath.jar. Also catalina.sh was updated:

export LD_LIBRARY_PATH=/var/lib/openshift/<my-application-id>/app-root/data/j3d-1_5_2-linux-amd64/lib/amd64

I suppose that there is no X11 server to work with, because of that Java3D have to run in headless mode. It could be set in catalina.sh like this:

JAVA_OPTS=${JAVA_OPTS}" -Djava.awt.headless=true"

Now it seems that all java3D classes and *.so libraries are found. Now there is another problem:

java.awt.HeadlessException
at sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:64)

Problem is that Java3D class Canvas3D can't work in headless mode. Only way could be to connect to some X11 server with screen. It could be done with export DISPLAY=:0.0

As far as I was able to test, it seems that there is no X11 server, providing screen to which could Java3D connect. Because of that it's not possible to run Java3D at OpenShift platform with tomcat cartridge.

Thanks for your help.

1
  • I am checking with devops to see if that package is installed.
    – user2879327
    Mar 11, 2014 at 18:15

1 Answer 1

0

Have you tried adding it to your pom.xml to get installed via maven? Or add the .jar file to your project manually... http://mvnrepository.com/artifact/java3d/j3d-core-utils/1.3.1

You might require more than just the core package.

Since you are deploying a war file, and not using maven, i think you would need to download the jar files and embed them in your war file as libraries and use them.

You might also check out this article: https://www.openshift.com/kb/kb-e1087-how-to-include-libraries-jar-files-in-your-java-application-without-using-maven

It looks like there is also a .so file that you would need to include with something like -Djava.library.path

Here is the file with the jars & .so file on java.net http://download.java.net/media/java3d/builds/release/1.5.2/j3d-1_5_2-linux-amd64.zip

Speaking with the dev ops team, it does not seem that package is installed on the servers.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.