[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jibx-users
Subject:    Re: [jibx-users] Classpath issues with JiBX'd Domain Objects in RAD 6.0 and WebSphere
From:       James Abley <james.abley () gmail ! com>
Date:       2006-01-17 22:05:03
Message-ID: 23fce8e60601171405n470dd593p () mail ! gmail ! com
[Download RAW message or body]

Thanks Dennis,

I was going to do something similar tomorrow when I get back to a
reasonable spec machine rather than my rather old Pentium 2 laptop ;-)

That would be a potentially useful feature, but I'm not sure whether
it's just a reflection on the design of the object model I'm trying to
marshall which causes these problems, rather than an issue with JiBX.
Obviously you need more feedback as to to general applicability of
this requirement. Anyone else encountered this?

James

On 17/01/06, Dennis Sosnoski <dms@sosnoski.com> wrote:
> Okay, here's the real story (at least using the Sun 1.5 JVM)...
>
> I changed the starter application Test.java class to be:
>
> package org.jibx.starter;
>
> import java.io.FileInputStream;
> import java.io.FileNotFoundException;
> import java.io.FileOutputStream;
>
> public class Test
> {
>     public static void main(String[] args) {
>         System.out.println("Creating instance of data object");
>         new Person();
>         System.out.println("Created instance of data object");
>         System.out.println("Creating instance of mapped data object");
>         new Customer();
>         System.out.println("Created instance of mapped data object");
>     }
> }
>
> Running this with verbose classloading gives:
>      ...
>      [java] Creating instance of data object
>      [java] [Loaded org.jibx.starter.Person from
> file:/secure/dennis/projects/jibx/v11/trythis/bin/]
>      [java] Created instance of data object
>      [java] Creating instance of mapped data object
>      [java] [Loaded sun.misc.URLClassPath$JarLoader$1 from shared
> objects file]
>      ...
>      [java] [Loaded org.jibx.runtime.IUnmarshallable from
> file:/secure/dennis/projects/jibx/v11/lib/jibx-run.jar]
>      [java] [Loaded org.jibx.runtime.IMarshallable from
> file:/secure/dennis/projects/jibx/v11/lib/jibx-run.jar]
>      [java] [Loaded org.jibx.starter.Customer from
> file:/secure/dennis/projects/jibx/v11/trythis/bin/]
>      [java] Created instance of mapped data object
>      ...
>
> I then tried running this with verbose classloading and no JiBX jars in
> the classpath with this result:
>
>      ...
>      [java] Creating instance of data object
>      [java] [Loaded org.jibx.starter.Person from
> file:/secure/dennis/projects/jibx/v11/trythis/bin/]
>      [java] Created instance of data object
>      [java] Creating instance of mapped data object
>      [java] [Loaded java.lang.ClassFormatError from shared objects file]
>      [java] [Loaded java.io.IOException from shared objects file]
>      [java] Exception in thread "main" java.lang.NoClassDefFoundError:
> org/jibx/runtime/IUnmarshallable
>
> So you can create instances of <structure>-bound classes without having
> the JiBX runtime available, but need to have the runtime in order to
> create instances of <mapped> classes. If you use the <binding>
> track-source="true" attribute you'd need the runtime even for
> <structure>-bound classes, since that adds an interface to these classes.
>
> It might be useful to add an option to v2 that avoids adding interfaces
> to the mapped classes. This would make marshalling a little more
> complicated, but might be worthwhile for people sharing the binary
> classes across different environments.
>
>   - Dennis
>
> James Abley wrote:
>
> >On 18/01/06, Mark Wutka <mark@wutka.com> wrote:
> >
> >
> >>" I'm using IBM Rational Application Developer (RAD)V6. Its got an embedded Web
> >>" Sphere but am uncertain of its version.
> >>" I've mapped a number of Domain Classes. The mapping is only one way , from XML
> >>" to Domain Classes.
> >>" All JUnit test cases run fine. The test cases just convert from XML to one or
> >>" more Domain Classes using XSLT to transform to the JiBX input XML.
> >>" However if I attempt to create a mapped Domain Class whilst running in the Web
> >>" Application, ( e.g. Domain domain = new Domain())then Web Sphere complains with
> >>" a ClassDefNotFound exception citing that the JiBX Unmarshaller cannot be found.
> >>" And indeed the classpath shown in the stacktrace does not include the
> >>" jibx-runtime.jar. But still we're not doing any JiBX work here just a Domain
> >>" Class create. Creating non mapped Domain classes presents no problems.
> >>
> >>If I understand this correctly, you have created a JiBX mapping for your
> >>domain class and even though you are not using JiBX, it is looking for
> >>JiBX classes when you used that class. I think this is because of the byte
> >>code that JiBX inserts into your class. Even though you aren't using JiBX, the
> >>classloader does need to resolve the references within the class, and
> >>the inserted code does refer to various JiBX classes.
> >>  Mark
> >>
> >>
> >>
> >>
> >
> >Agreed.
> >
> >http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html#loadClass(java.lang.String,
> >boolean)
> >
> >I've also seen this when using ANT to run tests on objects which have
> >been subject to JiBX's BCEL treatment, necessitating having the
> >jibx-runtime.jar on the classpath. I haven't delved too deeply to see
> >whether this is a JVM classloader, JUnit classloader or ANT
> >classloader in this case.
> >
> >James
> >
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic