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

NoClassDefFoundError: org/geotools/referencing/CRS #4

Open
klemsic opened this issue Apr 23, 2020 · 1 comment
Open

NoClassDefFoundError: org/geotools/referencing/CRS #4

klemsic opened this issue Apr 23, 2020 · 1 comment
Assignees

Comments

@klemsic
Copy link
Collaborator

klemsic commented Apr 23, 2020

Proč nastává Runtime error java.lang.NoClassDefFoundError: org/geotools/referencing/CRS at Hello.main(Hello.java:8)?
V ClassPath by všechny potřebné knihovny měli být.
RuntimeError.zip

Pokud udělám projekt v eclipse a přidám do classpath celou knihovnu GeoTools dostanu chybovou hlášku:

Apr 23, 2020 2:51:13 PM org.geotools.util.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "CRSAuthorityFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.epsg.CartesianAuthorityFactory could not be instantiated".
java.util.ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.epsg.CartesianAuthorityFactory could not be instantiated
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:583)
	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:805)
	at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:723)
	at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1395)
	at org.geotools.util.factory.FactoryRegistry.register(FactoryRegistry.java:953)
	at org.geotools.util.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:859)
	at org.geotools.util.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:889)
	at org.geotools.util.factory.FactoryRegistry.getFactories(FactoryRegistry.java:251)
	at org.geotools.referencing.ReferencingFactoryFinder.getFactories(ReferencingFactoryFinder.java:183)
	at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactories(ReferencingFactoryFinder.java:453)
	at org.geotools.referencing.DefaultAuthorityFactory.getBackingFactory(DefaultAuthorityFactory.java:87)
	at org.geotools.referencing.DefaultAuthorityFactory.<init>(DefaultAuthorityFactory.java:67)
	at org.geotools.referencing.CRS.getAuthorityFactory(CRS.java:239)
	at org.geotools.referencing.CRS.decode(CRS.java:517)
	at org.geotools.referencing.CRS.decode(CRS.java:433)
	at Hello.main(Hello.java:8)
Caused by: java.lang.NoClassDefFoundError: javax/measure/UnconvertibleException
	at org.geotools.referencing.crs.DefaultEngineeringCRS.<clinit>(DefaultEngineeringCRS.java:78)
	at org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.<clinit>(CartesianAuthorityFactory.java:54)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:781)
	... 14 more
Caused by: java.lang.ClassNotFoundException: javax.measure.UnconvertibleException
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 22 more

Exception in thread "main" java.lang.NoClassDefFoundError: javax/measure/Unit
	at org.geotools.referencing.factory.epsg.DirectEpsgFactory.<clinit>(DirectEpsgFactory.java:311)
	at org.geotools.referencing.epsg.postgresql.ThreadedPostgreSQLEpsgFactory.createBackingStore(ThreadedPostgreSQLEpsgFactory.java:200)
	at org.geotools.referencing.factory.epsg.ThreadedEpsgFactory.createBackingStore0(ThreadedEpsgFactory.java:395)
	at org.geotools.referencing.factory.epsg.ThreadedEpsgFactory.createBackingStore(ThreadedEpsgFactory.java:436)
	at org.geotools.referencing.factory.DeferredAuthorityFactory.getBackingStore(DeferredAuthorityFactory.java:114)
	at org.geotools.referencing.factory.BufferedAuthorityFactory.isAvailable(BufferedAuthorityFactory.java:218)
	at org.geotools.referencing.factory.DeferredAuthorityFactory.isAvailable(DeferredAuthorityFactory.java:100)
	at org.geotools.util.factory.FactoryRegistry.isAvailable(FactoryRegistry.java:747)
	at org.geotools.util.factory.FactoryRegistry.isAcceptable(FactoryRegistry.java:570)
	at org.geotools.util.factory.FactoryRegistry.lambda$getFactories$0(FactoryRegistry.java:253)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176)
	at java.base/java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
	at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294)
	at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
	at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161)
	at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
	at java.base/java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
	at org.geotools.util.LazySet.isEmpty(LazySet.java:98)
	at org.geotools.referencing.factory.ManyAuthoritiesFactory.<init>(ManyAuthoritiesFactory.java:115)
	at org.geotools.referencing.DefaultAuthorityFactory.getBackingFactory(DefaultAuthorityFactory.java:114)
	at org.geotools.referencing.DefaultAuthorityFactory.<init>(DefaultAuthorityFactory.java:67)
	at org.geotools.referencing.CRS.getAuthorityFactory(CRS.java:239)
	at org.geotools.referencing.CRS.decode(CRS.java:517)
	at org.geotools.referencing.CRS.decode(CRS.java:433)
	at Hello.main(Hello.java:8)
Caused by: java.lang.ClassNotFoundException: javax.measure.Unit
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 25 more
@ruz76
Copy link

ruz76 commented Apr 23, 2020

Vidím dva problémy.

  1. Vždy je vhodné pouštět aplikiaci s GT se všemi knihovnami. Těch závislostí je tolik, že opravdu není možné si vystačit jen se třemi knihovnami. Jako postupně se pak ná něco umazat, když člověk ví co dělá, ale není to úplně triviání. Např. mohu smazat jar pro podporu GeoPackage, pakliže s ním nepracuji.
  2. Skript run.sh rozhodně nepouští aplikaci správně. Chybí balíčky. Balíčky jsou jen v kompilaci.

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

3 participants