Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
原因:java.lang.NoSuchMethodError:sun.reflect.misc.Reflectil.newInstance(Ljava/lang/Class;)Ljava/lang/Object;_Java_Javafx - Fatal编程技术网

原因:java.lang.NoSuchMethodError:sun.reflect.misc.Reflectil.newInstance(Ljava/lang/Class;)Ljava/lang/Object;

原因:java.lang.NoSuchMethodError:sun.reflect.misc.Reflectil.newInstance(Ljava/lang/Class;)Ljava/lang/Object;,java,javafx,Java,Javafx,当我将项目中的jdk从8改为11时,我发现了这个问题: 完整的错误堆栈: 2019-08-12 14:54:47.216 FINE [Stock] : configuring... 2019-08-12 14:54:47.243 FINE [Stock] CryptoStock: configuring... 2019-08-12 14:54:47.243 FINE [Stock] CryptoStock: configuring... WARNING: An illeg

当我将项目中的jdk从8改为11时,我发现了这个问题:

完整的错误堆栈:

2019-08-12 14:54:47.216 FINE    [Stock] : configuring... 
2019-08-12 14:54:47.243 FINE    [Stock] CryptoStock: configuring... 
2019-08-12 14:54:47.243 FINE    [Stock] CryptoStock: configuring... 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.exscudo.desktop.cryptoterminal.utils.ReflectionUtils (file:/C:/terminal/usr_desktop-client/build/) to field java.util.PropertyResourceBundle.lookup
WARNING: Please consider reporting this to the maintainers of com.exscudo.desktop.cryptoterminal.utils.ReflectionUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-08-12 14:54:49.623 INFO    [Stock] >Exception in Application start method 
2019-08-12 14:54:49.633 INFO    [Stock] >Exception in thread "main" java.lang.RuntimeException: Exception in Application start method 
2019-08-12 14:54:49.639 INFO    [Stock] >    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900) 
2019-08-12 14:54:49.641 INFO    [Stock] >    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195) 
2019-08-12 14:54:49.645 INFO    [Stock] >    at java.base/java.lang.Thread.run(Thread.java:834) 
2019-08-12 14:54:49.647 INFO    [Stock] >Caused by: java.lang.NoSuchMethodError: sun.reflect.misc.ReflectUtil.newInstance(Ljava/lang/Class;)Ljava/lang/Object; 
2019-08-12 14:54:49.653 INFO    [Stock] >    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:901) 
2019-08-12 14:54:49.656 INFO    [Stock] >    at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:945) 
2019-08-12 14:54:49.657 INFO    [Stock] >    at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:194) 
2019-08-12 14:54:49.658 INFO    [Stock] >    at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:718) 
2019-08-12 14:54:49.659 INFO    [Stock] >    at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2681) 
2019-08-12 14:54:49.660 INFO    [Stock] >    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2501) 
2019-08-12 14:54:49.661 INFO    [Stock] >    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2415) 
2019-08-12 14:54:49.662 INFO    [Stock] >    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3188) 
2019-08-12 14:54:49.664 INFO    [Stock] >    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3149) 
2019-08-12 14:54:49.666 INFO    [Stock] >    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3122) 
2019-08-12 14:54:49.667 INFO    [Stock] >    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3098) 
2019-08-12 14:54:49.667 INFO    [Stock] >    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3090) 
2019-08-12 14:54:49.668 INFO    [Stock] >    at com.exscudo.desktop.cryptoterminal.App.start(App.java:412) 
2019-08-12 14:54:49.669 INFO    [Stock] >    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846) 
2019-08-12 14:54:49.670 INFO    [Stock] >    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455) 
2019-08-12 14:54:49.671 INFO    [Stock] >    at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428) 
2019-08-12 14:54:49.672 INFO    [Stock] >    at java.base/java.security.AccessController.doPrivileged(Native Method) 
2019-08-12 14:54:49.673 INFO    [Stock] >    at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427) 
2019-08-12 14:54:49.674 INFO    [Stock] >    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) 
2019-08-12 14:54:49.675 INFO    [Stock] >    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) 
2019-08-12 14:54:49.676 INFO    [Stock] >    at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174) 
2019-08-12 14:54:49.679 INFO    [Stock] >    ... 1 more 

Process finished with exit code 1
错误如下:

