castor
  1. castor
  2. CASTOR-3214

org.exolab.castor.xml.MarshalException: The class for the root element could not be found.

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.2
    • Fix Version/s: None
    • Component/s: XML code generator
    • Labels:
    • Environment:
      Websphere 6, RAD
    • Number of attachments :
      0

      Description

      Hi, I am getting the following error when I try to unmarshal a xml. Used Xml code generator to generate the classes. All the jars are ver 1.2
      I followed another thread with a similar issue and it said ver 1.2.1 resolved it. But I do not see that version for downloading.

      Here's the code snippet

      XMLContext context = new XMLContext();
      String[] pckgs = new String[]

      {"com.abc","com.abc.def"}

      ;
      context.addPackages(pckgs);
      Unmarshaller unm = context.createUnmarshaller();
      InputStreamReader inpStrRdr = new InputStreamReader(new ByteArrayInputStream(outXML.getBytes()));
      XYZ clsxyz = (XYZ)unm.unmarshal(inpStrRdr);

      org.exolab.castor.xml.MarshalException: The class for the root element 'XYZ' could not be found.

      {File: [not available]; line: 2; column: 6}

      at org.exolab.castor.xml.Unmarshaller.convertSAXExceptionToMarshalException(Unmarshaller.java:761)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:727)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:616)

        Activity

        Hide
        Werner Guttmann added a comment -

        Well, we incremented version from 1.2 to 1.3. Can you please test against the current 1.3.3 RC1 build ?

        Show
        Werner Guttmann added a comment - Well, we incremented version from 1.2 to 1.3. Can you please test against the current 1.3.3 RC1 build ?
        Hide
        Pratik shah added a comment -

        Unfortunately, I cannot use ver 1.3 since we are using jdk 1.4. In fact, I generated my classes using ver 1.3 but used the property file to generate 1.4 compliant code. But, at runtime, I am using the 1.2 jars to avoid version mismatch errors.
        I have the .castr.cdr file in the packages but its still throwing the error.

        Show
        Pratik shah added a comment - Unfortunately, I cannot use ver 1.3 since we are using jdk 1.4. In fact, I generated my classes using ver 1.3 but used the property file to generate 1.4 compliant code. But, at runtime, I am using the 1.2 jars to avoid version mismatch errors. I have the .castr.cdr file in the packages but its still throwing the error.
        Hide
        Pratik shah added a comment -

        Ok, so env is jdk 1.4. I am using RAD7.5

        I generated all the classes again using Castor 1.2 jars. Automated conflict resolution set to true and also provided a binding file.

        Still get the same error when I try to unmarshal an xml. I have the .castor.cdr in both the packages.
        Here's how my packages look:

        1) com.abc - castor generated the .cdr file (cdrA) during generation
        2) com.abc.descriptors - I put the file here too.
        3) com.abc.types - a separate .cdr file was created (cdrB) during generation
        4) com.abc.types.descriptors - I put the file above, cdrB, at this location as well.

        I added all the 4 packages to the XmlContext.

        Hopefully this helps resolve my issue.

        Show
        Pratik shah added a comment - Ok, so env is jdk 1.4. I am using RAD7.5 I generated all the classes again using Castor 1.2 jars. Automated conflict resolution set to true and also provided a binding file. Still get the same error when I try to unmarshal an xml. I have the .castor.cdr in both the packages. Here's how my packages look: 1) com.abc - castor generated the .cdr file (cdrA) during generation 2) com.abc.descriptors - I put the file here too. 3) com.abc.types - a separate .cdr file was created (cdrB) during generation 4) com.abc.types.descriptors - I put the file above, cdrB, at this location as well. I added all the 4 packages to the XmlContext. Hopefully this helps resolve my issue.
        Hide
        Werner Guttmann added a comment -

        Unfortunately, I cannot use ver 1.3 since we are using jdk 1.4

        In that case you might want to consider taking up commercial support, as we have made up our mind some years ago to not support Java 1.4 anymore and to move Castor forward in terms of functionality and use of Java 5 specific features.

        Show
        Werner Guttmann added a comment - Unfortunately, I cannot use ver 1.3 since we are using jdk 1.4 In that case you might want to consider taking up commercial support, as we have made up our mind some years ago to not support Java 1.4 anymore and to move Castor forward in terms of functionality and use of Java 5 specific features.
        Hide
        Pratik shah added a comment -

        Thanks for the information.

        Show
        Pratik shah added a comment - Thanks for the information.

          People

          • Assignee:
            Unassigned
            Reporter:
            Pratik shah
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: