4

I've upgraded my ServiceMix to Fuse ESB 4.4 compilation. I got, however, errors from logging system, which I can't find how to handle.

The error message is:

Warning: encoding "UTF-8" not supported, using UTF-8

The encoding UTF-8 is NOT used. Files are encoded in Windows-1250 encoding (characters from that set are correctly converted, others are, of course, not available).

I've found discussion about similar problem here on StackOverflow, where there was identified a problem with Xerces parser, however without a clue, how to solve it in this particular case. Had anyone dealt successfully with it?

рüффп
  • 4,475
  • 34
  • 62
  • 99
Danubian Sailor
  • 21,505
  • 37
  • 137
  • 211

1 Answers1

8

The problem is that something is attempting to access the UTF-8 character set (probably via Charset.forName("UTF-8")) which is attempting to instantiate a class in a package sun.nio.cs.UTF_8.

Although this will exist in the runtime of a JVM with no class loader constraints, in an OSGi runtime the code will fail.

The solution will be to modify the bundle that's generating this error message with the following:

Import-Package: ...,sun.nio.cs;resolution:=optional

That means that should it attempt to instantiate a class in that package, it should be able to find it - however, if it's not present (say, because you are using a different runtime) then it will still work.

Note that this implies the System.bundle is exporting the sun.nio.cs package, which you can do by generating a Fragment (see http://wiki.osgi.org/wiki/Fragment) or by having the system bundle export the sun.nio.cs package with the org.osgi.framework.system.packages property.

Either way, it sounds like something that the logging bundle should fix rather than something you'd need to fix - have you reported the bug upstream?

AlBlue
  • 20,872
  • 14
  • 63
  • 85
  • Shouldn't sun.nio.cs be used as internal package and be not exported by OSGi? I'm using logging system which is part of Fuse ESB itself. The problem may be the change of JRE to 1.6 in Fuse ESB 4.4. – Danubian Sailor Sep 28 '11 at 11:14
  • That's the problem, it's an internal package of the JRE. However, the only packages that OSGi exposes to bundles are those in the java.* namespace, so any JRE-specific classes aren't available to bundles in the runtime. That's why your logging class can't find it, and ultimately why you get this error message. – AlBlue Sep 28 '11 at 11:53