[Could not load class: sun.io.CharToByteutf-8]

Hi!
I got the following stack trace while trying to insert an instance of TXMLObject into TXMLObjectAccessor.

Nested Exception (java.io.UnsupportedEncodingException) stacktrace:

java.io.UnsupportedEncodingException: utf-8 [Could not load class: sun.io.CharToByteutf-8]
at sun/io/CharToByteConverter.getConverter (CharToByteConverter.java)
at java/io/OutputStreamWriter. (OutputStreamWriter.java)
at com/softwareag/tamino/db/api/io/TOutputStreamWriter.
at com/softwareag/tamino/db/api/invocation/http/THTTPInvocationRequestWriter.initialize
at com/softwareag/tamino/db/api/invocation/http/THTTPInvocationRequestWriter.setConnection
at com/softwareag/tamino/db/api/invocation/http/THTTPInvocation.doInvoke
at com/softwareag/tamino/db/api/invocation/TAbstractInvocation.doTemplateInvoke
at com/softwareag/tamino/db/api/invocation/TAbstractInvocation.invoke
at com/softwareag/tamino/db/api/invocation/TAbstractInvocation.invoke
at com/softwareag/tamino/db/api/accessor/TStreamAccessorImpl.process
at com/softwareag/tamino/db/api/accessor/TStreamAccessorImpl.insert
at com/softwareag/tamino/db/api/accessor/TXMLObjectAccessorImpl.insert

I noticed that there is no such method called sun.io.CharToByteutf-8 in my sun.io package.

Any ideas to solve this problem?

Thanks in advance!

Hello,

which JDK were you using when this error occurred, and what did the XML document look like?

Cheers,
Trevor.

Thanks for your reply.
The compiler is Micorsoft Visual J++ with service pack5, and rt.jar from jdk1.3.1_06 in my CLASSPATH.
The XML doc is like this:
<?xml version="1.0" encoding="utf-8" ?>


John’s ECs

Flip-flop


Smith Components Inc.

3.00
2.60
16-bit flip-flop



John’s ECs

4.25
16-bit flip-flop








The code:
TXMLObject xmlObject = TXMLObject.newInstance( TDOMObjectModel.getInstance() );
String url=“http://localhost/components.xml”;
InputStream fin = url.openStream();
xmlObject.readFrom( fin );
TConnection connection = TConnectionFactory.getInstance().newConnection( DATABASE_URI );
TXMLObjectAccessor accessor = connection.newXMLObjectAccessor( TAccessLocation.newInstance( “ino:etc” ), TDOMObjectModel.getInstance() );
accessor.insert( xmlObject );

Your help is very appreciated!

Hello,

could this be a VJ++ problem? I tried your code with both JDK 1.3.1_04 and 1.4.1_01 and the document inserted (into Tamino 3.1.2.1, using the 3.1.2.4 API from the Community) correctly.

I made a minor modification to the code:

   TXMLObject xmlObject = TXMLObject.newInstance( TDOMObjectModel.getInstance() );
   // Create a URL
   URL url = new URL("http://localhost/components.xml");
   InputStream fin = url.openStream();
   xmlObject.readFrom( fin );
   TConnection connection = TConnectionFactory.getInstance().newConnection( "http://localhost/tamino/test" );
   TXMLObjectAccessor accessor = connection.newXMLObjectAccessor( TAccessLocation.newInstance( "ino:etc" ), 
                                                                  TDOMObjectModel.getInstance() );

   // tamino response object
   TResponse response = accessor.insert( xmlObject ); 



(I also chopped the end off the document, but the encoding is still “utf-8”.)

I hope that helps,
Trevor.

Without going into details. I’m fairly sure that this is a J++ problem. As far as I remember J++ is based on JDK 115 or 116. This is to old for the Tamino API4J. We require JDK 131 and naturally some required classes are missing in J++.