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

List:       jibx-users
Subject:    RE: [jibx-users] Newbie Question: Compiling the Binding
From:       "Shelli D. Orton" <shelli.orton () wmode ! com>
Date:       2006-01-30 23:49:47
Message-ID: 200601302349.k0UNnmB5002770 () wmode ! com
[Download RAW message or body]

I've been doing some experimenting with the location and name of my binding
file and have discovered that the name and relative path of the file are
what determines the names of the JiBX compiler classes, and I believe this
is causing my JiBXException.  By altering the directory structure in my
project, I've been able to successfully run my junit class.  The directory
structure now looks like this:

Project
  |-- com
    |-- my
      |-- package
        |-- [java files]
  |-- build
    |-- classes
      |-- com
        |-- my
          |-- package
            |-- [class files]

Does anyone know of way to override the name of the JiBX compiler class
files?  The JiBX website FAQs mentions using the package attribute, but I
can't find any other documentation or reference to this option.  Does this
option actually affect the class names?

Again, any help is appreciated,
Shelli

-----Original Message-----
From: jibx-users-admin@lists.sourceforge.net
[mailto:jibx-users-admin@lists.sourceforge.net] On Behalf Of Shelli D. Orton
Sent: Wednesday, January 25, 2006 5:28 PM
To: jibx-users@lists.sourceforge.net
Subject: RE: [jibx-users] Newbie Question: Compiling the Binding

I forgot to mention in the original post that the name of the JiBX classes
are not what I expected.  My project directories are set up like this:

Project
  |-- src
    |-- main
      |-- java
        |-- com
          |-- my
            |-- package
              |-- [java files]
  |-- build
    |-- classes
      |-- com
        |-- my
          |-- package
            |-- [class files]


So, for example, the JiBX file for class
com.my.package.ChangeProductRequest, the JiBX class is named
"JiBX_Project_src_main_java_com_my_package_bindingChangeProductRequest.class
".  Maybe the binding can't be found because of the extra
"Project_src_main_java_" in the class name?

I'm using ant to compile the bindings as part of my project build and have
created the task as such:

    <property name="jibx.lib.dir" value="${3rdparty}/jibx/lib"/>
    <property name="jibx.classpath"
value="${build.classes.dir}/com/my/package;${jibx.lib.dir}/jibx-run.jar;${ji
bx.lib.dir}/jibx-bind.jar;${jibx.lib.dir}/xpp3.jar;${jibx.lib.dir}/bcel.jar"
/>
    <java classname="org.jibx.binding.Compile" fork="yes"
dir="${build.classes.dir}" failonerror="true">
        <classpath path="${jibx.classpath}"/>
        <arg
value="${src}/${src.main.java.dir}/com/my/package/binding.xml"/>
    </java>

Is there a way to set/change the naming of the binding files?

Thanks,
Shelli

-----Original Message-----
From: jibx-users-admin@lists.sourceforge.net
[mailto:jibx-users-admin@lists.sourceforge.net]On Behalf Of Shelli D.
Orton
Sent: Wednesday, January 25, 2006 4:57 PM
To: jibx-users@lists.sourceforge.net
Subject: [jibx-users] Newbie Question: Compiling the Binding


Hi,

I'm working with JiBX (or any XML binding tool) for the first time.  My code
generates XML which is going to be passed to webservice hosted by another
company.  I received the xsd from the other company and generated classes
using xsd2jibx and compile them.  I ran the binding compiler on my class
files, and it created a bunch of new class files that look like
"JiBX_package_name_bindingOriginalClassName.class".  There's also a
JiBX_MungeAdapter.class.  Is this the expected results?

I have built a client class to make calls to the webservice and a junit test
class for this client class.  The client class has a createXML method which
uses the JiBX bindings.  I have tried to run the junit class to ensure that
the XML I need is being generated properly.  It looks like this:

    protected String createXMLString(ChangeProductRequest
changeProductRequest)
    throws JiBXException
    {
        String xml = null;

        // marshal object (with nice indentation, as UTF-8)
        IBindingFactory bfact =
BindingDirectory.getFactory(ChangeProductRequest.class);
        IMarshallingContext mctx = bfact.createMarshallingContext();

        mctx.setIndent(0);

        ByteArrayOutputStream out = new ByteArrayOutputStream();

        mctx.marshalDocument(changeProductRequest, "UTF-8", null, out);

        xml = out.toString();

        return xml;
    }

The junit creates an instance of the client class.  However, when I run the
tests, the line:

    IBindingFactory bfact =
BindingDirectory.getFactory(ChangeProductRequest.class);

throws this exception:

(org.jibx.runtime.JiBXException) org.jibx.runtime.JiBXException: Unable to
access binding information for class com.rogers.wam.ChangeProductRequest
Make sure the binding has been compiled

My source files are in a src directory and my class files (including the
JiBX generated classes) are in a separate build directory.  Could this be
what is throwing the exception?  Have I done something else wrong?

Any help is greatly appreciated,
Shelli



-------------------------------------------------------
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=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=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
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