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

FileNotFoundException app.xml #173

Open
Aohler opened this issue Aug 14, 2019 · 0 comments
Open

FileNotFoundException app.xml #173

Aohler opened this issue Aug 14, 2019 · 0 comments

Comments

@Aohler
Copy link

Aohler commented Aug 14, 2019

Hello, I followed the tutorial and maven example but when I do mvn clean package I receive this exception :

`[WARNING]
java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:564)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:293)
at java.lang.Thread.run (Thread.java:844)
Caused by: javax.xml.bind.DataBindingException: javax.xml.bind.MarshalException

  • with linked exception:
    [java.io.FileNotFoundException: file:/Users/myname/Projects/myprojectname/target/app/app.xml (No such file or directory)]
    at javax.xml.bind.JAXB._marshal (JAXB.java:589)
    at javax.xml.bind.JAXB.marshal (JAXB.java:347)
    at fxlauncher.CreateManifest.main (CreateManifest.java:127)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:293)
    at java.lang.Thread.run (Thread.java:844)
    Caused by: javax.xml.bind.MarshalException
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.createXmlOutput (MarshallerImpl.java:200)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal (MarshallerImpl.java:221)
    at javax.xml.bind.JAXB._marshal (JAXB.java:587)
    at javax.xml.bind.JAXB.marshal (JAXB.java:347)
    at fxlauncher.CreateManifest.main (CreateManifest.java:127)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:293)
    at java.lang.Thread.run (Thread.java:844)
    Caused by: java.io.FileNotFoundException: file:/Users/myname/Projects/myprojectname/target/app/app.xml (No such file or directory)
    at java.io.FileOutputStream.open0 (Native Method)
    at java.io.FileOutputStream.open (FileOutputStream.java:299)
    at java.io.FileOutputStream. (FileOutputStream.java:238)
    at java.io.FileOutputStream. (FileOutputStream.java:127)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.createXmlOutput (MarshallerImpl.java:195)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal (MarshallerImpl.java:221)
    at javax.xml.bind.JAXB._marshal (JAXB.java:587)
    at javax.xml.bind.JAXB.marshal (JAXB.java:347)
    at fxlauncher.CreateManifest.main (CreateManifest.java:127)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:293)
    at java.lang.Thread.run (Thread.java:844)
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE`

Indeed the file didn't exist, so I tried to create it and to do mvn package but I keep getting this error and I have no idea how to solve it, I'd be greateful if you could help me out.

I work with MacOS and Intellij, and I have the following pom.xml (the url is fake)

