You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by Vincent Reviol <vi...@gmail.com> on 2006/11/01 10:38:16 UTC

JDK 1.3 and CharsetXMLWriter

Hello,

It seems that IBM's J2RE 1.3.1 class loader is able to load the
CharsetXMLWriter class although it imports java.nio.charset.Charset which is
not present. This leads to a NoClassDefFoundError at runtime when
marshalling an XML document.

To prevent this, the static block at line 101 in JMMarshallerImpl may be
changed to this:

static {
    Class c;
    try {
        Class.forName("java.nio.charset.Charset");
        c = CharSetXMLWriter.class;
    } catch (Exception e) {
        c = XMLWriterImpl.class;
    }
    xmlWriterClassDefault = c;
  }

I'm sorry, I can't send you a patch.

Thank you for your good work. JaxMe works great !

Re: JDK 1.3 and CharsetXMLWriter

Posted by Jochen Wiedmann <jo...@gmail.com>.
On 11/1/06, Vincent Reviol <vi...@gmail.com> wrote:

> NoClassDefFoundError is thrown on line 35 of CharsetXMLWriter (init method).
> But the following works:

Applied, thank you!


-- 
My wife Mary and I have been married for forty-seven years and not
once have we had an argument serious enough to consider divorce;
murder, yes, but divorce, never.
(Jack Benny)

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: JDK 1.3 and CharsetXMLWriter

Posted by Vincent Reviol <vi...@gmail.com>.
No sorry,

NoClassDefFoundError is thrown on line 35 of CharsetXMLWriter (init method).
But the following works:

static {
    Class c;
    try {
        Class.forName("java.nio.charset.Charset");
        c = Class.forName("org.apache.ws.jaxme.impl.CharSetXMLWriter");
    } catch (Exception e) {
        c = XMLWriterImpl.class;
    }
    xmlWriterClassDefault = c;
  }


2006/11/1, Jochen Wiedmann <jo...@gmail.com>:
>
> On 11/1/06, Vincent Reviol <vi...@gmail.com> wrote:
>
> > static {
> >     Class c;
> >     try {
> >         Class.forName("java.nio.charset.Charset");
> >         c = CharSetXMLWriter.class;
> >     } catch (Exception e) {
> >         c = XMLWriterImpl.class;
> >     }
> >     xmlWriterClassDefault = c;
> >   }
>
> I understand the issue. However, I am not happy with your suggestion,
> because
> it requires compilation of the CharSetXMLWriter class into the
> JMMarshallerImpl, which could lead to problems. Does the following
> work as well?
>
>   static {
>       Class c;
>       try {
>           c = Class.forName("org.apache.ws.jaxme.impl.CharSetXMLWriter");
>           c.newInstance();
>       } catch (Exception e) {
>           c = XMLWriterImpl.class;
>       }
>       xmlWriterClassDefault = c;
>   }
>
>
> Thanks,
>
> Jochen
>
> --
> My wife Mary and I have been married for forty-seven years and not
> once have we had an argument serious enough to consider divorce;
> murder, yes, but divorce, never.
> (Jack Benny)
>

Re: JDK 1.3 and CharsetXMLWriter

Posted by Jochen Wiedmann <jo...@gmail.com>.
On 11/1/06, Vincent Reviol <vi...@gmail.com> wrote:

> static {
>     Class c;
>     try {
>         Class.forName("java.nio.charset.Charset");
>         c = CharSetXMLWriter.class;
>     } catch (Exception e) {
>         c = XMLWriterImpl.class;
>     }
>     xmlWriterClassDefault = c;
>   }

I understand the issue. However, I am not happy with your suggestion, because
it requires compilation of the CharSetXMLWriter class into the
JMMarshallerImpl, which could lead to problems. Does the following
work as well?

  static {
      Class c;
      try {
          c = Class.forName("org.apache.ws.jaxme.impl.CharSetXMLWriter");
          c.newInstance();
      } catch (Exception e) {
          c = XMLWriterImpl.class;
      }
      xmlWriterClassDefault = c;
  }


Thanks,

Jochen

-- 
My wife Mary and I have been married for forty-seven years and not
once have we had an argument serious enough to consider divorce;
murder, yes, but divorce, never.
(Jack Benny)

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org