Re: [jibx-users] Cross-jar JiBX mapping

2009-05-27 Thread Karel Alfonso
Hi Keith,

  Yes, I documented the issue with Maven and potentially any other build
framework in
http://www.mail-archive.com/jibx-users@lists.sourceforge.net/msg03937.html

  I haven't checked the fix in the source code repository. We're waiting
for a release that will give us a sense of stability before changing the
workaround we came up with in our project.

  Cheers,

  Karel

> It sounds like I'm having the same problem that Karel documented in
> the following thread:
> http://www.mail-archive.com/jibx-users@lists.sourceforge.net/msg03949.html.
>
> I am also using the maven jibx plugin and precompiled class bindings
> and am getting the 'classloader conflict for binding...factory doesnot
> implement required interface' exception.
>
> Was there ever a resolution or workaround to this for version 1.2.1,
> or will we have to wait until 1.2.2 to get a fix for this?
>
> Thanks everyone,
>
> Keith
>
> On Thu, May 21, 2009 at 3:58 PM, Keith Bennett 
> wrote:
>> Quick update: I put relative reference in to the binding file in my
>> domain project via relative file path, and now I'm getting the
>> following error when my services mappings are compiled:
>>
>> Classloader conflict for binding 'serviceBinding' - factory does not
>> implement required interface.
>>
>> Has anyone seen this before?  What does this mean?
>>
>> On Thu, May 21, 2009 at 3:26 PM, Keith Bennett 
>> wrote:
>>> Dennis,
>>>
>>> Thanks for your suggestion.  I included a maven copy goal in my
>>> project build per your suggestion, so the domain jar is copied
>>> successfully before my services jar is built.  However, I am unable to
>>> specify the include element in my services project JiBX mappings, as I
>>> don't have reference to the domain mapping file from my my services
>>> project.  I tried completely omitting the include element in my
>>> services mappings to see if that would work (which successfully
>>> compiles), but I'm still getting the error below at runtime:
>>>
>>> Caused by: org.jibx.runtime.JiBXException: Unable to access binding
>>> information for class com.company.Item
>>> Make sure the binding has been compiled
>>>
>>> I am using Spring WS and am using
>>> org.springframework.oxm.jibx.JibxMarshaller from within my services
>>> project.  JiBX doesn't appear to be "seeing" the JiBX-enabled domain
>>> class that's in the domain jar at runtime.  Any suggestions?
>>>
>>> I appreciate your help.  By the way, I am very impressed with JiBX.
>>> I'm struggling with this last bit, but once I get over this hump, I
>>> think my client will love the fact that the JiBX solution requires
>>> absolutlely no additional code (except for the minimal Spring required
>>> classes) to enable web service access to our business services.  Great
>>> job!
>>>
>>> Thanks,
>>>
>>> Keith
>>>
>>> On Wed, May 20, 2009 at 6:47 PM, Dennis Sosnoski 
>>> wrote:
 Hi Keith,

 You can use precompiled bindings for this purpose:
 http://jibx.sourceforge.net/binding/precompiled.html Just run the
 binding compiler for the domain classes and then jar up the modified
 classes, and include the resulting jar in the classpath when you run
 the
 binding compiler for the services classes.

  - 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



 Keith Bennett wrote:
> I am using Maven to build a separate business domain jar from the
> business services jar to abide by my client's layered architecture.
>  I
> would like to be able to reference a JiBX mapping for a domain class
> (that is managed in the domain project) from within a JiBX mapping
> for
> a business service class (that is managed in the business services
> project).  Is there a way to do this with JiBX?  In other words, from
> within a mapping file in one Maven project, I would like to reference
> a type that is managed in a separate Maven project (i.e., jar at
> runtime).  Below is the error I am currently getting.  If I copy all
> of my business domain classes into my business services project,
> everything works fine.  I only get this error when I separate the
> projects and the separate jars are built.
>
> 20:03:07,548 ERROR [STDERR]
> org.springframework.oxm.jibx.JibxMarshallingFailureException: JiBX
> marshalling exception: No marshal mapping defined for class
> com.company.businessobject.Item; nested exception is
> org.jibx.runtime.JiBXException: No marshal mapping defined for class
> com.company.businessobject.Item
>
> If anyone has done this, I would appreciate any advice you could
> share.
>
> Thanks,
>
> Keith
>
> --
> Crystal Reports - New Free Runtime and 30 Day Trial
> Ch

Re: [jibx-users] Simple Precompiled Binding Fails

2009-04-21 Thread Karel Alfonso
Hi Lenny,

   I had the same issue with precompiled bindings. Please refer to my
