No GeometryService implementation found (Font3D related!)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

No GeometryService implementation found (Font3D related!)

unixnerd
Exception in thread java.lang.IllegalStateException: No GeometryService implementation found. Please add j3d-core-utils to the classpath.
        at org.jogamp.java3d.Font3D.newGeometryService(Font3D.java:956)

In this thread https://forum.jogamp.org/Java3D-1-6-0-Released-td4037525.html it mentions the problem and how to fix it but I'm struggling a bit. My code works fine in Eclipse but not as a stand alone jar.

Has this fix made it into a newer distribution? If not what exactly do I need to do? Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: No GeometryService implementation found (Font3D related!)

unixnerd
Sorry, really at a roadblock with this. The code that's causing the exception is:

private GeometryService newGeometryService() {
	final ServiceLoader<GeometryService> gsLoader =
		ServiceLoader.load(GeometryService.class);

	final Iterator<GeometryService> iter = gsLoader.iterator();
	if (iter.hasNext()) return iter.next();

	throw new IllegalStateException("No GeometryService implementation found. "
		+ "Please add j3d-core-utils to the classpath.");
}

Can I put something in my code to load the relevant class before calling Text3D?
Reply | Threaded
Open this post in threaded view
|

Re: No GeometryService implementation found (Font3D related!)

gouessej
Administrator
In reply to this post by unixnerd
Hello

It's a matter of SPI, something is missing in the directory "META-INF" or it's pointing to the wrong class or the classpath is correct but missing.

java3d-utils-1.7.2.jar/META-INF/services/org.jogamp.java3d.GeometryService contains:
org.jogamp.java3d.utils.geometry.GeometryServiceImpl

GeometryServiceImpl.class is in java3d-utils-1.7.2.jar

The matter doesn't come from Java3D, it comes from your use, java3d-utils should be in your classpath. This is not a bug for sure. When you create your standalone JAR, you have to include the whole content of all necessary dependencies, including the content of META-INF and all necessary classes.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: No GeometryService implementation found (Font3D related!)

unixnerd
It's surprising but I've been using Java since 1.0 and never had to deal with services!

In my META-INF/servcies I made a file called org.jogamp.java3d.GeometryService with the line org.jogamp.java3d.utils.geometry.GeometryServiceImpl

All now works :-) And of course you're correct, this isn't a bug.
Reply | Threaded
Open this post in threaded view
|

Re: No GeometryService implementation found (Font3D related!)

gouessej
Administrator
This post was updated on .
Services have existed since at least Java 1.6.

How do you create your standalone JAR? If you merge correctly all necessary JARs into a single one without forgetting resources, it will work. Maybe we should anticipate similar concerns.

I assume that you used Eclipse to create a standalone JAR, maybe using a build tool like Ant, Gradle or Maven would be more flexible and more viable on the long term. Maybe this helps:
https://jogamp.org/wiki/index.php/JogAmp_JAR_File_Handling#Fat-Jar
Julien Gouesse | Personal blog | Website