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

Issue with third-party library using Ikonly: Exception in thread "JavaFX Application Thread" java.lang.UnsupportedOperationException: Cannot resolve 'mdi-close' #155

Closed
fusionart opened this issue Sep 20, 2022 · 3 comments

Comments

@fusionart
Copy link

Hello,

I am having issue with "mdi" icon pack used from GemsFX.
I asked GemsFX for help and they told me that the problem is not with their components but with Ikonli.
Here you can see their answer: dlsc-software-consulting-gmbh/GemsFX#53

When I start the app from IntelliJ everything is working correctly.

But when I build a fatjar using "mvn compile package" command and maven-shade-plugin and run it using "java -jar", I get this errors on runtime:
Exception in thread "JavaFX Application Thread" java.lang.UnsupportedOperationException: Cannot resolve 'mdi-close'
or
Exception in thread "JavaFX Application Thread" java.lang.UnsupportedOperationException: Cannot resolve 'mdi-clock'

The second issue is causing problems loading the stage with the Time Picker. It is making the form almost unusable.

I am running the app on Ubuntu 22.04, JDK openjdk 18.0.2 2022-07-19 ,OpenJDK Runtime Environment Temurin-18.0.2+9 (build 18.0.2+9) and JavaFX 18, GemsFX version 1.47.0.

I've also added to the POM file of the project the latest version of Ikonli: ikonli-core, ikonli-javafx and ikonli-materialdesign-pack but this didn't solve my problem.

Nick

This part of the whole error from the konsole:
Exception in thread "JavaFX Application Thread" java.lang.UnsupportedOperationException: Cannot resolve 'mdi-close'
at org.kordamp.ikonli.AbstractIkonResolver.resolve(AbstractIkonResolver.java:61)
at org.kordamp.ikonli.javafx.IkonResolver.resolve(IkonResolver.java:69)
at org.kordamp.ikonli.javafx.FontIcon.lambda$new$2(FontIcon.java:76)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:360)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)
at javafx.css.StyleableObjectProperty.set(StyleableObjectProperty.java:82)
at org.kordamp.ikonli.javafx.FontIcon.setIconCode(FontIcon.java:231)
at org.kordamp.ikonli.javafx.FontIcon.(FontIcon.java:97)
at com.dlsc.gemsfx.DialogPane$ContentPane.(DialogPane.java:917)
at com.dlsc.gemsfx.DialogPane.lambda$new$4(DialogPane.java:112)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at com.dlsc.gemsfx.DialogPane.lambda$new$8(DialogPane.java:111)

@aalmiray
Copy link
Collaborator

When creating a fatjar make sure to merge service files otherwise icon providers won't be found https://kordamp.org/ikonli/#_creating_a_fat_jar

@fusionart
Copy link
Author

Thanks a lot @aalmiray for the help. This solution was the missing part. Now it works perfectly.

@avajscript
Copy link

@aalmiray can you tell me any changes I can make to my pom.xml? I'm still getting errors with Exception in thread "JavaFX Application Thread" java.lang.UnsupportedOperationException: Cannot resolve 'mdmz-plus'

This is my pom.xml
`

4.0.0

<groupId>org.example</groupId>
<artifactId>Learning</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Learning</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <junit.version>5.10.0</junit.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.kordamp.ikonli</groupId>
        <artifactId>ikonli-material2-pack</artifactId>
        <version>12.3.1</version>
    </dependency>
    <dependency>
        <groupId>org.kordamp.ikonli</groupId>
        <artifactId>ikonli-javafx</artifactId>
        <version>12.3.1</version>
    </dependency>

    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>17.0.6</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>17.0.6</version>
    </dependency>
    <dependency>
        <groupId>com.dlsc.formsfx</groupId>
        <artifactId>formsfx-core</artifactId>
        <version>11.6.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.openjfx</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <configuration>
                <transformers>
                    <transformer
                            implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                </transformers>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.11.0</version>
            <configuration>
                <source>17</source>
                <target>17</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>0.0.8</version>
            <executions>
                <execution>
                    <!-- Default configuration for running with: mvn clean javafx:run -->
                    <id>default-cli</id>
                    <configuration>
                        <mainClass>org.example.learning/org.example.learning.Main</mainClass>
                        <launcher>app</launcher>
                        <jlinkZipName>app</jlinkZipName>
                        <jlinkImageName>app</jlinkImageName>
                        <noManPages>true</noManPages>
                        <stripDebug>true</stripDebug>
                        <noHeaderFiles>true</noHeaderFiles>
                    </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

3 participants