previous post:
http://www.mail-archive.com/jibx-users%40lists.sourceforge.net/msg03937.html
there you can find a fix that involves rebuilding JiBX and using that
jar instead.

   Dennis mentioned he would take a look at it, si I think, most likely it:
http://www.mail-archive.com/jibx-users%40lists.sourceforge.net/msg03949.html

 Hope that helps,

 Cheers,

 Karel

> Hi guys,
> I am trying to get a simple precompiled binding (using ant) to work.
> This is the binding that is being called (precompiledBindings.xml)
> 
>  
> 
>
> This is the binding that is using the precompiled binding (bindings.xml)
> 
>   
>  
> 
>
> Here is the exception:
>  [bind] *** Error during code generation for file 'bindings.xml' -
> please enter a bug report for this error in Jira if the problem is not
> listed as fixed on the online status page ***
>  [bind] org.jibx.runtime.JiBXException: Classloader conflict for
> binding 'precompiledBindings' - factory does not implement required
> interface
>  [bind]   at
> org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:269)
>  [bind]   at
> org.jibx.binding.def.BindingBuilder.unmarshalInclude(BindingBuilder.java
> :2002)
>  [bind]   at
> org.jibx.binding.def.BindingBuilder.unmarshalBindingDefinition(BindingBu
> ilder.java:2099)
>  [bind]   at
> org.jibx.binding.Utility.loadBinding(Utility.java:314)
>  [bind]   at
> org.jibx.binding.Utility.loadFileBinding(Utility.java:431)
>  [bind]   at org.jibx.binding.Compile.compile(Compile.java:212)
>  [bind]   at
> org.jibx.binding.ant.CompileTask.execute(CompileTask.java:248)
>  [bind]   at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>  [bind]   at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown
> Source)
>  [bind]   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
>  [bind]   at java.lang.reflect.Method.invoke(Method.java:585)
>  [bind]   at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:1
> 05)
>  [bind]   at org.apache.tools.ant.Task.perform(Task.java:348)
>  [bind]   at org.apache.tools.ant.Target.execute(Target.java:357)
>  [bind]   at
> org.apache.tools.ant.Target.performTasks(Target.java:385)
>  [bind]   at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>  [bind]   at
> org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleChe
> ckExecutor.java:38)
>  [bind]   at
> org.eclipse.ant.internal.ui.antsupport.EclipseSingleCheckExecutor.execut
> eTargets(EclipseSingleCheckExecutor.java:30)
>  [bind]   at
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>  [bind]   at
> org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
>  [bind]   at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>  [bind]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>  [bind]   at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
>  [bind]   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
>  [bind]   at java.lang.reflect.Method.invoke(Method.java:585)
>  [bind]   at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:1
> 05)
>  [bind]   at org.apache.tools.ant.Task.perform(Task.java:348)
>  [bind]   at org.apache.tools.ant.Target.execute(Target.java:357)
>  [bind]   at
> org.apache.tools.ant.Target.performTasks(Target.java:385)
>  [bind]   at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>  [bind]   at
> org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleChe
> ckExecutor.java:38)
>  [bind]   at
> org.eclipse.ant.internal.ui.antsupport.EclipseSingleCheckExecutor.execut
> eTargets(EclipseSingleCheckExecutor.java:30)
>  [bind]   at
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>  [bind]   at
> org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
>  [bind]   at
> org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
>  [bind]   at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>  [bind]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>  [bind]   at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
>  [bind]   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
>  [bind]   at java.lang.reflect.Method.invoke(Method.java:585)
>  [bind]   at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:1
> 05)
>  [bind]   at org.apache.tools.ant.Task.perform(Task.java:348)
>  [bind]   at org.apache.tools.ant.Target.execute(Target.java:357)
>  [bind]   at
> org.apache.tools.ant.Target.performTasks(Target.java

[jibx-users] Fixed precompiled bindings with maven JiBX plugin

2009-03-30 Thread Karel Alfonso
Hi everyone,

   I managed to run a successful build referencing a precompile binding
from the Maven JiBX plugin, Maven Antrun plugin and also by invoking
directly the binding compiler from the ocmmand line (this last one
always worked).

   I'm working with maven 2.0.9 and JiBX 1.2.1.

   I've reported on the error previously at
http://www.mail-archive.com/jibx-users%40lists.sourceforge.net/msg03932.html

   It's being generated at BindingDirectory.getFactory(String bname,
String pack, ClassLoader loader), line 273

   "if (result instanceof IBindingFactory) {"

   "result" is loaded via a class loader initialized in
