Geotools Probleme nach PC-Wechsel

gordonsky

Mitglied
Hallo,

ich habe ein Problem was ich mir nicht erklären kann.
Ich habe einen neuen Rechner bekommen und demzufolge auch wieder alles neu eingerichtet. jetzt muss ich an einem alten Projekt dran.
nun wirft mir Eclipse eine Fehlermeldung obwohl am Quelltext nicht verändert wurde.

Es handelt sich bei dem Problem mit der Einbindung der externen Bibliothek von Geotools (Version 21).
selbst bei den einfachen Tutorials von Geotools tritt der Fehler auf.
(hier das Tutorial)

Folgender Fehler kommt bei mir. kann mir da jemand auf die Sprünge helfen?

Exception in thread "main" 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 org.geotools.coverage.grid.io.AbstractGridFormat.<clinit>(AbstractGridFormat.java:89)
at org.geotools.gce.geotiff.GeoTiffFormatFactorySpi.createFormat(GeoTiffFormatFactorySpi.java:76)
at org.geotools.coverage.grid.io.GridFormatFinder.findFormats(GridFormatFinder.java:150)
at org.geotools.coverage.grid.io.GridFormatFinder.findFormat(GridFormatFinder.java:192)
at org.geotools.coverage.grid.io.GridFormatFinder.findFormat(GridFormatFinder.java:174)
at ImageLab.displayLayers(ImageLab.java:81)
at ImageLab.getLayersAndDisplay(ImageLab.java:71)
at ImageLab.main(ImageLab.java:49)
Caused by: java.lang.ClassNotFoundException: javax.measure.UnconvertibleException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 10 more
 
Bitte zeige uns die pom.xml damit man das ggf. nachvollziehen kann.

Eine Möglichkeit kann sein, dass Du eine Version hast, die nur mit Java 8 funktioniert und Du halt Java 9+ im Einsatz hast. Die Version 21.0 ist halt auch von 2019 wenn ich das auf mvnrepository.com richtig gesehen habe...
 
also... installiert ist bei mir Java 8 (Build 1.8.0_231-b11). Das Javaprojekt ist auch auf 1.8 eingestellt.
jetzt erscheint eine andere Meldung. jedoch startet das Programm noch immer nicht. 🤯

Code:
Apr. 28, 2022 7:04:52 AM org.geotools.image.ImageWorker <clinit>
INFORMATION: Warp/affine reduction enabled: true[/COLOR]
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
? Identifier            ? it.geosolutions.jaiext ? Description                                                                                 ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
? Absolute              ? algebric               ? This class executes the operation selected by the user on each pixel of the source images   ?
? Add                   ? algebric               ? This class execut
es the operation selected by the user on each pixel of the source images   ?
? AddConst              ? operationConst         ? This class executes the operation selected by the user on each pixel of the source images   ?
? Affine                ? Affine                 ? Performs interpolated affine transform on an image.                                         ?
? BandMerge             ? BandMerge              ? Operation used for merging multiple images into a single multibanded image                  ?
? Convolve              ?                        ? Performs kernel-based convolution on an image.                                              ?
? CoverageCrop          ?                        ?                                                                                             ?
? DivideByConst         ? operationConst         ? This class executes the operation selected by the user on each pixel of the source images   ?
? Exp                   ? algebric               ? This class executes the operation selected by the user on each pixel of the source images   ?
? Extrema               ? Stats                  ? Image operator for calculating simple image statistics like mean supporting ROI and No Data ?
? FilteredSubsample     ?                        ? Filters and subsamples an image.                                                            ?
? Histogram             ? Stats                  ? Image operator for calculating simple image statistics like mean supporting ROI and No Data ?
? Interpolate           ?                        ?                                                                                             ?
? Invert                ? algebric               ? This class executes the operation selected by the user on each pixel of the source images   ?
? Log                   ? algebric               ? This class executes the operation selected by the user on each pixel of the source images   ?
? MaxFilter             ?                        ? Performs max filtering on an image.                                                         ?
? MedianFilter          ?                        ? Performs median filtering on an image.                                                      ?
? MinFilter             ?                        ? Performs min filtering on an image.                                                         ?
? Mosaic                ? Mosaic                 ? A different mosaic operation which supports noData and doesn't supports threshold           ?
? Multiply              ? algebric               ? This class executes the operation selected by the user on each pixel of the source images   ?
? MultiplyConst         ? operationConst         ? This class executes the operation selected by the user on each pixel of the source images   ?
? Resample              ?                        ?                                                                                             ?
? Rescale               ? Rescale                ? Operation which converts the image dynamic to a new dynamic                                 ?
? Scale                 ? Scale                  ? Resizes an image.                                                                           ?
? SelectSampleDimension ?                        ?                                                                                             ?
? ShadedRelief          ? ShadedRelief           ? desc                                                                                        ?
? SubsampleAverage      ?                        ? Subsamples an image by averaging over a moving window.                                      ?
? SubtractConst         ? operationConst         ? This class executes the operation selected by the user on each pixel of the source images   ?
? SubtractFromConst     ? operationConst         ? This class executes the operation selected by the user on each pixel of the source images   ?
? Warp                  ? Warp                   ? Warps an image according to a specified Warp object.                                        ?
? Zonal                 ? Zonal                  ? Image operator for calculating statistics on various Geometries supporting ROI and No Data  ?
? ZonalStats            ?                        ? Calculate neighbourhood statistics                                                          ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Bitte zeige uns die pom.xml damit man das ggf. nachvollziehen kann.
ich arbeite mit eclipse. wo kann ich da diese pom.xml finden?
 
gleich innerhalb des proejkt ordners

wieso soll es irgendwie wichtig sein für eclipse ob java installiert ist ? willst du das programm im terminal starten oder innerhalb von eclipse?

wenn du keine pom hast bzw gradle solltest du damit anfangen
 
sry für die verspätete Antwort.

ich habe die POM.xml erstellt. ich hoffe die hilft weiter.
XML:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>temp</groupId>
  <artifactId>temp</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
 
Ok, wenn Du sagst, dass Du die jetzt erst erstellt hast, dann hast Du bisher keine pom.xml gehabt? Wenn Du nur ein reines Eclipse Projekt hast, dann musst Du die Abhängigkeiten selbst einbinden. Das Tutorial, das Du verlinkt hast, geht aber davon aus, dass man ein Maven Projekt hat und gibt da die Abhängigkeiten an, die da auch auf eigenständigen Repositories liegen:
Java:
    <dependencies>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-shapefile</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-swing</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-epsg-hsql</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-geotiff</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-image</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-wms</artifactId>
            <version>${geotools.version}</version>
        </dependency>
      </dependencies>
  <repositories>
    <repository>
      <id>osgeo</id>
      <name>OSGeo Release Repository</name>
      <url>https://repo.osgeo.org/repository/release/</url>
      <snapshots><enabled>false</enabled></snapshots>
      <releases><enabled>true</enabled></releases>
    </repository>
    <repository>
      <id>osgeo-snapshot</id>
      <name>OSGeo Snapshot Repository</name>
      <url>https://repo.osgeo.org/repository/snapshot/</url>
      <snapshots><enabled>true</enabled></snapshots>
      <releases><enabled>false</enabled></releases>
    </repository>
  </repositories>

Der <dependencies>...</dependencies> Teil gehört ins <build>...</build> und die <repositories>...</repositories> direkt in <project>. Setzt aber voraus, dass Du wirklich auch das Maven Projekt nutzt. Das POM bei dir ist extrem minimal um es so freundlich auszudrücken.
 

Zurück
Oben