调用java类时的异常

时间:2012-12-06 16:43:52

标签: java

我有这个类,在运行java应用程序时不能在eclipse中启动。有人有并且知道问题是什么

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;

import android.test.AndroidTestCase;
import android.util.Log;


public class ClientApp{


    public static void main(String args[]){
        ClientApp client = new ClientApp();
        client.checkLogin("system/system", "system");

    }
    private static final String TAG = ClientApp.class.getSimpleName();

    public static String checkLogin(String username, String password) {

        String retVal = "";
        HttpClient client = new DefaultHttpClient();
        HttpPost post = new HttpPost("http://192.168.101.27/pdxapi/service/rest/ClientApp/checkLogin");
        try {
            String hashedPw = DigestFactory.calculatePasswordHash(password);
            Log.i(TAG, "----hashed pw is: " +  hashedPw);
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("username",   username));
            nameValuePairs.add(new BasicNameValuePair("password",   hashedPw));
            post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            HttpResponse response = client.execute(post);
            if (response.getEntity() == null){

                retVal = "";                
            }
            else{
                BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
                StringBuffer sb = new StringBuffer();
                String line = "";
                while ((line = rd.readLine()) != null) {
                    sb.append(line);
                }               
                retVal = sb.toString();             
            }

        } catch (IOException e) {
            Log.e(TAG, "error during login " + e.getMessage());
        }
        return retVal;
    }


    public static String attach(String username, String hashedpassword, String attachmentUri) {

        //binary in den body reinhhauen


        String retVal = "";
            return retVal;
    }
}

这是崩溃的日志文件

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (classFileParser.cpp:3494), pid=5936, tid=4820
#  Error: ShouldNotReachHere()
#
# JRE version: 6.0_32-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.7-b02 mixed mode windows-amd64 compressed oops)
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

---------------  T H R E A D  ---------------

Current thread (0x00000000003bc000):  JavaThread "Unknown thread" [_thread_in_vm, id=4820, stack(0x0000000002870000,0x0000000002970000)]

Stack: [0x0000000002870000,0x0000000002970000]
[error occurred during error reporting (printing stack bounds), id 0xc0000005]


---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )

Other Threads:

=>0x00000000003bc000 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=4820, stack(0x0000000002870000,0x0000000002970000)]

VM state:not at safepoint (not fully initialized)

VM Mutex/Monitor currently owned by a thread: None

Dynamic libraries:
0x0000000000400000 - 0x000000000042f000     C:\Program Files\Java\jdk1.6.0_32\bin\javaw.exe
0x0000000077c50000 - 0x0000000077df9000     C:\Windows\SYSTEM32\ntdll.dll
0x0000000077570000 - 0x000000007768f000     C:\Windows\system32\kernel32.dll
0x000007fefe410000 - 0x000007fefe47c000     C:\Windows\system32\KERNELBASE.dll
0x000007fefe670000 - 0x000007fefe74b000     C:\Windows\system32\ADVAPI32.dll
0x000007feffc50000 - 0x000007feffcef000     C:\Windows\system32\msvcrt.dll
0x000007feffd90000 - 0x000007feffdaf000     C:\Windows\SYSTEM32\sechost.dll
0x000007feffdb0000 - 0x000007feffedd000     C:\Windows\system32\RPCRT4.dll
0x0000000077b50000 - 0x0000000077c4a000     C:\Windows\system32\USER32.dll
0x000007fefe910000 - 0x000007fefe977000     C:\Windows\system32\GDI32.dll
0x000007fefecf0000 - 0x000007fefecfe000     C:\Windows\system32\LPK.dll
0x000007fefe840000 - 0x000007fefe909000     C:\Windows\system32\USP10.dll
0x000007fefe980000 - 0x000007fefe9ae000     C:\Windows\system32\IMM32.DLL
0x000007fefebe0000 - 0x000007fefece9000     C:\Windows\system32\MSCTF.dll
0x0000000180000000 - 0x0000000180019000     C:\PROGRA~2\KASPER~1\KASPER~1.0FO\x64\adialhk.dll
0x000007feffa90000 - 0x000007feffb01000     C:\Windows\system32\SHLWAPI.dll
0x00000000002f0000 - 0x00000000002f6000     C:\PROGRA~2\KASPER~1\KASPER~1.0FO\x64\kloehk.dll
0x000000006d8b0000 - 0x000000006e068000     C:\Program Files\Java\jdk1.6.0_32\jre\bin\server\jvm.dll
0x000007fefc190000 - 0x000007fefc1cb000     C:\Windows\system32\WINMM.dll
0x000000006d820000 - 0x000000006d82e000     C:\Program Files\Java\jdk1.6.0_32\jre\bin\verify.dll
0x000000006d450000 - 0x000000006d477000     C:\Program Files\Java\jdk1.6.0_32\jre\bin\java.dll
0x000000006d870000 - 0x000000006d882000     C:\Program Files\Java\jdk1.6.0_32\jre\bin\zip.dll
0x0000000077e10000 - 0x0000000077e17000     C:\Windows\system32\PSAPI.DLL

VM Arguments:
jvm_args: -Dfile.encoding=Cp1252 -Xbootclasspath:F:\Android\android-sdk-windows\platforms\android-17\android.jar 
java_command: de.srs.android.pdixuploader.network.ClientApp
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=c:\java
PATH=C:\Program Files (x86)\ImageMagick-6.7.5-Q16;c:\Program Files (x86)\ImageMagick-6.7.5-Q16;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\development\java\tools\apache-ant-1.8.0-bin\bin;C:\Program Files (x86)\gs\gs8.70\bin;C:\Program Files (x86)\gs\gs8.70\lib;D:\development\java\tools\apache-maven-2.2.1\bin;c:\java\bin;C:\Program Files (x86)\gs\gs8.70\bin;C:\Program Files (x86)\gs\gs8.70\lib;C:\Program Files (x86)\TC UP\PLUGINS\Library;C:\Program Files (x86)\gs\gs8.70\bin;C:\Program Files (x86)\gs\gs8.70\lib;C:\Program Files (x86)\Common Files\Adobe\AGL;C:\Program Files\SlikSvn\bin\;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;D:\development\groovy/bin;E:\devel\python\python27;E:\devel\python\python27/Scripts;C:\Program Files\TortoiseSVN\bin;MAVEN\bin;C:\Program Files (x86)\Git\cmd
USERNAME=o.jazic
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 10, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 7 , 64 bit Build 7601 Service Pack 1

CPU:total 4 (4 cores per cpu, 1 threads per core) family 6 model 23 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1

Memory: 4k page, physical 4193268k(465044k free), swap 12383416k(5922328k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (20.7-b02) for windows-amd64 JRE (1.6.0_32-b05), built on Apr  5 2012 13:39:03 by "java_re" with MS VC++ 8.0 (VS2005)

time: Thu Dec 06 17:11:24 2012
elapsed time: 0 seconds

0 个答案:

没有答案