JiBX
  1. JiBX
  2. JIBX-287

Error during generate binding for class from other jar (added as dependency)

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JiBX 1.1.6, JiBX 1.2.1
    • Fix Version/s: JiBX 1.2.2
    • Component/s: maven plugin
    • Labels:
      None
    • Environment:
      jdk 1.6_12, windows
    • Number of attachments :
      2

      Description

      I have two project: dsk-model and dsk-binding. In dsk-model is only one tested class. In dsk-binding is mapping file for it (have dependency to dsk-model).
      When I try compile dsk-binding then get error

      D:\Workspaces\maven\DSK\dsk-binding>set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_12\
      Scanning for projects...
      ------------------------------------------------------------------------
      Building dsk-binding
      task-segment: [clean, install]
      ------------------------------------------------------------------------
      [clean:clean]
      [resources:resources]
      Using default encoding to copy filtered resources.
      snapshot dsk:dsk-model:0.1-SNAPSHOT: checking for updates from snapshots-skg
      snapshot dsk:dsk-model:0.1-SNAPSHOT: checking for updates from snapshots-mirror-in-skg
      [compiler:compile]
      Nothing to compile - all classes are up to date
      [jibx:bind

      {execution: default}

      ]
      Running JiBX binding compiler (single-module mode) on 1 binding file(s)
      Running binding compiler version jibx_1_2_1
      binding Simple_binding:
      context (mp#=1) (cv#=0) (fm#=0)
      mapping class com.dsk.test.Simple to element Simple
      context (ns#=1) (cv#=0) (fm#=0)
      namespace http://rep.xmlstandards.eu/dsk/Simple.xsd (default elements)
      element wrapper Simple
      object binding for com.dsk.test.Simple create class com.dsk.test.Simple
      structure ordered
      element wrapper Header
      ------------------------------------------------------------------------
      [ERROR]BUILD ERROR
      ------------------------------------------------------------------------

          • Error during code generation for file 'D:\Workspaces\maven\DSK\dsk-binding\src\main\resources\bindings\Simple-binding.xml' - please enter a bug report for this error in Jira if the problem is not listed as fixed on the online status page ***

      ------------------------------------------------------------------------
      For more information, run Maven with the -e switch
      ------------------------------------------------------------------------
      Total time: 3 seconds
      Finished at: Tue Mar 31 21:23:07 CEST 2009
      Final Memory: 6M/12M
      ------------------------------------------------------------------------

      From other side when I move class from dsk-model to dsk-binding then all works fine.

        Activity

        Hide
        Dariusz Skrudlik added a comment -

        Ok, I found where is a problem.
        During binding processing you modify source of base class. This is reason why you must have it in this same project.

        But this is very bad information for me.

        I have domain object model which can't be modify. Now I must create a lot of value object for it

        Close this issue.

        Show
        Dariusz Skrudlik added a comment - Ok, I found where is a problem. During binding processing you modify source of base class. This is reason why you must have it in this same project. But this is very bad information for me. I have domain object model which can't be modify. Now I must create a lot of value object for it Close this issue.
        Hide
        Nigel Charman added a comment -

        Hi Dariusz

        I think you should be able to get around your problem without having to create value objects. JiBX creates a helper class (called the "munge" class) when dealing with unmodifiable classes.

        I don't know this part of JiBX too well, or how it works with the Maven plugin. You may want to raise your issue on the jibx-users group and see if someone can help.

        Show
        Nigel Charman added a comment - Hi Dariusz I think you should be able to get around your problem without having to create value objects. JiBX creates a helper class (called the "munge" class) when dealing with unmodifiable classes. I don't know this part of JiBX too well, or how it works with the Maven plugin. You may want to raise your issue on the jibx-users group and see if someone can help.
        Hide
        Dennis Sosnoski added a comment -

        You are able to use classes in bindings in some ways without being able to modify the class files, with some limitations (only public fields or methods, <mapping> definitions are not directly associated with classes so you can't case to IMarshallable or IUnmarshallable).

        Without seeing the details of your error I can't be sure what went wrong (and I'm not willing to go through the work of trying to figure out the maven usage to duplicate it), but I did find one problem which occurs when you're working with unmodifiable classes and the binding definition doesn't specify a package attribute. I've fixed this problem in the current code, and I'm now able to compile your class and put it in a jar, then compile the binding (which generated some JiBX binding classes in the default package) without error.

        Show
        Dennis Sosnoski added a comment - You are able to use classes in bindings in some ways without being able to modify the class files, with some limitations (only public fields or methods, <mapping> definitions are not directly associated with classes so you can't case to IMarshallable or IUnmarshallable). Without seeing the details of your error I can't be sure what went wrong (and I'm not willing to go through the work of trying to figure out the maven usage to duplicate it), but I did find one problem which occurs when you're working with unmodifiable classes and the binding definition doesn't specify a package attribute. I've fixed this problem in the current code, and I'm now able to compile your class and put it in a jar, then compile the binding (which generated some JiBX binding classes in the default package) without error.
        Dennis Sosnoski made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Fix Version/s JiBX 1.2.2 [ 15120 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Dennis Sosnoski [ dsosnoski ]
        Dennis Sosnoski made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Dariusz Skrudlik
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: