Internal Error (classFileParser.cpp:3174), pid=728

2020-07-18 03:46发布

I'm new to Android programming. My requirement is to call an HTTP request via HttpClient. Below is the code :

public class ClientWithResponseHandler { public final static void main(String[] args) throws Exception {

     HttpClient httpclient = new DefaultHttpClient();
     HttpGet httpget = new HttpGet("http://www.google.com/"); 
     System.out.println("executing request " + httpget.getURI());
     // Create a response handler
     ResponseHandler<String> responseHandler = new BasicResponseHandler();
     String responseBody = httpclient.execute(httpget, responseHandler);
     System.out.println(responseBody);

     System.out.println("----------------------------------------");

     // When HttpClient instance is no longer needed, 
     // shut down the connection manager to ensure
     // immediate deallocation of all system resources
     httpclient.getConnectionManager().shutdown();        
 }

}

After executing the above code as a Java Application i get the below error in the console.


#

A fatal error has been detected by the Java Runtime Environment:

#

Internal Error (classFileParser.cpp:3174), pid=7288, tid=7476

Error: ShouldNotReachHere()

#

JRE version: 6.0_20-b02

Java VM: Java HotSpot(TM) Client VM (16.3-b01 mixed mode windows-x86 )

An error report file with more information is saved as:

C:\Sandeep\eclipse\workspace\HelloWebService\hs_err_pid7288.log

#

If you would like to submit a bug report, please visit:

http://java.sun.com/webapps/bugreport/crash.jsp

#


Any idea what could be the problem

Regards Sandeep

标签: android
4条回答
▲ chillily
2楼-- · 2020-07-18 04:14

See this question and my answer to that:

I got the same problem, but with alot of googling I found the answer! See this page

Quote from the link:


# An unexpected error has been detected by Java Runtime Environment:
#
#  Internal Error (classFileParser.cpp:2924), pid=5364, tid=6644
#  Error: ShouldNotReachHere
  1. That's because we are using Android's JUnit stub implementation. Go to Run -> Run As -> Run configurations again and in the recently created JUnit configuration Classpath's Bootstrap Entries remove Android Library
  2. Then Add Library, using Advanced... button, and add JRE System Library and JUnit 3
  3. Apply and Run

Try this, it worked for me.

查看更多
别忘想泡老子
3楼-- · 2020-07-18 04:17

In addition to what Fredrik said, consider using AndroidHttpClient instead of DefaultHttpClient on an Android.

查看更多
【Aperson】
4楼-- · 2020-07-18 04:23

i removed the run configuration and created a new one again

查看更多
姐就是有狂的资本
5楼-- · 2020-07-18 04:30

Becase you use Java class, Eclipse think Project is Java not a Android. So,when you click "run", Eclipse will run as Java App. You should chick Run as->Android Application.

查看更多
登录 后发表回答