我正在尝试使用Android将一些响应参数传递给Java Web应用程序。我正在使用jdk 1.6_32进行android开发,并在服务器端使用jdk1.5_06。我尝试传递的参数是登录凭据(字符串)和Base64编码为字符串的png文件。登录凭据已正确传递,但是在传递png文件时,服务器引发以下异常:

15:08:33,264 ERROR [[ImageRetrieve]] Servlet.service() for servlet ImageRetrieve threw exception
java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1629)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:850)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1299)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at com.apd.test.ImageRetrieve.doPost(ImageRetrieve.java:46)
    at com.apd.test.ImageRetrieve.doGet(ImageRetrieve.java:37)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Thread.java:595)


我无法找出问题所在。

最佳答案

似乎您正在使用在服务器上运行JDK6编译的某个类(在JDK5上运行)。服务器上的所有类都必须根据JDK5进行编译,才能使设置正确运行。

10-05 18:02