First of all, please forgive any mistakes you'll probably see in my mail, I'm not a native speaker.
I'm seeking some help with GeoTools. I've been using it for a school's project, I had almost no problem until now.
But now that my project is done, I've tried to build an executable jar with the maven's shade plugin like it is shown in the GeoTools' FAQ.
Here's my problem, when I try to use the jar which have been created when I type 'mvn package', I get this error :
java.lang.UnsupportedOperationException: Trying to get a reader from an unknown
format.
at org.geotools.coverage.grid.io.UnknownFormat.getReader(UnknownFormat.j
ava:62)
at coeurDLL.SMap.<init>(SMap.java:44)
at coeurDLL.CoeurController.initialize(CoeurController.java:103)
at coeur.Interface.getMapsAndDisplay(Interface.java:152)
at coeur.Interface.<init>(Interface.java:948)
at coeur.Interface.main(Interface.java:957)
java.lang.NullPointerException
at coeurDLL.CoeurController.getColumnsFields(CoeurController.java:225)
at coeur.Interface.setControlPanel(Interface.java:327)
at coeur.Interface.displayMainWindow(Interface.java:185)
at coeur.Interface.getMapsAndDisplay(Interface.java:162)
at coeur.Interface.<init>(Interface.java:948)
at coeur.Interface.main(Interface.java:957)
It happens when I try to read a GeoTif file with the method "reader.read(null)".
Of course I don't have this problem when executing the project on Eclipse.
I read somewhere that it could be a dependency problem, but I don't see what I could have missed.
Some details which could be helpful :
- I'm using GeoTools version 12-RC1
- I'm not using the JAI libraries, I'm working in Java Pure mode. It allows me to work with a 64 bits jdk. I tried by curiosity with a 32bit jdk, but I still have the same problem anyway.
- I'm working on Windows 7, but it shouldn't make any difference.
Here's the content of my pom.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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pfe.coeur</groupId>
<artifactId>coeur</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tuto</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<geotools.version>12-RC1</geotools.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<encoding>UTF-8</encoding>
<target>1.8</target>
<source>1.8</source>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!-- This bit sets the main class for the executable jar as you otherwise -->
<!-- would with the assembly plugin -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>coeur.Interface</Main-Class>
</manifestEntries>
</transformer>
<!-- This bit merges the various GeoTools META-INF/services files -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-coverage</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-render</artifactId>
<version>${geotools.version}</version>
</dependency>
<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>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
</repositories>
</project>
I can get this same error on Eclipse when I delete gt:geotiff from my dependencies. But the jar does contain this dependency.
I'd be very grateful if someone can help me to solve this problem. I need this executable jar to finish my project and I don't have a lot of time to get it.
Regards,
Related
The image shows the persistence.xml configuration and
the popup window where I try to create the new session beans.
My setup is
Netbeans 12.6
Jakarta ee9
JDK 17
Glassfish 6.2.1
I have tried to reinstall netbeans, reinstall the server tried to create a new project using ant build script adding the persitence libs manually but I am still getting the same error.
The pom.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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.techbay</groupId>
<artifactId>Techbay</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Techbay-1.0-SNAPSHOT</name>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<jakartaee>9.0.0</jakartaee>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.1.0-RC2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.2.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I was finally able to solve this problem by adding to my POM
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>glassfish-ejb-lite</artifactId>
<version>5.0</version>
</dependency>
Then I realized that glassfish-ejb-lite-5.0.jar is not available in maven repository so I manually downloaded the source jar glassfish-ejb-lite-5.0-sources.jar from the net and manually added it to my local repository.
This solved the problem for now till the glassfish-ejb-lite.5.0 is officially available in maven central.
I hope this helps somebody with a similar problem.
I have a Scala application that I'm trying to package as a .jar file using Maven. There is an application.conf file that I'm trying to package into the jar as a resource. However, when I use the resources plugin, either automatically by putting the resources in src/main/resources, or explicitly by adding it to pom.xml from some other folder, Maven then stops compiling and packaging the .class files in the jar.
So long as I don't use the resources plugin, everything works 100%. Maven runs the Scala compiler, puts the .class files into the jar, and after manually adding my resources via 7zip the program executes just fine.
A few additional details:
I'm using the scala-maven-plugin with the Artima Supersafe compiler plugin
I'm also using the maven-shade-plugin to generate a fat jar, concatenate akka reference.conf files, and generate the manifest. This still works when using the resources plugin, its just my .class files are missing. I've tried running without this plugin but the results are the exact same.
I am manually specifying the sourceDirectory as src/main/scala
When not using the resource plugin, the Scala compiles and the console output displays [INFO] --- scala-maven-plugin:3.2.0:compile (default) # batchmanager --- followed by compiler warnings, etc. However, when using the resource plugin it instead always insists: [INFO] Nothing to compile - all classes are up to date
The application.conf file does actually appear in the jar correctly when using the resource plugin
I'm running Maven through Eclipse, not the CLI
I have a feeling there is something about the resource plugin that I do not understand. Any help would be much appreciated.
The full pom.xml (removing the resources definition is the only difference between the working and non-working versions of the file)
<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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.digitalalbatross</groupId>
<artifactId>batchmanager</artifactId>
<version>0.0.1</version>
<name>${project.artifactId}</name>
<inceptionYear>2017</inceptionYear>
<licenses>
<license>
<name>My License</name>
<url>http://....</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.version>2.12.2</scala.version>
<scala.compat.version>2.12</scala.compat.version>
</properties>
<repositories>
<repository>
<id>artima</id>
<name>Artima Maven Repository</name>
<url>http://repo.artima.com/releases</url>
</repository>
</repositories>
<dependencies>
<!-- Test -->
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-http_2.12</artifactId>
<version>10.0.7</version>
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.iq80.leveldb</groupId>
<artifactId>leveldb</artifactId>
<version>0.9</version>
</dependency>
<dependency>
<groupId>org.fusesource.leveldbjni</groupId>
<artifactId>leveldbjni-all</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.12</artifactId>
<version>2.5.1</version>
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-persistence_2.12</artifactId>
<version>2.5.1</version>
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-stream_2.12</artifactId>
<version>2.5.1</version>
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-http-spray-json_2.12</artifactId>
<version>10.0.6</version>
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.12</artifactId>
<version>3.0.3</version>
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.12.2</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<resources>
<resource>
<directory>res</directory>
<includes>
<include>application.conf</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<!-- see http://davidb.github.com/scala-maven-plugin -->
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<compilerPlugins>
<compilerPlugin>
<groupId>com.artima.supersafe</groupId>
<artifactId>supersafe_${scala.version}</artifactId>
<version>1.1.2</version>
</compilerPlugin>
</compilerPlugins>
<args>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<!-- If you have classpath issue like NoDefClassError,... -->
<!-- useManifestOnlyJar>false</useManifestOnlyJar -->
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>allinone</shadedClassifierName>
<artifactSet>
<includes>
<include>*:*</include>
</includes>
</artifactSet>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.digitalalbatross.batchmanager.Boot</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<description>Batch Manager for IMAX</description>
<organization>
<name>Digital Albatross Design and Consulting</name>
<url>digitalalbatross.com</url>
</organization>
</project>
I managed to solve my issue in the course of solving another. My eclipse workbench kept crashing on boot, so I deleted the .plugins folder to try and solve the issue. Not only did this fix my eclipse setup, but Maven decided to cooperate and started to actually include both resource and class files in the jar. After some confusion over which of the generated jar files actually had a working manifest, I've verified that it is now working as expected.
To summarize, it was most likely some bizarre bug caused by something in my .plugins folder for eclipse. Deleting that folder and reconfiguring my setup fixed the issue.
Disclaimer: I am new to Scala and trying to create a sample Scala Maven project using simple scala archtype in IntelliJ IDEA. IntelliJ version is 14.1.2
Below is my pom file, I did change the Scala version to 2.11.6 from 2.7 which the archetype generates by default.
<!-- language: lang-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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>learn.rxscala</groupId>
<artifactId>rxscala-reactive-course-play</artifactId>
<version>1.0.0-SNAPSHOT</version>
<inceptionYear>2008</inceptionYear>
<properties>
<scala.version>2.11.6</scala.version>
<slf4j.version>1.7.5</slf4j.version>
<reactivex.version>0.23.0</reactivex.version>
<rx.scala.compat.version>2.11</rx.scala.compat.version>
<scala.async.version>0.9.2</scala.async.version>
</properties>
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.specs</groupId>
<artifactId>specs</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxscala_${rx.scala.compat.version}</artifactId>
<version>${reactivex.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang.modules</groupId>
<artifactId>scala-async_${rx.scala.compat.version}</artifactId>
<version>${scala.async.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<args>
<arg>-target:jvm-1.5</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
On running Maven test, I keep getting following error -
[WARNING] error: error while loading JUnit4, Scala signature JUnit4 has wrong version
[WARNING] expected: 5.0
[WARNING] found: 4.1 in JUnit4.class
I am not sure how to fix this problem?
Just make sure you use the up-to-date scala-archetype-simple, because IDEA requires new scala-archetype-simple to work with. But by default IDEA does not provide the correct scala-srchetype-simple to choose, you need to type in the right one by yourself.
It is like.
groupId:net.alchim31.maven
artifactId:scala-archetype-simple
version:1.6
packaging:maven-archetype
I had this issue as well and while trying to correct the ver number manually I found that simple using terminal or CMD you can just build a new project.
Using the mvn commands ensures that your project is built with the correct ver.
mvn -B archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app
Reference: http://maven.apache.org/guides/getting-started/index.html
I have a maven GWT project under eclipse and since I added some server side dependencies the maven plugin doesn't compile anymore. Here follows more info about the context:
maven 3.0.3;
GWT 1.5.3;
GWT maven plugin org.codehaus.mojo:gwt-maven-plugin:1.2 (the latest compatible with GWT 1.5.3, http://mojo.codehaus.org/gwt-maven-plugin-1.2/).
The goal gwt:compile of the GWT maven plugin completes successfully if I don't add dependencies other than the GWT ones:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
When I add any other dependency, the goal gwt:compile fails:
[INFO] establishing classpath list (scope = compile)
[ERROR] Exception in thread "main" java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.Compiler.<init>(Lorg/eclipse/jdt/internal/compiler/env/INameEnvironment;Lorg/eclipse/jdt/internal/compiler/IErrorHandlingPolicy;Lorg/eclipse/jdt/internal/compiler/impl/CompilerOptions;Lorg/eclipse/jdt/internal/compiler/ICompilerRequestor;Lorg/eclipse/jdt/internal/compiler/IProblemFactory;)V
[ERROR] at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.<init>(JdtCompiler.java:93)
[ERROR] at com.google.gwt.dev.javac.JdtCompiler.<init>(JdtCompiler.java:231)
[ERROR] at com.google.gwt.dev.javac.JdtCompiler.compile(JdtCompiler.java:193)
[ERROR] at com.google.gwt.dev.javac.CompilationState.compile(CompilationState.java:115)
[ERROR] at com.google.gwt.dev.GWTCompiler.distill(GWTCompiler.java:327)
[ERROR] at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:564)
[ERROR] at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:554)
[ERROR] at com.google.gwt.dev.GWTCompiler.main(GWTCompiler.java:214)
I did search a configuration parameter about classpath/dependencies in the gwt:compile (http://mojo.codehaus.org/gwt-maven-plugin-1.2/compile-mojo.html) with no success.
I would like to use server side dependencies alongside GWT ones telling the GWT plugin to not consider the non-GWT dependencies.
working pom (gwt:compile completes successfully):
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroupid</groupId>
<artifactId>projectname</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>project name</name>
<organization>
<name>My company</name>
<url>my company url</url>
</organization>
<properties>
<gwt.version>1.5.3</gwt.version>
</properties>
<build>
<finalName>final name</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>
<version>2.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<ajdtVersion>none</ajdtVersion>
</configuration>
<version>2.9</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>org.mycompany.myproject.Main/welcomeGWT.html</runTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- GWT -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
not working pom (gwt:compile throws exception):
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroupid</groupId>
<artifactId>projectname</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>project name</name>
<organization>
<name>My company</name>
<url>my company url</url>
</organization>
<properties>
<gwt.version>1.5.3</gwt.version>
</properties>
<build>
<finalName>final name</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>
<version>2.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<ajdtVersion>none</ajdtVersion>
</configuration>
<version>2.9</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>org.mycompany.myproject.Main/welcomeGWT.html</runTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-sqlmap</artifactId>
<version>2.3.4.726</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>3.6.0</version>
</dependency>
<!-- GWT -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Are you using JasperReport in our project? I remember having a problem using JasperReport and GWT. JasperReport includes a different version of the org.eclipse.jdt.internal.compiler.Compiler than what GWT is expecting.
I think you can fix this by simply changing the order of the class path (was already suggested in the comments). If that does not help, try to update your GWT version. Or try to find a version of JasperReport which includes a version of the org.eclipse.jdt.internal.compiler.Compile class that works with GWT.
I faced a similar error in our QA Linux environment during deployment of our web application and we managed to fix it. This problem wasn't even there when I deployed into my local Windows 10 and Linux Ubuntu virtual machine. My environment configuration is as follows
Ubuntu 16.04 LTS
Apache Maven 3.3.3
Apache Tomcat/8.0.32 (Ubuntu)
JVM 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14
The problem was because there were two eclipse Compiler classes that were found in two different jar files, and this creates conflicts in the classpath during tomcat deployment. The culprits are files ecj.jar and jdtcore.jar
My original pom.xml snipet is as below
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>6.3.0.Final</version>
</dependency>
<dependency>
<groupId>net.sourceforge.dynamicreports</groupId>
<artifactId>dynamicreports-core</artifactId>
<version>3.1.3</version>
</dependency>
The Maven dependency tree for drools-compiler introduces ecj.jar file.
The Maven dependency for dynamicreports-core.jar file that has jasperreports.jar that in turn introduces jdtcore.jar file.
Solution:
We upgraded the version of dynamicreports-core that introduces jasperreports.jar file.
Note:
I was able to fix this issue after reading http://www.cnblogs.com/xiaoMzjm/p/4566672.html. Credits to this blogger.
<dependency>
<groupId>net.sourceforge.dynamicreports</groupId>
<artifactId>dynamicreports-core</artifactId>
<version>4.1.0</version>
</dependency>
I'm trying to create a pom.xml which compile and run a program in scala.
This project need some *.so libraries (gluegen-rt.so for example) to run. Theses files are located here : /usr/lib/jni/
I have this error when i run my program :
Exception in thread "main" java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at com.jogamp.gluegen.runtime.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:102)
at com.jogamp.gluegen.runtime.NativeLibLoader.access$000(NativeLibLoader.java:51)
at com.jogamp.gluegen.runtime.NativeLibLoader$1.run(NativeLibLoader.java:70)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.gluegen.runtime.NativeLibLoader.loadGlueGenRT(NativeLibLoader.java:68)
at com.jogamp.common.jvm.JVMUtil.<clinit>(JVMUtil.java:56)
at javax.media.nativewindow.NativeWindowFactory.<clinit>(NativeWindowFactory.java:102)
at javax.media.opengl.awt.GLCanvas.<clinit>(GLCanvas.java:82)
at org.jzy3d.chart.Chart.initializeCanvas(Chart.java:65)
at org.jzy3d.chart.Chart.<init>(Chart.java:56)
at org.jzy3d.chart.Chart.<init>(Chart.java:39)
at fr.iscpif.slocalfit.testGraphique$.main(testGraphique.scala:28)
at fr.iscpif.slocalfit.testGraphique.main(testGraphique.scala)
So i make some research on linked library with maven, and i find this command line on a pom.xml :
<systemProperties>
<property>
<name>java.library.path</name>
<value>/usr/lib/jni/</value>
</property>
</systemProperties>
But i don't know where i can write this lines into my pom.xml, because i want maven add this lines to java command line before i run the main class of my program ...
Best regards,
Thanks for help,
My pom.xml is actually like that :
<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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.iscpif</groupId>
<packaging>bundle</packaging>
<artifactId>slocalfit</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${lib.org.scala-lang.scala.version}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>javax.media.opengl</groupId>
<artifactId>jogl-core</artifactId>
<version>2.0-pre-20101001</version>
</dependency>
<dependency>
<groupId>javax.media.opengl</groupId>
<artifactId>jogl-util</artifactId>
<version>2.0-pre-20101001</version>
</dependency>
<dependency>
<groupId>javax.media.nativewindow</groupId>
<artifactId>nativewindow-core</artifactId>
<version>2.0-pre-20101001</version>
</dependency>
<dependency>
<groupId>com.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>1.0-beta07</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.umontreal.iro</groupId>
<artifactId>ssj</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>gov.lbl.acs.colt</groupId>
<artifactId>colt</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.13</version>
</dependency>
<dependency>
<groupId>jfree</groupId>
<artifactId>jcommon</artifactId>
<version>1.0.15</version>
</dependency>
<dependency>
<groupId>org.openmole.tools</groupId>
<artifactId>mgo</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.openmole</groupId>
<artifactId>au.com.bytecode.opencsv</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org</groupId>
<artifactId>jzy3d</artifactId>
<version>0.9</version>
</dependency>
</dependencies>
<properties>
<lib.org.scala-lang.scala.version>2.9.0-1</lib.org.scala-lang.scala.version>
<maven.scala.version>${lib.org.scala-lang.scala.version}</maven.scala.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<configuration>
</configuration>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>${run.mainclass}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>-->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<manifestLocation>target/META-INF</manifestLocation>
<finalName>${symbolic.name}_${project.version}</finalName>
<instructions>
<!--<Main-Class>fr.iscpif.TON.PACKAGE.TaClasse</Main-Class>-->
<Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Import-Package>*;resolution:=optional</Import-Package>
<Export-Package>fr.iscpif.slocalfit.*,org.apache.commons.math.*,org.openmole.tools.mgo.*,umontreal.iro.lecuyer.*</Export-Package>
<Embed-Dependency>*;scope=!provided;inline=true;artifactId=!scala-library</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<name>${project.artifactId} ${project.version}</name>
<repositories>
<repository>
<id>maven.iscpif.fr</id>
<name>ISCPIF repository</name>
<url>http://maven.iscpif.fr/public/</url>
</repository>
<repository>
<id>maven.iscpif.fr.snapshots</id>
<name>ISCPIF snapshots repository</name>
<url>http://maven.iscpif.fr/snapshots/</url>
</repository>
<repository>
<id>scala-tools.org</id>
<name>Scala repository</name>
<url>http://scala-tools.org/repo-releases/</url>
</repository>
</repositories>
</project>
I have never worked with maven but a lot with JNI.
Have you specified the Native Library Path in the IDE that you´re using?
If you use IDE like NetBeans or Eclipse you have to specify where the Java Native Library (for certain java .jar library is) is located (I mean the .dll or .so) when adding the .jar files to IDE.
For ex. in Eclipse: Right click on project -> Properties -> Java Build Path -> Libraries (on the tab bar) -> Click on the library (and expand it) and there you can find Native library location. You have only to specify the path where .so files are located.
You have to do similar procedure on NetBeans: I think you have to press Project Properties -> Libraries and there you find these things.
Hope it was helpful :)