"org.jibx.binding.classes.ClassFile.setPaths(String[] paths)", line
2048:

   s_directLoader = new URLClassLoader(urls);

   This classloader's parent classloader is the system class loader.

   However IBindingFactory is loaded by RealmClassLoader which is part of
the Classworks clsas loading framework used by Maven.

   There are two fixes that in both cases should be considered according
to the use of the binding compiler. Both set the parent class loader to
the UrlClassLoader that loads the bindings:

   s_directLoader = new
URLClassLoader(urls,ClassFile.getClass().getClassLoader());

   or

   s_directLoader = new URLClassLoader(urls,
Thread.currentThread().getContextClassLoader());

  In both cases "result" which is the binding factory generated for the
precompiled project, is loaded via the parent class loaders which
s_directLoader will delegate to, thus, the "result instanceof
IBindingFactory" succeeds.

  I tested both solutions using the Maven JiBX plugin 1.2.1, Maven Antrun
plugin and invoking directly the compiler via the command line
successfully.

  Please, let me know if this solution is in the right direction and if a
patch is required, however it's just passing the parent class loader to
the UrlClassLoader as described above.

  Cheers,

  Karel



--
___
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users


[jibx-users] Precompiled binding problem with ant-run plugin

2009-03-30 Thread Karel Alfonso
Hi everyone again,

  Tyring to get a successful binding compilation referencing a precompiled
binding I decided to use the JiBX Ant tasks through the ant-run maven
plugin.

  Again, I ran into the same classloader conflict error, which makes me
think the problem is related to the way Maven and JiBXbinding compiler
load the classes that somehow end up loading IBindingFactory in
different classloaders.

  I could only run a successful binding compilation from the command line,
doing "java -cp ... orj.jibx.binding.Compile .."

  The maven JiBX plugin is very simple in its implementation and nothing
in it points to an improper handling of the classloaders. It's only the
combination of the Maven plugin execution and JiBX binding compilation
that generates the issue.

  Has anyone been able to use precompiled bindings using the maven JiBX
plugin?

  Thanks again,

Karel
> Hi everyone,
>
>   I'm working on a simple solution where I have two projects and one
> reuses classes already bound (precompiled) in the other project. I'm
> using JiBX version 1.2.1
>
>   Let's say I have a precompiled binding in projectA, projecta-binding.xml
>
>   
>   
>   
>   
>   
>
>   Then projectB defines a binding that requires using class A from
> projectA already compiled, projectb-binding.xml
>
>   
>  
>
>  
>
>  
>   
>
>   However when I do "mvn clean install" (using the 1.2.1 JiBX maven
> plugin) I get the following error:
>
>   "Classloader conflict for binding 'projecta_binding' - factory does not
> implement required interface"
>
>   The exception is thrown from BindingDirectory.getFactory() method. I've
> checked the binding factory generated by JiBX does implement
> IBindingFactory, so I'm assumming it is really a class loader issue but
> I'm not doing anything fancy, just a "mvn clean install".
>
>   I'd appreciate any help or advice regarding the use of precompiled
> binding as shown in this example.
>
>   Also, as a second suggestion, is it possible to include a precompiled
> binding doing  ? in that way
> other projects don't have to manually copy the precompiled binding
> definition to the project directory.
>
>   Thanks in advance,
>
>   Karel
>
> --
> ___
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>


--
___
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users


[jibx-users] Precompiled binding problem

2009-03-29 Thread Karel Alfonso
Hi everyone,

  I'm working on a simple solution where I have two projects and one
reuses classes already bound (precompiled) in the other project. I'm
using JiBX version 1.2.1

  Let's say I have a precompiled binding in projectA, projecta-binding.xml

  
  
  
  
  

  Then projectB defines a binding that requires using class A from
projectA already compiled, projectb-binding.xml

  
 

 
   
 
  

  However when I do "mvn clean install" (using the 1.2.1 JiBX maven
plugin) I get the following error:

  "Classloader conflict for binding 'projecta_binding' - factory does not
implement required interface"

  The exception is thrown from BindingDirectory.getFactory() method. I've
checked the binding factory generated by JiBX does implement
IBindingFactory, so I'm assumming it is really a class loader issue but
I'm not doing anything fancy, just a "mvn clean install".

  I'd appreciate any help or advice regarding the use of precompiled
binding as shown in this example.

  Also, as a second suggestion, is it possible to include a precompiled
binding doing  ? in that way
other projects don't have to manually copy the precompiled binding
definition to the project directory.

  Thanks in advance,

  Karel

--
___
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users