ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2

ERROR JDWP Unable to get JNI 1.2 environment, jvm-GetEnv() return code = -22008-08-26 10:20注:取材网络,收集归纳,以备所需。

我在Eclipse下启动Tomcat6.0时正常,但关闭Tomcat6.0后,控制台输出如下错误信息,不知道是为什么?请指教。谢谢!

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]

这是因为如果不指定默认的输入输入设备,jdk1.6会指定为键盘默认的输入设备,调用的地方为默认的输出设备。而Eclipse的调用显然不是!

你用的是1.6的JDK吧,这个是一个JDK的Bug(id=6476706)
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6476706


Bug ID: 6476706
Votes 47
Synopsis Error AGENT_ERROR_NO_JNI_ENV printed sometimes to console when JVM finishes
Category java:debugger
Reported Against b99
Release Fixed  
State In progress, bug
Priority: 4-Low
Related Bugs  
Submit Date 29-SEP-2006
Description The following error is printed to console when debugger is about to finish:

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]

It was found by other people as well:

http://www.google.co.uk/search?hl=en&q=AGENT_ERROR_NO_JNI_ENV%28183%29++util.c%3A820&btnG=Google+Search&meta

I am able to reproduce it with xxxxx IDE (http://www.netbeans.org/issues/show_bug.cgi?id=85538):

- install xxxxx IDE 6.0
- create a java project
- add two lines to main method (System.out.println("aaa");System.out.println("bbb");)
- add customer to the first line
- start debugger (F5)
- continue when it stops at customer . The error message above is SOMETIMES
printed to output window.

Build NB 6.0 20060919-0644, JDK1.6.0-b99, WindowsXP.
Posted Date : 2006-09-29 11:59:37.0

An e-mail comment from Alan:

> It sounds like a timing issue in the shutdown with the agent still running.
Posted Date : 2007-03-13 16:11:28.0


Work Around N/A

Evaluation N/A

Comments     
Include a link with my name & email  

Submitted On 22-NOV-2006
Still in
Sun Microsystems Inc. 1.6.0-rc


Submitted On 13-DEC-2006
i have same errors too...


Submitted On 16-DEC-2006
I get this error also...


Submitted On 17-DEC-2006
Me too...


Submitted On 28-DEC-2006
Mikhail0s same


Submitted On 02-JAN-2007
njusohohchaser ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 02-JAN-2007
so wot?


Submitted On 10-JAN-2007
Betlista Same problem with eclipse :-/


Submitted On 10-JAN-2007
Betlista In main method there could be no code and error occures, so there will be (I think) no workaround...


Submitted On 12-JAN-2007
I got similar error.

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 14-JAN-2007
JonRWoods Happens one in ten times for me too when debugging short programs. JDK 1.6.0 (build 1.6.0-b105) on Windows XP Professional from Eclipse 3.2.1. As for others:

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 21-JAN-2007
Still appears in build 105


Submitted On 23-JAN-2007
Happened to me this morning debugging in NetBeans


Submitted On 24-JAN-2007
jwcarman Happens to me within IntelliJ IDEA. I wrote a simple "Hello, World" main() method and tried to debug it. Got the same exact error message.


Submitted On 05-FEB-2007
netrice I get this error also...


Submitted On 10-FEB-2007
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]

I first use JDK6.0 to debug my program,but it shown me above, sign


Submitted On 18-FEB-2007
Orclev still showing up in 1.6.0-b105
reproduced using MyEclipse Enterprise Workbench 5.5.0 Milestone 1 and Maven 2.0.5
Exact error is same as posted previously, but I'll repost for clarity:
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 18-FEB-2007
Orclev Still in 1.6.0-b105 JDK on WindowsXP
Was able to reproduce it using Maven 2.0.5, so it seems to be related to any sort of debuger, specificly it occurs during the test phase of the Maven build. Exact error follows:
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 12-MAR-2007
I made a console program with JDI and worked it on JDK1.4 and JDK1.5 without problems. But on JDK1.6, same message is sometimes found (not always).
--
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]
--
My environment is:
- JDK1.6 (build 1.6.0-b105)
- Windows XP SP2


Submitted On 15-MAR-2007
Eu tambem tive esse erro


Submitted On 16-MAR-2007
joejoes75 Me Too!


Submitted On 17-MAR-2007
same here


Submitted On 17-MAR-2007
tried with JDK1.5, no error


Submitted On 19-MAR-2007
prajzv1 same for me, netbeans 5.5, jdk1.6.0, WinVista


Submitted On 20-MAR-2007
Same here, fixed it.
Had a JFrame in my package without showing it.

Original:
    public static void main(String[] args) {
        // TODO code application logic here
    }

Fixed:
    public static void main(String[] args) {
        // TODO code application logic here
        frameMain fm = new frameMain();
        fm.setVisible(true);
    }


Submitted On 23-MAR-2007
my workaround...

Original:   
public static void main(String[] args) {
        System.out.println("test");
}

Workaround:
    public static void main(String[] args) {
        System.out.println("test");
        System.exit(0);
    }


Submitted On 04-APR-2007
andig2 Still present in 1.6.0_01 U1


Submitted On 07-APR-2007
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 11-APR-2007
Getting this on my Maven projects in Eclipse using Java 6u1, which is preventing my company to adapt Java 6. Same error message as above.


Submitted On 15-APR-2007
me too
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 04-MAY-2007
Me too.
I'm trying to programme with Berkley DB,then it occurred.


Submitted On 04-MAY-2007
When will this bug be fixed?
Since last year SEP


Submitted On 04-MAY-2007
Me too.
I'm trying to programme with Berkley DB,then it occurred.


Submitted On 11-MAY-2007
eating Yeah, I met with the same problem in eclipse 3.2.2 win32
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 31-MAY-2007
cigxw same error; latest java 1.6.0_01-b06; win xp sp2


Submitted On 01-JUN-2007
belgampaul it happens sometimes while debugging a project. Some projects are debugged with no problems, in others it is quite random. Sometimes debugging works, sometimes not.


jdk 1.6
netbeans 6.0(M9)


Submitted On 01-JUN-2007
belgampaul Thanks for the workarounds. None of them don't work with Netbeans 6.0(M9), jdk 1.6.

I was able more less to find the workaround in Netbeans though. I just refactor the class the doesn't submit the first breakpoint.

I've already encountered some weird stuff with the netbeans refactoring but this one is just too weird.


Submitted On 27-JUN-2007
DJnZ got it too..
Eclipse SDK
Version: 3.2.2
Build id: M20070212-1330
java.runtime.version=1.6.0_01-b06


Submitted On 10-JUL-2007
The same error:
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]

I'm using Eclipse 3.2.1 running on JDK 1.6.0_02 and this error occures when I finishing debugging my app.


Submitted On 14-JUL-2007
Error AGENT_ERROR_NO_JNI_ENV solution
Workaroud (works for me):
I've make this workaround based in info in this.
Somebody said this could be a timing problem for short programs, so put somewhere in main(...) beginning this code:

    try
    {
      Thread.sleep(100);
    }
    catch(Exception e)
    {}


Submitted On 22-JUL-2007
try to remove all the breakpoints and then to add breakpoints if it's needed.
I had the same message and it doesn't appear anymore!


Submitted On 17-AUG-2007
Same is here
jdk 1.6.0_02
Eclipse 3.3 _Maven Plugin


Submitted On 28-AUG-2007
What happens if you use JDK instead of JRE? Is the message still shown?


Submitted On 10-SEP-2007
Got the same error..
Eclipse
jdk 1.6.0_02


Submitted On 06-OCT-2007
Same here
jdk 1.6.0u2
eclipse 3.3.1


Submitted On 11-OCT-2007
Same issue here:

Product Version: NetBeans IDE 6.0 Beta 1 (Build 200709141330)
Java: 1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)


Submitted On 22-OCT-2007
I just encountered this error, and its driving me crazy, i cant compile my project anymore! isnt there ANY workaround??

Eclipse Version: 3.3.0
Build id: M20070921-1145

JDK 1.6.0_03


Submitted On 28-OCT-2007
As andig2 noted, adding "System.exit(0)" is a very good workaround.


Submitted On 12-NOV-2007
Has someone finally found any kind of workaround?


Submitted On 17-NOV-2007
facing the same issue


Submitted On 30-NOV-2007
Happened on jdk1.6.0_03 netbeans 6.1 rel.29-11-07 in search for icon by image chooser in debugging jswing. 30 nov 07
shahrokh


Submitted On 06-DEC-2007
DiGiTaL_FuRy I am using java 1.6.0_02 on XP Pro
I keep getting it and I don't know why. I took out all my break points and it still happens.

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 01-JAN-2008
I got this problem, too. But the run function can not work anymore.
Environment: Eclipse 3.2.2 + JRE 1.6

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 01-JAN-2008
I got this problem,too. Eclipse 3.2.2 + JRE 1.6


Submitted On 05-JAN-2008
I got this problem, too. But the run function can not work anymore.
Environment: Eclipse 3.2.2 + JRE 1.6

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


Submitted On 28-JAN-2008
Exekutor Exact same problem here

EasyEclipse Server Java
Version: 1.2.2.2
Based on Eclipse build id: M20070212-1330

java version "1.6.0_03"

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]

 

PLEASE NOTE: JDK6 is formerly known as Project Mustang
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值