Parent root = FXMLLoader.load(getClass().getResource("/fxml/Terminal.fxml"), rb);
pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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</groupId>
    <artifactId>desktop-client</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
    </properties>
    <build>
        <outputDirectory>build</outputDirectory>
        <finalName>Terminal</finalName>
        <sourceDirectory>src/main/java</sourceDirectory>
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>version.txt</include>
                </includes>
            </resource>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <includes>
                    <include>font/*.ttf</include>
                    <include>fxml/**/*.fxml</include>
                    <include>images/**/*.png</include>
                    <include>images/**/*.jpg</include>
                    <include>images/**/*.svg</include>
                    <include>sound/*.wav</include>
                    <include>style/**/*.css</include>
                    <include>bundle/*.properties</include>
                    <include>testdata/*.*</include>
                    <include>com/**/*</include>
                    <include>welcome/**/*</include>
                </includes>
                <excludes>
                    <exclude>version.txt</exclude>
                </excludes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <mainClass>com.desktop.terminal.App</mainClass>
                            <classpathPrefix>lib/</classpathPrefix>
                            <useUniqueVersions>false</useUniqueVersions>
                        </manifest>
                        <manifestEntries>
                            <Class-Path>lib/ribbon-1.0.jar lib/controlsfx-8.40.14.jar</Class-Path>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>ribbon</groupId>
            <artifactId>ribbon</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/static/lib/ribbon-1.0.jar</systemPath>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.controlsfx/controlsfx -->
        <dependency>
            <groupId>org.controlsfx</groupId>
            <artifactId>controlsfx</artifactId>
            <version>8.40.14</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/static/lib/controlsfx-8.40.14.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>de.codecentric.centerdevice</groupId>
            <artifactId>javafxsvg</artifactId>
            <version>1.2.1</version>
        </dependency>
        <!-- JFREECHART -->
        <dependency>
            <groupId>org.jfree</groupId>
            <artifactId>jfreechart</artifactId>
            <version>1.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.jfree</groupId>
            <artifactId>jfreechart-fx</artifactId>
            <version>1.0.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream -->
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.4.10</version>
        </dependency>

        <!-- external API dependencies -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.10</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.10</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.10</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.5.2</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>LATEST</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>LATEST</version>
        </dependency>

        <!-- client maven -->
        <!--
        <dependency>
            <groupId>ru.novsys</groupId>
            <artifactId>lib_uni-analysis</artifactId>
            <version>LATEST</version>
        </dependency>
        -->

        <dependency>
            <groupId>org.bouncycastle.bcprov-jdk15on.1.57.org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
            <version>1.57</version>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle.bcprov-ext-jdk15on.1.57.org.bouncycastle</groupId>
            <artifactId>bcprov-ext-jdk15on</artifactId>
            <version>1.57</version>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle.bcpkix-jdk15on.1.57.org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk15on</artifactId>
            <version>1.57</version>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle.bcmail-jdk15on.1.57.org.bouncycastle</groupId>
            <artifactId>bcmail-jdk15on</artifactId>
            <version>1.57</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math3</artifactId>
            <version>3.4.1</version>
        </dependency>

        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>11</version>
        </dependency>

        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>11</version>
        </dependency>

        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.9.1</version>
        </dependency>

    </dependencies>
    <repositories>
        <repository>
            <id>sourceforge-igetdb</id>
            <name>igetdb repository as joone source</name>
            <url>http://igetdb.sourceforge.net/maven2-repository</url>
        </repository>
        <repository>
            <id>central</id>
            <name>Maven Repository Switchboard</name>
            <layout>default</layout>
            <url>http://repo1.maven.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
</project>

4.0.0
通用域名格式
桌面客户端
1.0-快照
UTF-8
${maven.build.timestamp}
yyyy MM dd HH:MM
建造
终点站
src/main/java
${basedir}/src/main/resources
真的
version.txt
${basedir}/src/main/resources
font/*.ttf
fxml/***/.fxml
图像/***/.png
图片/***/.jpg
图像/***.svg
声音/*.wav
style/***/.css
bundle/*.properties
testdata/**
com/**/*
欢迎光临/**/*
version.txt
maven依赖插件
包裹
复制依赖项
${project.build.directory}/lib
org.apache.maven.plugins
maven编译器插件
3.7.0
1.8
1.8
org.apache.maven.plugins
maven jar插件
3.0.2
真的
真的
com.desktop.terminal.App
解放党/
假的
lib/ribbon-1.0.jar lib/controlsfx-8.40.14.jar
丝带
丝带
1
系统
${project.basedir}/static/lib/ribbon-1.0.jar
org.controlsfx
controlsfx
8.40.14
系统
${project.basedir}/static/lib/controlsfx-8.40.14.jar
de.codecentric.centerdevice
javafxsvg
1.2.1
org.jfree
柱状图
1.5.0
org.jfree
jfreechart外汇
1.0.0
com.thoughtworks.xstream
xstream
1.4.10
通用编解码器
通用编解码器
1.10
公地io
公地io
2.5
org.apache.commons
commons-lang3
3.4
log4j
log4j
1.2.17
org.slf4j
slf4j api
1.7.10
org.slf4j
slf4j-log4j12
1.7.10
测试
org.apache.httpcomponents
httpclient
4.5.2
org.apache.httpcomponents
httpime
4.5.2
com.fasterxml.jackson.core
杰克逊注释
最新的
com.fasterxml.jackson.core
杰克逊数据绑定
最新的
org.bouncycastle.bcprov-jdk15on.1.57.org.bouncycastle
bcprov-jdk15on
1.57
org.bounchycastle.bcprov-ext-jdk15on.1.57.org.bounchycastle
bcprov-ext-jdk15on
1.57
org.bouncycastle.bcpkix-jdk15on.1.57.org.bouncycastle
bcpkix-jdk15on
1.57
org.bouncycastle.bcmail-jdk15on.1.57.org.bouncycastle
bcmail-jdk15on
1.57
org.apache.commons
commons-math3
3.4.1
org.openjfx
javafx控件
11
org.openjfx
javafx-fxml
11
薛西斯
干细胞移植
2.9.1
sourceforge igetdb
igetdb存储库作为一个源
http://igetdb.sourceforge.net/maven2-repository
中心的
Maven存储库交换机
违约
http://repo1.maven.org/maven2
假的

ok,那么您的问题是:您调用了一个不存在的方法。有什么不可以得到的?但是,即使这是一个stacktrace,它也是作为信息消息记录的(不知道为什么),所以它不应该造成问题(或者至少没有那么多问题)。也许您调用的函数是在Java11
private
中。您是否将JavaFX JAR添加到模块路径中,是否将
JavaFX.fxml
添加到
--添加模块?请提供有关如何运行项目的更多详细信息(VM参数或构建文件(pom.xml/build.gradle))谢谢大家的回答,我解决了这个问题。这个问题是因为我混合了jdk 8中使用的java.FXMLLoader的不同版本。@PeterPetrov您在java 11中用什么替换了FXMLLoader?