Plugin discover looks at one of the folders on the jar, where a text files list what implementations are available for each.
When using shading to remix jars - these text files need to be combined from multiple jars. The result is that the text files can be found on the classpath by ServiceLoader. https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html -- Jody Garnett On Wed, Feb 7, 2024 at 5:41 PM Phil Scadden <p.scad...@gns.cri.nz> wrote: > This turns out to be more a mystery than I first thought. I assumed the > when running under JPACKAGE, it was not finding the epsg database, but logs > didn’t show any sign of that. I requested stackdump in the exception, and I > get: > org.opengis.referencing.NoSuchAuthorityCodeException: No code "EPSG:2193" > from authority "EPSG" found for object of type "EngineeringCRS". > > at > org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.noSuchAuthorityException(CartesianAuthorityFactory.java:140) > > at > org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.createEngineeringCRS(CartesianAuthorityFactory.java:132) > > at > org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.createCoordinateReferenceSystem(CartesianAuthorityFactory.java:123) > > at > org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:811) > > at > org.geotools.referencing.factory.ThreadedAuthorityFactory.createCoordinateReferenceSystem(ThreadedAuthorityFactory.java:667) > > at > org.geotools.referencing.DefaultAuthorityFactory.createCoordinateReferenceSystem(DefaultAuthorityFactory.java:172) > > at org.geotools.referencing.CRS.decode(CRS.java:507) > > at org.geotools.referencing.CRS.decode(CRS.java:428) > > > > Reading this, I would assume that it didn’t find the plugin at all. > Relevant bits of pom: <dependency> > > <groupId>org.geotools</groupId> > > <artifactId>gt-referencing</artifactId> > > <version>${geotools.version}</version> > > </dependency> > > <dependency> > > <groupId>org.geotools</groupId> > > <artifactId>gt-epsg-wkt</artifactId> > > <version>${geotools.version}</version> > > </dependency> > > <dependency> > > <groupId>org.geotools</groupId> > > <artifactId>gt-epsg-extension</artifactId> > > <version>${geotools.version}</version> > > </dependency> > > <dependency> > > <groupId>org.geotools</groupId> > > <artifactId>gt-api</artifactId> > > <version>15.0</version> > > <type>jar</type> > > </dependency> > > > > ( I been trying both wkt and h2sql plugins – same result for h2sql). > > If I look at the shaded jar in the application image, I can see the plugin > classes. I am pretty hazy though about plugins work in java – what would be > reasons for the executable not to find them? As noted earlier, this works > fine if run as jar on a machine with java already installed. > > > > > > > > *From:* Jody Garnett <jody.garn...@gmail.com> > *Sent:* Thursday, February 1, 2024 9:55 PM > *To:* Phil Scadden <p.scad...@gns.cri.nz> > *Cc:* geotools-gt2-users@lists.sourceforge.net > *Subject:* Re: [Geotools-gt2-users] Using gt-referencing within an app > bundled with JPackage - where does the epsg database go. > > > > > > *CAUTION:* This email originated from outside of the organization. Do not > click links or open attachments unless you recognize the sender and know > the content is safe: > > If you have done sharing correctly then plugin discovery works. > > > > The zip is unpacked into the the temp folder I believe? Yes it is: > > > > File directory = new File(System.getProperty("java.io.tmpdir", > "."), "Geotools"); > > if (directory.isDirectory() || directory.mkdir()) { > > directory = new File(directory, "Databases/HSQL"); > > if (directory.isDirectory() || directory.mkdirs()) { > > return directory; > > } > > } > > > > You can also set a property "EPSG-HSQL.directory" to indicate where the > database is located. > > > > See > https://github.com/geotools/geotools/blob/main/modules/plugin/epsg-hsql/src/main/java/org/geotools/referencing/factory/epsg/hsql/HsqlEpsgDatabase.java > > > > -- > > Jody Garnett > > > > > > On Jan 31, 2024 at 8:07:47 PM, Phil Scadden <p.scad...@gns.cri.nz> wrote: > > I have a little console app (pushing excel sheet to a database), that runs > fine as a shaded jar with java. However, I have folk using it that are > reluctant to install java and I packaged it with JRT etc using JPackage. If > the code is launched with JPackage, then it doesn’t find the EPSG database. > Tried with both epgl-h2sql and epsg-wkt. No luck. JPackage allows me to > specify a resource directory, but no idea what it would be. When the app > runs, what exactly happens to say the EPSG.zip in epsg-h2sql for instance? > > > > ________________________________________________ > > Ngā mihi, Nā Phil Scadden (he/him) > > Te Raraunga me te Tātaritanga Mokowā Aronuku (Geospatial Data and > Analysis) > > *GNS Science **Te Pῡ Ao* > > 764 Cumberland St > <https://www.google.com/maps/search/764+Cumberland+St?entry=gmail&source=g>, > Private Bag 1930, > > Dunedin, New Zealand Ph +64 3 4799663, 027 3463185 > > > > “Whāia te iti kahurangi ki te tūohu koe me he maunga teitei” > > > > Notice: This email and any attachments are confidential and may not be > used, published or redistributed without the prior written consent of the > Institute of Geological and Nuclear Sciences Limited (GNS Science). If > received in error please destroy and immediately notify GNS Science. Do not > copy or disclose the contents. > > _______________________________________________ > GeoTools-GT2-Users mailing list > GeoTools-GT2-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > Notice: This email and any attachments are confidential and may not be > used, published or redistributed without the prior written consent of the > Institute of Geological and Nuclear Sciences Limited (GNS Science). If > received in error please destroy and immediately notify GNS Science. Do not > copy or disclose the contents. >
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users