Hi Jaideep, The marshalling code should be threadsafe, so I don't think your problem relates to that aspect of the application - especially since this occurs when you're trying to look up the binding factory.
The most puzzling part of this is that the BindingDirectory code is just using reflection on the class you pass in (always Letter.class in this case) to get the factory class name, and then a call to loadClass() to load the factory. The classloader used for attempting to load the factory class is that used to load the class you pass in (again, always Letter.class), so the only way I can see to have it work sometimes and not other times is if you have multiple classloaders in use and somehow one doesn't have the factory class in its path. The other alternative is that loadClass() has some thread safety issue, but I find that very hard to imagine unless you're using some custom classloader. Anything unusual with your classloader configuration? Just as a general note, your code takes an ILetter as input, but then looks up the binding on the assumption that it's an instance of the Letter class instance. A cleaner approach would be to use: IBindingFactory bfact = BindingDirectory./getFactory/(bindingName, letter.getClass()); so that you're loading the binding from the actual instance class passed in. I don't see how this could be the cause of your current problem, but it's better coding for future variations. - 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 Jaideep Deshmukh wrote: > > hi, > > I have several mappings in our JiBX application which we access by > binding Name. > I have got the following Exception > > org.jibx.runtime.JiBXException: Unable to access binding information > for class *entity.businessDomain.letter.Letter* > Make sure classes generated by the binding compiler are available at > runtime > > Unable to access binding information for class > entity.businessDomain.letter.Letter > Make sure classes generated by the binding compiler are available at > runtime > java.lang.ClassNotFoundException: > entity.businessDomain.letter.JiBX_CBP_B1Factory > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340) > > > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189) > > > at > org.jibx.runtime.BindingDirectory.getFactoryFromName(BindingDirectory.java:104) > > > at > org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:178) > at > org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:197) > at > entity.businessDomain.letter.generation.xml.XmlBinding.toXml(XmlBinding.java:28) > > > at > entity.businessDomain.letter.generation.LetterCreationService.printLetters(LetterCreationService.java:95) > > > at > entity.businessDomain.letter.generation.LetterCreationService.run(LetterCreationService.java:68) > > > at java.lang.Thread.run(Thread.java:595) > > > *entity.businessDomain.letter.Letter* is the class for which i have > written the binding file. > > *CBP_B1* is the name of the binding. The thing to note here is that I > have successfully marshallled another object using the same binding in > the same run. > > But it failed for a perticular object with ClassNotFoundException. I > also checked the jar files for the class > *entity.businessDomain.letter.JiBX_CBP_B1Factory* > and it appears in there. > > One more thing I am doing is , I am using 5 threads at a time to pick > Letter Objects from a BlockingQueue and then Marshall them. The > marshalling code > is not synchronised. > > The method i Use for Marshalling is > > *public* *static* *void* toXml(ILetter letter, String bindingName, > Writer wr, > String path) *throws* JiBXException, > IOException { > IBindingFactory bfact = > BindingDirectory./getFactory/(bindingName, > Letter.*class*); > IMarshallingContext mctx = > bfact.createMarshallingContext(); > mctx.setOutput(wr); > mctx.startDocument("UTF-8", *null*); > mctx.setIndent(4); > mctx.getXmlWriter().writeDocType("letter_requests", > path, *null*, *null*); > mctx.marshalDocument(letter); > } > > Is JiBX Marshalling Threadsafe? > > Is that something which might be causing the problem. I can not think > of any reason why a ClassNotFoundException should be thrown when it is > in the classpath. > Also When in other cases it has been successfully marshalled using the > same binding, in the same run. > > > We desparately need to find the problem. Any ideas will be a great help. > I hope i have covered all the information, if you need more please let > me know. > > thaanks & regards, > > > > Jaideep Deshmukh > Senior J2EE Developer > > e: mailto:jdeshm...@closepf.com > w: http://www.closepf.com > > CLOSE PREMIUM FINANCE > 21st Floor, Tolworth Tower > Ewell Road, Tolworth > Surbiton, Surrey KT6 7EL > United Kingdom > > This message (including any attachments) is confidential and may be > privileged. If you have received it by mistake please notify the > sender by return e-mail and delete this message from your system. Any > unauthorised use or dissemination of this message in whole or in part > is strictly prohibited. Please note that e-mails are susceptible to > change. Close Premium Finance shall not be liable for the improper or > incomplete transmission of the information contained in this > communication nor for any delay in its receipt or damage to your > system. Close Premium Finance does not guarantee that the integrity of > this communication has been maintained nor that this communication is > free of viruses, interceptions or interference. > > Close Premium Finance, Registered in England and Wales, Registered > Office: 10 Crown Place, London, EC2A 4FT. Authorised and regulated by > the Financial Services Authority > Close Brothers Limited and Close Premium Finance (Ireland) Ltd trading > as Close Premium Finance Ireland are authorised and regulated by the > Financial Services Authority in the UK, Registered Office: 10 Crown > Place, London, EC2A 4FT. > ________________________________________________________________________ > This email has been scanned for all viruses by the MessageLabs SkyScan > service. > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT > is a gathering of tech-side developers & brand creativity professionals. Meet > the minds behind Google Creative Lab, Visual Complexity, Processing, & > iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian > Group, R/GA, & Big Spaceship. http://www.creativitycat.com > ------------------------------------------------------------------------ > > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users