Hi Frank, Yep, I don't think adding the shade plugin here will make any difference because you are already using the exec plugin to call JavaFXPackager. A quick look at the docs (http://docs.oracle.com/javafx/2/deployment/packager.htm) suggests that it is creating a single output jar for you. If that's the case, then I think the SPI merging problem that I suggested earlier does indeed apply.
In your earlier "kludge" setup, did you run your app via maven exec rather than assembling a single jar ? With the caveat that I no nothing about JavaFX or JavaFXPackager, one suggestion would be to pre-combine all of your GeoTools dependencies into a single dep jar (e.g. gt-uber) using the shade plugin, and then reference that from your build instead of the individual gt modules. But hopefully someone else here or in JavaFX forums will have a better suggestion. Michael On 26 November 2013 10:52, Frank van der Hulst <drifter.fr...@gmail.com> wrote: > Thanks for the reply Michael. > > Below is my complete pom.xml... this is pretty much the standard > Maven/JavaFX pom.xml generated by NetBeans, plus the dependencies and > repositories for Geotools. > > <?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/xsd/maven-4.0.0.xsd"> > <modelVersion>4.0.0</modelVersion> > > <groupId>com.mycompany</groupId> > <artifactId>mavenproject2</artifactId> > <version>1.0-SNAPSHOT</version> > <packaging>jar</packaging> > > <name>mavenproject2</name> > > <properties> > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> > <mainClass>com.mycompany.mavenproject2.MainApp</mainClass> > <slf4j.version>1.6.1</slf4j.version> > <geotools.version>9.2</geotools.version> > </properties> > > <organization> > <!-- Used as the 'Vendor' for JNLP generation --> > <name>Your Organisation</name> > </organization> > > <build> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-dependency-plugin</artifactId> > <version>2.6</version> > <executions> > <execution> > <id>unpack-dependencies</id> > <phase>package</phase> > <goals> > <goal>unpack-dependencies</goal> > </goals> > <configuration> > <excludeScope>system</excludeScope> > > <excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds> > > <outputDirectory>${project.build.directory}/classes</outputDirectory> > </configuration> > </execution> > </executions> > </plugin> > <plugin> > <groupId>org.codehaus.mojo</groupId> > <artifactId>exec-maven-plugin</artifactId> > <version>1.2.1</version> > <executions> > <execution> > <id>unpack-dependencies</id> > > <phase>package</phase> > <goals> > <goal>exec</goal> > </goals> > <configuration> > > <executable>${java.home}/../bin/javafxpackager</executable> > <arguments> > <argument>-createjar</argument> > <argument>-nocss2bin</argument> > <argument>-appclass</argument> > <argument>${mainClass}</argument> > <argument>-srcdir</argument> > > <argument>${project.build.directory}/classes</argument> > <argument>-outdir</argument> > > <argument>${project.build.directory}</argument> > <argument>-outfile</argument> > > <argument>${project.build.finalName}.jar</argument> > </arguments> > </configuration> > </execution> > </executions> > </plugin> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-compiler-plugin</artifactId> > <version>3.1</version> > <configuration> > <source>1.7</source> > <target>1.7</target> > <compilerArguments> > > <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath> > </compilerArguments> > </configuration> > </plugin> > </plugins> > </build> > <dependencies> > <!-- Apache Commons --> > > <dependency> > <groupId>commons-lang</groupId> > <artifactId>commons-lang</artifactId> > <version>2.6</version> > </dependency> > > <dependency> > <groupId>org.geotools</groupId> > <artifactId>gt-api</artifactId> > <version>${geotools.version}</version> > </dependency> > <dependency> > <groupId>org.geotools</groupId> > <artifactId>gt-coverage</artifactId> > <version>${geotools.version}</version> > </dependency> > <dependency> > <groupId>org.geotools</groupId> > <artifactId>gt-cql</artifactId> > <version>${geotools.version}</version> > </dependency> > <dependency> > <groupId>org.geotools</groupId> > <artifactId>gt-data</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-epsg-hsql</artifactId> > <version>${geotools.version}</version> > </dependency> > <dependency> > <groupId>org.geotools</groupId> > <artifactId>gt-jdbc</artifactId> > <version>${geotools.version}</version> > </dependency> > <dependency> > <groupId>org.geotools</groupId> > <artifactId>gt-main</artifactId> > <version>${geotools.version}</version> > </dependency> > <dependency> > <groupId>org.geotools</groupId> > <artifactId>gt-metadata</artifactId> > <version>${geotools.version}</version> > </dependency> > <dependency> > <groupId>org.geotools</groupId> > <artifactId>gt-opengis</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-referencing</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> > > </dependencies> > <repositories> > <repository> > <id>osgeo</id> > <name>Open Source Geospatial Foundation Repository</name> > <url>http://download.osgeo.org/webdav/geotools/</url> > </repository> > </repositories> > > </project> > > I tried inserting the Maven Shade plugin, as follows, as the first plugin, > but it didn't make any difference. > > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-shade-plugin</artifactId> > <version>1.3.1</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>com.mycompany.mavenproject2.MainApp</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> > > > Frank > > > > On Tue, Nov 26, 2013 at 11:50 AM, Michael Bedward > <michael.bedw...@gmail.com> wrote: >> >> Hi Frank, >> >> This is just a stab in the dark... >> >> Are you using this plugin: http://zenjava.com/javafx/maven/ ? And if >> so are you also using it to build an executable jar ? >> >> The error dump looks like it might be an SPI problem which can happen >> with GeoTools when module jars are combined into a single uber-jar >> without taking care to merge the META-INF/services entries properly. >> >> There is more info about this, although not in the context of JavaFX, >> here: >> >> http://docs.geotools.org/latest/userguide/faq.html#how-do-i-create-an-executable-jar-for-my-geotools-app >> >> Michael >> >> >> On 26 November 2013 08:48, Frank van der Hulst <drifter.fr...@gmail.com> >> wrote: >> > Hi all, >> > I'm new to this list, but have been using Geotools with Netbeans and >> > JavaFX2 >> > for some time. >> > >> > Recently I upgraded to Netbeans v7.4 and JDK 1.7u45 and rebuilt my >> > Mapping >> > project to use the newly available Maven/JavaFX Application project >> > type. >> > Previously I had kludged up a link to the JavaFX runtime jar in an >> > ordinary >> > Maven/Java Application project. That worked, but didn't allow use of the >> > JavaFX GUI builder. Now when I run my app, it crashes. :( >> > >> > This happens on both Windows 7.0 and Ubuntu Linux. >> > >> > I've tried with various versions of GeoTools from 9.2 through 10.2, >> > without >> > any change. >> > >> > I've tried re-installing Netbeans & Java. No joy. >> > >> > I've simplified things down as much as possible, to the point where I've >> > added one reference to GeoTools in the default project:package >> > com.mycompany.mavenproject2; >> > >> > import java.net.MalformedURLException; >> > import java.net.URL; >> > import java.util.ResourceBundle; >> > import javafx.event.ActionEvent; >> > import javafx.fxml.FXML; >> > import javafx.fxml.Initializable; >> > import javafx.scene.control.Label; >> > import org.geotools.data.FileDataStore; >> > import org.geotools.data.shapefile.ShapefileDataStore; >> > >> > public class FXMLController implements Initializable { >> > >> > @FXML >> > private Label label; >> > >> > @FXML >> > private void handleButtonAction(ActionEvent event) { >> > System.out.println("You clicked me!"); >> > try { >> > FileDataStore store = new ShapefileDataStore(new >> > >> > URL("file:/C:/Users/frankv/Documents/Mapping/Output/XCSoar/Airstrip.shp")); >> > } catch (MalformedURLException ex) { >> > throw new RuntimeException(ex); >> > } >> > label.setText("Hello World!"); >> > } >> > >> > @Override >> > public void initialize(URL url, ResourceBundle rb) { >> > // TODO >> > } >> > } >> > >> > >> > When this gets executed in the Maven/JavaFX2 application, I get this >> > output: >> > >> > Nov 26, 2013 9:56:00 AM org.geotools.factory.FactoryRegistry >> > scanForPlugins >> > WARNING: Can't load a service for category "FilterFactory". Cause is >> > "ServiceConfigurationError: org.opengis.filter.FilterFactory: Provider >> > org.geotools.filter.FilterFactoryImpl not a subtype". >> > java.util.ServiceConfigurationError: org.opengis.filter.FilterFactory: >> > Provider org.geotools.filter.FilterFactoryImpl not a subtype >> > at java.util.ServiceLoader.fail(ServiceLoader.java:231) >> > at java.util.ServiceLoader.access$300(ServiceLoader.java:181) >> > at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:369) >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:445) >> > at >> > org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:826) >> > at >> > >> > org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:772) >> > at >> > >> > org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:805) >> > at >> > >> > org.geotools.factory.FactoryRegistry.getUnfilteredProviders(FactoryRegistry.java:230) >> > at >> > >> > org.geotools.factory.FactoryRegistry.getServiceImplementation(FactoryRegistry.java:430) >> > at >> > >> > org.geotools.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:365) >> > at >> > >> > org.geotools.factory.FactoryCreator.getServiceProvider(FactoryCreator.java:145) >> > at >> > >> > org.geotools.factory.CommonFactoryFinder.lookup(CommonFactoryFinder.java:346) >> > at >> > >> > org.geotools.factory.CommonFactoryFinder.getFilterFactory(CommonFactoryFinder.java:300) >> > at >> > >> > org.geotools.factory.CommonFactoryFinder.getFilterFactory2(CommonFactoryFinder.java:390) >> > at >> > >> > org.geotools.factory.CommonFactoryFinder.getFilterFactory2(CommonFactoryFinder.java:404) >> > at org.geotools.data.DataUtilities.<clinit>(DataUtilities.java:200) >> > at org.geotools.data.shapefile.ShpFiles.exists(ShpFiles.java:1023) >> > at org.geotools.data.shapefile.ShpFiles.init(ShpFiles.java:185) >> > at org.geotools.data.shapefile.ShpFiles.<init>(ShpFiles.java:142) >> > at >> > >> > org.geotools.data.shapefile.ShapefileDataStore.<init>(ShapefileDataStore.java:200) >> > at >> > >> > org.geotools.data.shapefile.ShapefileDataStore.<init>(ShapefileDataStore.java:172) >> > at >> > >> > org.geotools.data.shapefile.ShapefileDataStore.<init>(ShapefileDataStore.java:162) >> > at >> > >> > com.mycompany.mavenproject2.FXMLController.handleButtonAction(FXMLController.java:22) >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> > at >> > >> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) >> > at >> > >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> > at java.lang.reflect.Method.invoke(Method.java:606) >> > at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75) >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> > at >> > >> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) >> > at >> > >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> > at java.lang.reflect.Method.invoke(Method.java:606) >> > at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279) >> > at >> > >> > javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1444) >> > at >> > >> > com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69) >> > at >> > >> > com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217) >> > at >> > >> > com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170) >> > at >> > >> > com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38) >> > at >> > >> > com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37) >> > at >> > >> > com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92) >> > at >> > >> > com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35) >> > at >> > >> > com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92) >> > at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53) >> > at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28) >> > at javafx.event.Event.fireEvent(Event.java:171) >> > at javafx.scene.Node.fireEvent(Node.java:6867) >> > at javafx.scene.control.Button.fire(Button.java:179) >> > at >> > >> > com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193) >> > at >> > com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336) >> > at >> > com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329) >> > at >> > >> > com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64) >> > at >> > >> > com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217) >> > at >> > >> > com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170) >> > at >> > >> > com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38) >> > at >> > >> > com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37) >> > at >> > >> > com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92) >> > at >> > >> > com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35) >> > at >> > >> > com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92) >> > at >> > >> > com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35) >> > at >> > >> > com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92) >> > at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53) >> > at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33) >> > at javafx.event.Event.fireEvent(Event.java:171) >> > at javafx.scene.Scene$MouseHandler.process(Scene.java:3311) >> > at javafx.scene.Scene$MouseHandler.process(Scene.java:3151) >> > at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3106) >> > at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563) >> > at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2248) >> > at >> > >> > com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250) >> > at >> > >> > com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173) >> > at java.security.AccessController.doPrivileged(Native Method) >> > at >> > >> > com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292) >> > at com.sun.glass.ui.View.handleMouseEvent(View.java:530) >> > at com.sun.glass.ui.View.notifyMouse(View.java:924) >> > at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) >> > at >> > com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17) >> > at >> > com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67) >> > at java.lang.Thread.run(Thread.java:744) >> > >> > I'm guessing this is some kind of dependency issue, so I tried starting >> > with >> > a minimal set of dependencies in my POM, and added all the gt- >> > dependencies >> > one by one. No joy. >> > >> > I've Googled around and found other people have reported problems >> > similar to >> > this in the past (e.g. >> > >> > https://sourceforge.net/mailarchive/forum.php?thread_name=C20306514FDF4FBFAC54AA8C20A90630%40gmail.com&forum_name=geotools-gt2-users), >> > but I can't find a solution. >> > >> > I don't think I have accidentally combined jars from two versions of >> > GeoTools, and don't think my environment is using class loaders or >> > anything >> > unusual, although its possible that in my kludging around earlier I did >> > something like that. >> > >> > Frank >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > Shape the Mobile Experience: Free Subscription >> > Software experts and developers: Be at the forefront of tech innovation. >> > Intel(R) Software Adrenaline delivers strategic insight and >> > game-changing >> > conversations that shape the rapidly evolving mobile landscape. Sign up >> > now. >> > >> > http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk >> > _______________________________________________ >> > GeoTools-GT2-Users mailing list >> > GeoTools-GT2-Users@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> > > > ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users