|
From: Rajesh K. <raj...@gm...> - 2012-05-08 03:43:18
|
Sorry.. Kindly ignore the first output...
On Mon, May 7, 2012 at 9:38 PM, Rajesh Khan <raj...@gm...> wrote:
> I wanted to know if anyone was familiar or ever came across the stackmap
> frame. After generating my java classes from an xsd and then compiling and
> binding them. I used the following code for my main file
> *
> package example25;
>
> import java.io.FileInputStream;
> import java.io.FileNotFoundException;
> import java.io.FileOutputStream;
> import java.util.Iterator;
>
> import org.jibx.runtime.BindingDirectory;
> import org.jibx.runtime.IBindingFactory;
> import org.jibx.runtime.IMarshallingContext;
> import org.jibx.runtime.IUnmarshallingContext;
> import org.jibx.runtime.JiBXException;
>
> public class Test
> {
>
> public static void main(String[] args)
> {
>
> try
> {
>
> // unmarshal customer information from file
> IBindingFactory bfact =
> BindingDirectory.getFactory(Order.class);
>
>
> IUnmarshallingContext uctx =
> bfact.createUnmarshallingContext();
> FileInputStream in = new FileInputStream("D:\\Java
> Libraries\\jibx\\dwcode2\\starter.xml");
> Order order = (Order)uctx.unmarshalDocument(in, null);
>
> // compute the total amount of the order
> float total = 0.0f;
> for (Iterator<Item> iter = order.getItemList().iterator();
> iter.hasNext();)
> {
> Item item = iter.next();
> total += item.getPrice() * item.getQuantity();
> }
> order.setTotal(new Float(total));
>
> // marshal object back out to file (with nice indentation, as
> UTF-8)
> IMarshallingContext mctx = bfact.createMarshallingContext();
> mctx.setIndent(2);
> FileOutputStream out = new FileOutputStream("c:\\out.xml");
> mctx.setOutput(out, null);
> mctx.marshalDocument(order);
> System.out.println("Processed order with " +
> order.getItemList().size() + " items and total value " + total);
>
> }
> catch (FileNotFoundException e)
> {
> e.printStackTrace();
> System.exit(1);
> } catch (JiBXException e)
> {
> e.printStackTrace();
> System.exit(1);
> }
> }
> }//end class*
>
> The output that i got after compiling the above file was
>
> C:\jibx>java -cp C:\jibx\tutorial example25.Test
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/jibx/runtime/JiBX
> Exception
> at java.lang.Class.getDeclaredMethods0(Native Method)
> at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
> at java.lang.Class.getMethod0(Unknown Source)
> at java.lang.Class.getMethod(Unknown Source)
> at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
> at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
> Caused by: java.lang.ClassNotFoundException: org.jibx.runtime.JiBXException
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> ... 6 more
>
> C:\jibx>java -cp c:\jibx\lib\jibx-run.jar;C:\jibx\tutorial; example25.Test
> Exception in thread "main" java.lang.VerifyError: Expecting a stackmap
> frame at branch target 12 in method
> example25.Order.JiBX_binding_newinstance_1_0(Lexample
> 25/Order;Lorg/jibx/runtime/impl/UnmarshallingContext;)Lexample25/Order; at
> offset 1
> at java.lang.Class.getDeclaredFields0(Native Method)
> at java.lang.Class.privateGetDeclaredFields(Unknown Source)
> at java.lang.Class.getDeclaredField(Unknown Source)
> at
> org.jibx.runtime.BindingDirectory.getBindingList(BindingDirectory.jav
> a:68)
> at
> org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:21
> 1)
> at example25.Test.main(Test.java:25)
>
> Does anyone know why i am getting this or how i might make this work ?
>
>
>
|