`

4.0.0

<groupId>co.midle</groupId>
<artifactId>dashboard-generator</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>

    <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>

    <!-- Application Name -->
    <app.filename>${project.name}</app.filename>
    <!-- The JavaFX Application class name -->
    <app.mainClass>fr.mysite.DashboardGeneratorApp</app.mainClass>
    <!-- The app and launcher will be assembled in this folder -->
    <app.dir>${project.build.directory}/app</app.dir>
    <!-- Native installers will be build in this folder -->
    <app.installerdir>${project.build.directory}/installer</app.installerdir>
    <!-- Base URL where you will host the application artifacts -->
    <app.url>http://mysite.fr/apps/dashboard-generator</app.url>
    <!-- The Application vendor used by javapackager -->
    <app.vendor>My name</app.vendor>
    <!-- The Application version used by javapackager -->
    <app.version>1.0-SNAPSHOT</app.version>
    <!-- Should the client downgrade if the server version is older than the local version? -->
    <app.acceptDowngrade>false</app.acceptDowngrade>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>




    <kotlin.version>1.3.40</kotlin.version>
    <tornado.version>1.7.19</tornado.version>
    <serialization.version>0.11.1</serialization.version>
    <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
    <opencsv.version>4.5</opencsv.version>
    <kumo.version>1.17</kumo.version>
    <itextpdf.version>5.5.13.1</itextpdf.version>
    <apache.poi.version>3.15</apache.poi.version>
    <pdf2dom.version>1.6</pdf2dom.version>
    <apache.pdfbox.version>2.0.3</apache.pdfbox.version>
    <apache.xmlgraphics.version>1.11</apache.xmlgraphics.version>
</properties>

<repositories>
    <repository>
        <id>bintray-kotlin-kotlinx</id>
        <name>bintray</name>
        <url>https://kotlin.bintray.com/kotlinx</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib</artifactId>
        <version>${kotlin.version}</version>
    </dependency>
    <dependency>
        <groupId>no.tornado</groupId>
        <artifactId>tornadofx</artifactId>
        <version>${tornado.version}</version>
    </dependency>
    <dependency>
        <groupId>no.tornado</groupId>
        <artifactId>fxlauncher</artifactId>
        <version>1.0.20</version>
    </dependency>
    <dependency>
        <groupId>org.controlsfx</groupId>
        <artifactId>controlsfx</artifactId>
        <version>8.40.11</version>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlinx</groupId>
        <artifactId>kotlinx-serialization-runtime</artifactId>
        <version>${serialization.version}</version>
    </dependency>
    <dependency>
        <groupId>com.opencsv</groupId>
        <artifactId>opencsv</artifactId>
        <version>${opencsv.version}</version>
    </dependency>
    <dependency>
        <groupId>com.kennycason</groupId>
        <artifactId>kumo-core</artifactId>
        <version>${kumo.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox-tools</artifactId>
        <version>${apache.pdfbox.version}</version>
    </dependency>
    <dependency>
        <groupId>net.sf.cssbox</groupId>
        <artifactId>pdf2dom</artifactId>
        <version>${pdf2dom.version}</version>
    </dependency>
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itextpdf</artifactId>
        <version>${itextpdf.version}</version>
    </dependency>
    <dependency>
        <groupId>com.itextpdf.tool</groupId>
        <artifactId>xmlworker</artifactId>
        <version>${itextpdf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>${apache.poi.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-scratchpad</artifactId>
        <version>${apache.poi.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>batik-svg-dom</artifactId>
        <version>${apache.xmlgraphics.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.0.1</version>
    </dependency>


</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-maven-plugin</artifactId>
            <version>${kotlin.version}</version>

            <executions>
                <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <compilerPlugins>
                    <plugin>kotlinx-serialization</plugin>
                </compilerPlugins>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.jetbrains.kotlin</groupId>
                    <artifactId>kotlin-maven-serialization</artifactId>
                    <version>${kotlin.version}</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-maven-plugin</artifactId>
            <version>${kotlin.version}</version>
            <executions>
                <execution>
                    <id>compile</id>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                    <configuration>
                        <sourceDirs>
                            <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                            <sourceDir>${project.basedir}/src/main/java</sourceDir>
                        </sourceDirs>
                    </configuration>
                </execution>
                <execution>
                    <id>test-compile</id>
                    <goals> <goal>test-compile</goal> </goals>
                    <configuration>
                        <sourceDirs>
                            <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                            <sourceDir>${project.basedir}/src/test/java</sourceDir>
                        </sourceDirs>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
            <executions>
                <!-- Replacing default-compile as it is treated specially by maven -->
                <execution>
                    <id>default-compile</id>
                    <phase>none</phase>
                </execution>
                <!-- Replacing default-testCompile as it is treated specially by maven -->
                <execution>
                    <id>default-testCompile</id>
                    <phase>none</phase>
                </execution>
                <execution>
                    <id>java-compile</id>
                    <phase>compile</phase>
                    <goals> <goal>compile</goal> </goals>
                </execution>
                <execution>
                    <id>java-test-compile</id>
                    <phase>test-compile</phase>
                    <goals> <goal>testCompile</goal> </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals> <goal>single</goal> </goals>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>${app.mainClass}</mainClass>
                            </manifest>
                        </archive>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <outputDirectory>${app.dir}</outputDirectory>
            </configuration>
        </plugin>
        <!-- Copy dependencies to appdir -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.10</version>
            <configuration>
                <excludeScope>provided</excludeScope>
                <outputDirectory>${app.dir}</outputDirectory>
                <stripVersion>true</stripVersion>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <!-- Generate app.xml manifest -->
            <executions>
                <execution>
                    <id>create-manifest</id>
                    <phase>package</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        <mainClass>fxlauncher.CreateManifest</mainClass>
                        <arguments>
                            <argument>${app.url}</argument>
                            <argument>${app.mainClass}</argument>
                            <argument>${app.dir}</argument>
                        </arguments>
                    </configuration>
                </execution>
                <!-- Embed app.xml inside fxlauncher.xml so we don't need to reference app.xml to start the app -->
                <execution>
                    <id>embed-manifest-in-launcher</id>
                    <phase>package</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>jar</executable>
                        <workingDirectory>${app.dir}</workingDirectory>
                        <arguments>
                            <argument>uf</argument>
                            <argument>fxlauncher.jar</argument>
                            <argument>app.xml</argument>
                        </arguments>
                    </configuration>
                </execution>
                <execution>
                    <id>installer</id>
                    <phase>install</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>javapackager</executable>

                        <arguments>
                            <argument>-deploy</argument>
                            <argument>-native</argument>
                            <argument>-outdir</argument>
                            <argument>${app.installerdir}</argument>
                            <argument>-outfile</argument>
                            <argument>${app.filename}</argument>
                            <argument>-srcdir</argument>
                            <argument>${app.dir}</argument>
                            <argument>-srcfiles</argument>
                            <argument>fxlauncher.jar</argument>
                            <argument>-appclass</argument>
                            <argument>fxlauncher.Launcher</argument>
                            <argument>-name</argument>
                            <argument>${project.name}</argument>
                            <argument>-title</argument>
                            <argument>${project.name}</argument>
                            <argument>-vendor</argument>
                            <argument>${app.vendor}</argument>
                            <argument>-BappVersion=${app.version}</argument>
                            <argument>-Bidentifier=${project.groupId}.${project.artifactId}</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

`

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

1 participant