Rプログラミングには比較的新しいので、EclipseでrJavaを使用してJavaスクリプトからRスクリプトを呼び出そうとしています。RJavaでJavaプログラムを実行しているときにJVMがクラッシュする(Rと統合する)
package pkg;
import org.rosuda.JRI.Rengine;
import java.io.IOException;
import org.rosuda.JRI.REXP;
import org.springframework.core.io.ClassPathResource;
public class Temp {
public static void main(String a[]) throws IOException {
Rengine rengine = new Rengine(new String[] { "--no-save" }, false, null);
ClassPathResource rScript = new ClassPathResource("pkg/printEx.r");
System.out.println(rScript);
rengine.eval(String.format("source('%s')",rScript.getFile().getAbsolutePath()));
REXP result = rengine.eval("greeting");
System.out.println("Greeting from R: "+result.asString());
}
}
RスクリプトprintEx.rは、いくつかの文字列を返すの印刷に通常のRファイルは次のとおりです:私のプログラムは次のようになります
printExample <- function() {
s <- "hey"
s
}
私はEclipseのJVMクラッシュでJavaプログラムを実行してみましたこのようなエラーを与える:ログファイルは以下のように示されている
class path resource [pkg/printEx.r]
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000077c17a24, pid=8196, tid=0x0000000000002690
#
# JRE version: Java(TM) SE Runtime Environment (8.0_92-b14) (build 1.8.0_92-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.92-b14 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [ntdll.dll+0x17a24]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\posingh3\workspace\RWithJava\hs_err_pid8196.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000077c17a24, pid=8196, tid=0x0000000000002690
#
# JRE version: Java(TM) SE Runtime Environment (8.0_92-b14) (build 1.8.0_92-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.92-b14 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [ntdll.dll+0x17a24]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x00000000023be800): JavaThread "main" [_thread_in_native, id=9872, stack(0x0000000002640000,0x0000000002740000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x0000000002e204ed
Registers:
RAX=0x000000000272e500, RBX=0x0000000002740000, RCX=0x000000000272e5a0, RDX=0x0000000000000580
RSP=0x000000000272e280, RBP=0x000000000272e400, RSI=0x000000000272e980, RDI=0x0000000002a1017c
R8 =0x0000000000000000, R9 =0x0000000002a10000, R10=0x0000000000000000, R11=0x000000000272e500
R12=0x00000000027446a0, R13=0x000000001922dc80, R14=0x0000000002e204ed, R15=0x0000000002a10170
RIP=0x0000000077c17a24, EFLAGS=0x0000000000010246
Top of Stack: (sp=0x000000000272e280)
0x000000000272e280: 0000000002740000 000000000272e980
0x000000000272e290: 00000000000127bc 0000000000000000
0x000000000272e2a0: 0000000000000000 0000000000000000
0x000000000272e2b0: 0000000000000000 0000000000000000
0x000000000272e2c0: 0000000000000002 0000000000000000
0x000000000272e2d0: 000000000272e980 0000000002a10000
0x000000000272e2e0: 000000000273f7c0 0000000000000005
0x000000000272e2f0: 0000000002a10170 0000000002740000
0x000000000272e300: 0000000050b1c200 0000000002726000
0x000000000272e310: 0000000050517f61 00000000503d0000
0x000000000272e320: 0000000050bfcba0 000000000273f450
0x000000000272e330: 000000006c74be34 000000000272e400
0x000000000272e340: 00000000509a09d4 0000000050b1c200
0x000000000272e350: 0000000000000000 0000000000000000
0x000000000272e360: 0000000000000000 0000000000000000
0x000000000272e370: 0000000000000000 0000000000000000
Instructions: (pc=0x0000000077c17a24)
0x0000000077c17a04: 41 8b 7f 08 45 33 d2 49 03 f9 4c 89 54 24 48 f6
0x0000000077c17a14: 47 03 0f 0f 85 3d 0c 00 00 4c 8b a5 98 00 00 00
0x0000000077c17a24: 41 0f b6 0e 4c 89 64 24 60 49 8b d6 80 f9 48 0f
0x0000000077c17a34: 84 e0 03 00 00 0f b6 c1 24 fe 3c 48 0f 84 97 15
Register to memory mapping:
RAX=0x000000000272e500 is pointing into the stack for thread: 0x00000000023be800
RBX=0x0000000002740000 is pointing into the stack for thread: 0x00000000023be800
RCX=0x000000000272e5a0 is pointing into the stack for thread: 0x00000000023be800
RDX=0x0000000000000580 is an unknown value
RSP=0x000000000272e280 is pointing into the stack for thread: 0x00000000023be800
RBP=0x000000000272e400 is pointing into the stack for thread: 0x00000000023be800
RSI=0x000000000272e980 is pointing into the stack for thread: 0x00000000023be800
RDI=0x0000000002a1017c is at code_begin+28 in
[CodeBlob (0x0000000002a10110)]
Framesize: 0
BufferBlob (0x0000000002a10110) used for CodeCache Exception Handler
R8 =0x0000000000000000 is an unknown value
R9 =0x0000000002a10000 is an unknown value
R10=0x0000000000000000 is an unknown value
R11=0x000000000272e500 is pointing into the stack for thread: 0x00000000023be800
R12=0x00000000027446a0 is an unknown value
R13=0x000000001922dc80 is pointing into the stack for thread: 0x0000000018d60800
R14=0x0000000002e204ed is an unknown value
R15=0x0000000002a10170 is at code_begin+16 in
[CodeBlob (0x0000000002a10110)]
Framesize: 0
BufferBlob (0x0000000002a10110) used for CodeCache Exception Handler
Stack: [0x0000000002640000,0x0000000002740000], sp=0x000000000272e280, free space=952k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [ntdll.dll+0x17a24]
C [msvcrt.dll+0xe5a3]
C [R.dll+0x625ad]
C [R.dll+0x616bf]
C [R.dll+0x61f00]
C [R.dll+0xb5344]
C [R.dll+0xb5f3e]
C [R.dll+0xb71eb]
C [R.dll+0xb9819]
C [R.dll+0xba18c]
C [jri.dll+0x1695]
C 0x0000000002a28a57
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.rosuda.JRI.Rengine.rniParse(Ljava/lang/String;I)J+0
j org.rosuda.JRI.Rengine.eval(Ljava/lang/String;Z)Lorg/rosuda/JRI/REXP;+53
j org.rosuda.JRI.Rengine.eval(Ljava/lang/String;)Lorg/rosuda/JRI/REXP;+3
j pkg.Temp.main([Ljava/lang/String;)V+56
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: (=> current thread)
0x0000000018d60800 JavaThread "Thread-0" [_thread_blocked, id=12108, stack(0x0000000019130000,0x0000000019230000)]
0x0000000018d5f000 JavaThread "Service Thread" daemon [_thread_blocked, id=8984, stack(0x00000000195a0000,0x00000000196a0000)]
0x0000000018cec800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=9360, stack(0x00000000193c0000,0x00000000194c0000)]
0x00000000174ff800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=10556, stack(0x0000000019270000,0x0000000019370000)]
0x00000000174f6800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=10468, stack(0x0000000018be0000,0x0000000018ce0000)]
0x00000000174f5000 JavaThread "Attach Listener" daemon [_thread_blocked, id=12152, stack(0x00000000185f0000,0x00000000186f0000)]
0x00000000174f1800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=10896, stack(0x0000000018a60000,0x0000000018b60000)]
0x00000000174da800 JavaThread "Finalizer" daemon [_thread_blocked, id=1916, stack(0x00000000188c0000,0x00000000189c0000)]
0x0000000017493800 JavaThread "Reference Handler" daemon [_thread_blocked, id=1976, stack(0x0000000018720000,0x0000000018820000)]
=>0x00000000023be800 JavaThread "main" [_thread_in_native, id=9872, stack(0x0000000002640000,0x0000000002740000)]
Other Threads:
0x000000001748c000 VMThread [stack: 0x00000000184e0000,0x00000000185e0000] [id=11932]
0x0000000018d79800 WatcherThread [stack: 0x00000000197e0000,0x00000000198e0000] [id=12224]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap:
PSYoungGen total 36864K, used 2543K [0x00000000d6e00000, 0x00000000d9700000, 0x0000000100000000)
eden space 31744K, 8% used [0x00000000d6e00000,0x00000000d707bdc0,0x00000000d8d00000)
from space 5120K, 0% used [0x00000000d9200000,0x00000000d9200000,0x00000000d9700000)
to space 5120K, 0% used [0x00000000d8d00000,0x00000000d8d00000,0x00000000d9200000)
ParOldGen total 84992K, used 0K [0x0000000084a00000, 0x0000000089d00000, 0x00000000d6e00000)
object space 84992K, 0% used [0x0000000084a00000,0x0000000084a00000,0x0000000089d00000)
Metaspace used 3251K, capacity 4664K, committed 4864K, reserved 1056768K
class space used 363K, capacity 424K, committed 512K, reserved 1048576K
Card table byte_map: [0x0000000011dd0000,0x00000000121b0000] byte_map_base: 0x00000000119ab000
Marking Bits: (ParMarkBitMap*) 0x0000000050be64f0
Begin Bits: [0x0000000012970000, 0x0000000014848000)
End Bits: [0x0000000014848000, 0x0000000016720000)
Polling page: 0x0000000000460000
CodeCache: size=245760Kb used=1218Kb max_used=1218Kb free=244542Kb
bounds [0x0000000002a10000, 0x0000000002c80000, 0x0000000011a10000]
total_blobs=325 nmethods=75 adapters=163
compilation: enabled
Compilation events (10 events):
Event: 0.524 Thread 0x0000000018cec800 71 3 java.lang.StringBuilder::<init> (7 bytes)
Event: 0.524 Thread 0x0000000018cec800 nmethod 71 0x0000000002b3b8d0 code [0x0000000002b3ba40, 0x0000000002b3bcf0]
Event: 0.524 Thread 0x0000000018cec800 72 1 java.net.URL::getRef (5 bytes)
Event: 0.524 Thread 0x0000000018cec800 nmethod 72 0x0000000002b3be10 code [0x0000000002b3bf60, 0x0000000002b3c070]
Event: 0.525 Thread 0x0000000018cec800 74 3 java.lang.String::toLowerCase (439 bytes)
Event: 0.527 Thread 0x0000000018cec800 nmethod 74 0x0000000002b3c0d0 code [0x0000000002b3c400, 0x0000000002b3dc58]
Event: 0.527 Thread 0x0000000018cec800 73 1 java.nio.Buffer::limit (5 bytes)
Event: 0.527 Thread 0x0000000018cec800 nmethod 73 0x0000000002b3eb10 code [0x0000000002b3ec60, 0x0000000002b3ed70]
Event: 0.527 Thread 0x0000000018cec800 75 1 java.net.URL::getQuery (5 bytes)
Event: 0.527 Thread 0x0000000018cec800 nmethod 75 0x0000000002b3edd0 code [0x0000000002b3ef20, 0x0000000002b3f030]
GC Heap History (0 events):
No events
Deoptimization events (1 events):
Event: 0.503 Thread 0x00000000023be800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002b2a764 method=org.rosuda.JRI.Rengine.<init>([Ljava/lang/String;ZLorg/rosuda/JRI/RMainLoopCallbacks;)V @ 78
Internal exceptions (2 events):
Event: 0.047 Thread 0x00000000023be800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.defineClass(Ljava/lang/String;[BII)Ljava/lang/Class; name or signature does not match> (0x00000000d6e07cc0) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u92\6642\hotspot\srŒE‡«T¨?
Event: 0.048 Thread 0x00000000023be800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.prefetchRead(Ljava/lang/Object;J)V name or signature does not match> (0x00000000d6e07fa8) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u92\6642\hotspot\src\share\vm\prims\j
Events (10 events):
Event: 0.531 loading class java/util/Formatter$FormatString done
Event: 0.531 loading class java/util/Formatter$FixedString done
Event: 0.531 loading class java/util/Formatter$FormatSpecifier
Event: 0.531 loading class java/util/Formatter$FormatSpecifier done
Event: 0.531 loading class java/util/Formatter$Flags
Event: 0.531 loading class java/util/Formatter$Flags done
Event: 0.531 loading class java/util/Formatter$Conversion
Event: 0.531 loading class java/util/Formatter$Conversion done
Event: 0.531 loading class java/util/Formattable
Event: 0.531 loading class java/util/Formattable done
Dynamic libraries:
0x000000013fd90000 - 0x000000013fdc7000 C:\Program Files\Java\jre1.8.0_92\bin\javaw.exe
0x0000000077c00000 - 0x0000000077daa000 C:\WINDOWS\SYSTEM32\ntdll.dll
0x0000000077ae0000 - 0x0000000077bff000 C:\WINDOWS\system32\kernel32.dll
0x000007fefd9b0000 - 0x000007fefda1a000 C:\WINDOWS\system32\KERNELBASE.dll
0x000007fefe720000 - 0x000007fefe7fb000 C:\WINDOWS\system32\ADVAPI32.dll
0x000007fefe5a0000 - 0x000007fefe63f000 C:\WINDOWS\system32\msvcrt.dll
0x000007feffc30000 - 0x000007feffc4f000 C:\WINDOWS\SYSTEM32\sechost.dll
0x000007fefdf50000 - 0x000007fefe07d000 C:\WINDOWS\system32\RPCRT4.dll
0x00000000779e0000 - 0x0000000077ada000 C:\WINDOWS\system32\USER32.dll
0x000007feff990000 - 0x000007feff9f7000 C:\WINDOWS\system32\GDI32.dll
0x000007fefdd40000 - 0x000007fefdd4e000 C:\WINDOWS\system32\LPK.dll
0x000007feff8c0000 - 0x000007feff98a000 C:\WINDOWS\system32\USP10.dll
0x000007fefbce0000 - 0x000007fefbed4000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_fa3b1e3d17594757\COMCTL32.dll
0x000007fefe640000 - 0x000007fefe6b1000 C:\WINDOWS\system32\SHLWAPI.dll
0x000007feffee0000 - 0x000007fefff0e000 C:\WINDOWS\system32\IMM32.DLL
0x000007fefe490000 - 0x000007fefe599000 C:\WINDOWS\system32\MSCTF.dll
0x000007fee8790000 - 0x000007fee8837000 C:\Program Files\McAfee\Host Intrusion Prevention\HcApi.dll
0x000000006fa30000 - 0x000000006fa3b000 C:\Program Files\McAfee\Host Intrusion Prevention\HcThe.dll
0x0000000079210000 - 0x00000000792e2000 C:\Program Files\Java\jre1.8.0_92\bin\msvcr100.dll
0x00000000503d0000 - 0x0000000050c66000 C:\Program Files\Java\jre1.8.0_92\bin\server\jvm.dll
0x000007fef9520000 - 0x000007fef9529000 C:\WINDOWS\system32\WSOCK32.dll
0x000007fefe6c0000 - 0x000007fefe70d000 C:\WINDOWS\system32\WS2_32.dll
0x000007fefe710000 - 0x000007fefe718000 C:\WINDOWS\system32\NSI.dll
0x000007fefb3b0000 - 0x000007fefb3eb000 C:\WINDOWS\system32\WINMM.dll
0x000007fefc8b0000 - 0x000007fefc8bc000 C:\WINDOWS\system32\VERSION.dll
0x0000000077dc0000 - 0x0000000077dc7000 C:\WINDOWS\system32\PSAPI.DLL
0x00000000747a0000 - 0x00000000747af000 C:\Program Files\Java\jre1.8.0_92\bin\verify.dll
0x000000006bf20000 - 0x000000006bf49000 C:\Program Files\Java\jre1.8.0_92\bin\java.dll
0x0000000052bf0000 - 0x0000000052c06000 C:\Program Files\Java\jre1.8.0_92\bin\zip.dll
0x000007fefead0000 - 0x000007feff859000 C:\WINDOWS\system32\SHELL32.dll
0x000007feffc50000 - 0x000007feffe53000 C:\WINDOWS\system32\ole32.dll
0x000007fefd990000 - 0x000007fefd99f000 C:\WINDOWS\system32\profapi.dll
0x0000000062d80000 - 0x0000000062da6000 C:\Program Files\R\R-3.2.5\library\rJava\jri\jri.dll
0x000000006c700000 - 0x000000006e078000 C:\Program Files\R\R-3.2.4\bin\x64\R.dll
0x0000000064e80000 - 0x0000000064eda000 C:\Program Files\R\R-3.2.4\bin\x64\Rblas.dll
0x00000000641c0000 - 0x00000000641e5000 C:\Program Files\R\R-3.2.4\bin\x64\Riconv.dll
0x0000000063540000 - 0x00000000635b0000 C:\Program Files\R\R-3.2.4\bin\x64\Rgraphapp.dll
0x000007feffa00000 - 0x000007feffa97000 C:\WINDOWS\system32\comdlg32.dll
0x000007fee8ac0000 - 0x000007fee8ac7000 C:\WINDOWS\system32\MSIMG32.dll
0x000007fefb840000 - 0x000007fefb896000 C:\WINDOWS\system32\uxtheme.dll
0x000000006e5c0000 - 0x000000006e5e8000 C:\Program Files\R\R-3.2.5\library\utils\libs\x64\utils.dll
0x0000000064a40000 - 0x0000000064a53000 C:\Program Files\R\R-3.2.5\library\methods\libs\x64\methods.dll
0x000000006fc80000 - 0x000000006fd89000 C:\Program Files\R\R-3.2.5\library\grDevices\libs\x64\grDevices.dll
0x0000000063740000 - 0x0000000063785000 C:\Program Files\R\R-3.2.5\library\graphics\libs\x64\graphics.dll
0x0000000071100000 - 0x00000000711a4000 C:\Program Files\R\R-3.2.5\library\stats\libs\x64\stats.dll
0x000000001ad70000 - 0x000000001b009000 C:\Program Files\R\R-3.2.4\bin\x64\Rlapack.dll
0x000007fee8c60000 - 0x000007fee8d85000 C:\WINDOWS\system32\dbghelp.dll
VM Arguments:
jvm_args: -Dfile.encoding=Cp1252 -Xbootclasspath:C:\Program Files\Java\jre1.8.0_92\lib\resources.jar;C:\Program Files\Java\jre1.8.0_92\lib\rt.jar;C:\Program Files\Java\jre1.8.0_92\lib\jsse.jar;C:\Program Files\Java\jre1.8.0_92\lib\jce.jar;C:\Program Files\Java\jre1.8.0_92\lib\charsets.jar;C:\Program Files\Java\jre1.8.0_92\lib\jfr.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\cldrdata.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\dnsns.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\jaccess.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\jfxrt.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\localedata.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\nashorn.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\sunec.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\sunmscapi.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jre1.8.0_92\lib\ext\zipfs.jar
java_command: pkg.Temp
java_class_path (initial): C:\Users\posingh3\workspace\RWithJava\src;C:\Program Files\R\R-3.2.5\library\rJava\jri\JRI.jar;C:\Program Files\R\R-3.2.5\library\rJava\jri\JRIEngine.jar;C:\Program Files\R\R-3.2.5\library\rJava\jri\REngine.jar;C:\Users\posingh3\Downloads\spring-core-4.2.6.RELEASE.jar
Launcher Type: SUN_STANDARD
Environment Variables:
PATH=C:/Program Files/Java/jre1.8.0_92/bin/server;C:/Program Files/Java/jre1.8.0_92/bin;C:/Program Files/Java/jre1.8.0_92/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\R\R-3.2.4\bin\x64\;C:\Program Files\Git\cmd;C:\Program Files\gradle-2.13-all\gradle-2.13/bin;C:\Program Files\R\R-3.2.5\library\rJava\jri\;C:\Python27;C:\Python27\Scripts;C:\git;;C:\Users\posingh3\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Eclipse;
USERNAME=posingh3
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 7 , 64 bit Build 7601 (6.1.7601.23392)
CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 61 stepping 4, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx
Memory: 4k page, physical 8077544k(4278400k free), swap 16153232k(10584992k free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (25.92-b14) for windows-amd64 JRE (1.8.0_92-b14), built on Mar 31 2016 21:03:04 by "java_re" with MS VC++ 10.0 (VS2010)
time: Thu May 19 15:07:24 2016
elapsed time: 0 seconds (0d 0h 0m 0s)
私はWindows-7,64ビット版とEclipse Mars.2リリース(4.5.2)を使用しています。 どんな助けでも歓迎されるでしょう。:)
eclipseを閉じて.metadataフォルダを削除します。その後、Eclipseを開いてプロジェクトを再度インポートします。 –
アドバイスありがとうございますが、まだ動作していません! –
それは機能しましたか?はいの場合は、回答として追加します。 –