Java虚拟机启动程序:Spring的JNI错误

时间:2015-10-25 15:13:50

标签: java eclipse spring window spring-bean

我使用Windows10 Pro 32bit ENG,EclipseEE Mars,Java 8_66。如果我想用Spring创建一个简单的bean项目并运行它,它会在Windows对话框中显示一个错误。当我进入此对话框时,它会生成异常。

Option Explicit
Dim ProcessName : ProcessName = "Explorer.exe"
Refresh(ProcessName)
'*********************************************************************
Sub Refresh(ProcessName)
Kill(ProcessName)
RunIt(ProcessName)
End Sub
'*********************************************************************
Sub Kill(ProcessName)
Dim Ws : Set Ws = CreateObject("Wscript.Shell")
Dim Command : Command = "Taskkill /F /IM "& ProcessName &""
Dim Result : Result = Ws.Run(Command,0,True)
End Sub
'*********************************************************************
Sub RunIt(ProcessName)
Dim Ws : Set Ws = CreateObject("Wscript.Shell")
Dim Result : Result = Ws.Run(ProcessName,1,False)
End Sub
'*********************************************************************

我有CLASSPATH:Apache * .jars

Java Virtual Machine Launcher - Error : 
A JNI error has occurred, please check your installation and try it again.

春天* .jars

•commons-logging-1.2.jar
•commons-logging-1.2-javadoc.jar

我测试了Java 8_60 vs Spring 4.1.5,Java 8_66 vs Spring 4.1.5或4.2.2。

KlientMetaTest.java

•spring-aop-4.1.5.RELEASE.jar
•spring-beans-4.1.5.RELEASE.jar
•spring-context-4.1.5.RELEASE.jar
•spring-aspects-4.1.5.RELEASE.jar
•spring-context-support-4.1.5.RELEASE.jar
•spring-core-4.1.5.RELEASE.jar
•spring-web-4.1.5.RELEASE.jar
•spring-webmvc-4.1.5.RELEASE.jar
•spring-expression-4.1.5.RELEASE.jar

ServerVypis.java

package klient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import server.ServerVypis;
public class KlientMetaTest {
    public static void main(String[] args) {
        @SuppressWarnings("resource")
        ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/Beans.xml");
        ServerVypis obj = (ServerVypis) context.getBean("mujSpring");                           //  id beanu
        obj.getMessage();   
    }
}

/ META-INF /文件夹

中的beans.xml
package server;
public class ServerVypis {
    private String message;
    public void setMessage(String message){
        this.message = message; }
    public void getMessage(){
        System.out.println("Zde je tvuj Spring vypis  : " + message);   }
}

在控制台中显示的异常:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
   <bean id="mujSpring" class="server.ServerVypis">
       <property name="message" value="Vypis z \META-INF\Bean.xml"/>
   </bean>
</beans>

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。

我在pom.xml中做了一些更改。如果您正在使用javax邮件的依赖关系以及aws sdk,那么请确保在aws sdk之前声明javax邮件。

如果您更改了序列,那么它将显示上述错误,因为它以错误的顺序加载罐子。因为这在我的案例中起作用,希望这对您有用!

答案 1 :(得分:-1)

问题解决了。安装Windows10后,当我保存外部jar框架时,它破坏了我对文件夹的访问权限。