Hello everyone .

I am getting this error when i run the app :

Exception in thread "main" java.lang.NoClassDefFoundError:
javax/xml/stream/FactoryConfigurationError
 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
org.jibx.runtime.impl.UnmarshallingContext.createReaderFactory(UnmarshallingContext.java:187)
 at
org.jibx.runtime.impl.UnmarshallingContext.<clinit>(UnmarshallingContext.java:73)
 at JiBX_JibxSMT_bindingFactory.createUnmarshallingContext()
 at Test.main(Test.java:23)
i do have teh followin .jar files defined :

<condition property="runtime-jars-found">
    <available file="${jibx-home}/lib/jibx-run.jar"/>
  </condition>
  <condition property="binding-jars-found">
    <and>
  <available file="${jibx-home}/lib/bcel.jar"/>
  <available file="${jibx-home}/lib/jibx-bind.jar"/>
  <available file="${jibx-home}/lib/jibx-run.jar"/>
     <available file="${jibx-home}/lib/xpp3.jar"/>
     <available file="${jibx-home}/lib/xmlpull_1_1_4.jar"/>
     <available file="${jibx-home}/lib/wstx-asl.jar"/>
     <available file="${jibx-home}/lib/stax-api.jar"/>

    </and>
  </condition>
  <available property="extras-jar-found"
file="${jibx-home}/lib/jibx-extras.jar"/>


On Tue, Jun 10, 2008 at 6:27 PM, Jon Little <[EMAIL PROTECTED]> wrote:

