1

我正在尝试使用 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)

我无法弄清楚这个问题。

4

1 回答 1

2

好像您正在使用一些在服务器上使用 JDK6 编译的类(在 JDK5 上运行)。服务器上的所有类都必须针对 JDK5 进行编译,您的设置才能正常工作。

于 2013-04-06T09:55:33.357 回答