English 中文(简体)
ClassFormatError: 56 while using hessian in j2me
原标题:

I am trying to use the hessian j2me implementation @ http://hessian.caucho.com/ using java me sdk 3.0.

http://hessian.caucho.com/doc/hessian-overview.xtp#Hessian%20Client%20for%20a%20cell-phone mentions the usage for j2me.

The application builds without any errors/warning. But, the moment the line where MicroHessianOutput is instantiated is hit, a ClassFormatError ( java.lang.Error: ClassFormatError: 56 ) is thrown.

Heres the trace :

TRACE: <at java.lang.Error: ClassFormatError:  56>, startApp threw an Exception
java.lang.Error: ClassFormatError:  56
 - alert.AlertDemo.showOption(), bci=26
 - alert.AlertDemo.startApp(), bci=9
 - javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
 - com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
 - com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
 - com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
 - com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
 - com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
 - com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26

and heres showOption():

private void showOption () throws Exception{
       String url = "http://localhost/hello";

        HttpConnection c = (HttpConnection) Connector.open(url);

        c.setRequestMethod(HttpConnection.POST);

        OutputStream os = c.openOutputStream();
        MicroHessianOutput out = new MicroHessianOutput(os); //error throwing line
        /*
        out.startCall("hello");

        InputStream is = c.openInputStream();

        MicroHessianInput min = new MicroHessianInput(is);
        min.startReply();
        System.out.println(min.readString());
        */
    }

I have jdk 1.6u16 installed. I am thinking it might be because the classes in the library might have been written for an older jdk. I don t see any option in the IDE to configure this.

Here s the class source code: MicroHessianOutput

Any idea why this could be happening ?

最佳回答

ClassFormatError happens when your JVM cannot load a class because it does not recognize it s format (e.g. JVM 1.4 trying to load class compiled by javac 1.5).

It s likely that J2ME requires an older target for classes. Try to recompile your Hessian stuff with

 javac -target 1.4 ...
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签