> Hi
>
> Have got unmarshalling to work! Well ... from the JibX side of things -
> thank to everyone for there help. :)
>
> Have come up against another hurdle in that the Struts2 RESTful plug-in
> instantiates the object to be populated by the XML Handler.
>
> The standard xml handler which comes with Struts2 uses XStream.
>
> XStream has an overloaded "fromXML" method which takes an already
> instantiated object as a parameter and then populates it's attributes/and
> remaining object graph from the XML, as if XStream had created the object
> itself.
>
> I much prefer JibX hence writing my own XML Handler for the Strut2 RESTful
> plug-in. My first draft of the XML Handler's toObject is/was:
>
>   public void toObject(Reader in, Object target)
>   {
>     init();
>
>     try
>     {
>       IUnmarshallingContext umc = bf.createUnmarshallingContext();
>       target = umc.unmarshalDocument(in, null);
>     }
>     catch (JiBXException e)
>     {
>       // TODO Auto-generated catch block
>       e.printStackTrace();
>     }
>   }
>
> But I really need to have my handler work in the following fashion:
>
>
>   public void toObject(Reader in, Object *target*)
>   {
>     init();
>
>     try
>     {
>       IUnmarshallingContext umc = bf.createUnmarshallingContext();
>       umc.unmarshalDocument(in, null, *target*);
>     }
>     catch (JiBXException e)
>     {
>       // TODO Auto-generated catch block
>       e.printStackTrace();
>     }
>   }
>
> Where target is an already instantiated passed in to toObject by the
> Struts2 framework.
>
> Is there a way to unmarshall like this? If not then I think it'd be a great
> feature for JibX and would encourage people using Struts2 to implement their
> XML Handlers using JibX
>
> Jon
>
> Mahen Perera wrote:
>
>  Not sure whether this will help you.
>
>
>
> http://jibx.sourceforge.net/tutorial/binding-custom.html
>
>
>
> in this link you find the following information:
>
>
>
> "Besides the two constructor variations shown in this example, you can also
> define constructors that take an additional String parameter. If the binding
> compiler finds a constructor of this type it will pass the name of the
> object class that the marshaller/unmarshaller is used with in the binding
> when calling the constructor. This feature can be used to implement
> polymorphic marshaller/unmarshallers"
>
>
>
>
>  ------------------------------
>
> *From:* [EMAIL PROTECTED] [
> mailto:[EMAIL PROTECTED]<[EMAIL PROTECTED]>]
> *On Behalf Of *Jon Little
> *Sent:* 09 June 2008 03:45
> *To:* Dennis Sosnoski
> *Cc:* JiBX users
> *Subject:* Re: [jibx-users] Struts, jibx and unmarshalling
>
>
>
> Hi Dennis
>
> Thanks for your reply.
>
> I have taken your advice of having a single binding for all classes.
>
> However, I still confused when it comes to unmarshalling.
>
> The Struts XML Handler has:
>
> public void toObject(Reader in, Object target)
>
> The example on the JibX website gets a binding factory by passing in a
> class name. In my situation when toObject is called I will have no idea what
> class[es]/object[s] will be contained in the XML.
>
> How can I *getFactory* in this situation?
>
> Or is there one factory per binding file??
>
> Cheers
>
> Jon
>
> Dennis Sosnoski wrote:
>
> Hi Jon,
>
>
>
> Just to clarify, the normal way of using JiBX would be to have a single
>
> binding which includes <mapping> definitions for all the classes you're
>
> going to be marshalling/unmarshalling as root objects.
>
>
>
> If you really need to use a separate binding for each class you can make
>
> that work, too, but it'll be more work to keep track of the various
>
> bindings (which seemed to be what you were asking in your original
>
> email). Is there a reason you want to do it this way?
>
>
>
>   - Dennis
>
>
>
> Dennis M. Sosnoski
>
> SOA and Web Services in Java
>
> Training and Consulting
>
> http://www.sosnoski.com - http://www.sosnoski.co.nz
>
> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
>
>
>
>
>
>
>
> Varghese C V wrote:
>
>
>
> What i meant was to keep the binding factory as an instance variable in
>
> the xml handler, that is looked up during the initialization of the xml
>
> handler.
>
> Does this clear things?
>
>
>
> Jon Little wrote:
>
>
>
>
>
> Hi
>
>
>
> Thanks for your reply but I must admit the I do not comprehend what
>
> you mean.
>
>
>
> Jon
>
>
>
> Varghese C V wrote:
>
>
>
>
>
> The BindingFactory need not be looked up every time.
>
> During the Xml Handler initialization look the binding factory once
>
> with a class that is part of the binding.
>
> Looking up a binding factory from any class that is part of the
>
> binding definition would return the same binding factory.
>
> The binding factory is threadsafe.
>
>
>
> Personally, I use spring to inject a binding factory lookup class to
>
> a xml handler.
>
>
>
> Hope this helps
>
> Varghese C V
>
>
>
> Jon Little wrote:
>
>
>
>
>
> Hi
>
>
>
> I'm new to jibx but i love the concept.
>
>
>
> I'm planning on using jibx for the xml translator on struts.
>
>
>
> Each class will have a binding,
>
>
>
> The xml handler has two pre-defined methods - fromObject and toObject.
>
>
>
> The fromObject method is pretty straightforward (and I hope the
>
> toObject will be too):
>
> public String fromObject(Object obj, String resultCode, Writer out)
>
>   throws IOException
>
>   {
>
>     if (obj != null)
>
>     {
>
>       try
>
>       {
>
>         IBindingFactory bf =
>
> BindingDirectory.getFactory(obj.getClass());
>
>         IMarshallingContext mc = bf.createMarshallingContext();
>
>         mc.marshalDocument(obj, null, null, out);
>
>       }
>
>       catch (JiBXException e)
>
>       {
>
>         // TODO Auto-generated catch block
>
>         e.printStackTrace();
>
>       }
>
>     }
>
>     return null;
>
>   }
>
>
>
> The toObject method has the following signature:
>
>
>
> public void toObject(Reader in, Object target)
>
>
>
> My question is given that each class will have it's own binding and
>
> I don't know the class of the object that is about to be
>
> unmarshalled how do I call BindingDirectory.getFactory to get the
>
> correct binding?
>
>
>
> Thinking you in advance.
>
>
>
> Jon
>
>
>
> -------------------------------------------------------------------------
>
>
>
> Check out the new SourceForge.net Marketplace.
>
> It's the best place to buy or sell services for
>
> just about anything Open Source.
>
> http://sourceforge.net/services/buy/index.php
>
> _______________________________________________
>
> jibx-users mailing list
>
> jibx-users@lists.sourceforge.net
>
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
>
>
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
>
> Check out the new SourceForge.net Marketplace.
>
> It's the best place to buy or sell services for
>
> just about anything Open Source.
>
> http://sourceforge.net/services/buy/index.php
>
> _______________________________________________
>
> jibx-users mailing list
>
> jibx-users@lists.sourceforge.net
>
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
>
>
>
>
>
>
>
> The information contained in this email is strictly confidential and for
> the use of the addressee only, unless otherwise indicated. If you are not
> the intended recipient, please do not read, copy, use or disclose to others
> this message or any attachment. Please also notify the sender by replying to
> this email or by telephone (+44 (0)20 7896 0011) and then delete the email
> and any copies of it. Opinions, conclusions (etc.) that do not relate to the
> official business of this company shall be understood as neither given nor
> endorsed by it. IG Index plc is a company registered in England and Wales
> under number 01190902. VAT registration number 761 2978 07. Registered
> Office: Friars House, 157-168 Blackfriars Road, London SE1 8EZ. Authorised
> and regulated by the Financial Services Authority. FSA Register number
> 114059.
>
> ------------------------------
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.http://sourceforge.net/services/buy/index.php
>
> ------------------------------
>
> _______________________________________________
> jibx-users mailing [EMAIL 
> PROTECTED]://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to