Suddenly having UnsupportedEncodingException GBK

One Star

Suddenly having UnsupportedEncodingException GBK

I am at my wits end with this. For no apparent reason, I can no longer use the "Guess Schema" button. My suspicion is that something has changed on my Windows XP machine and I have no idea what. I've googled like crazy to try to figure this out. When I click "Guess Schema", this is what I get:
2011-02-09 16:50:09,227 WARN org.talend.commons.ui.runtime.exception.ExceptionHandler - Exception in component tJavaFlex_1
java.io.UnsupportedEncodingException: GBK
at sun.nio.cs.StreamEncoder.forOutputStreamWriter(Unknown Source)
at java.io.OutputStreamWriter.<init>(Unknown Source)
at scratch.mock_job_for_guess_schema_0_1.Mock_job_for_Guess_schema.tJavaFlex_1Process(Mock_job_for_Guess_schema.java:610)
at scratch.mock_job_for_guess_schema_0_1.Mock_job_for_Guess_schema.runJobInTOS(Mock_job_for_Guess_schema.java:951)
at scratch.mock_job_for_guess_schema_0_1.Mock_job_for_Guess_schema.main(Mock_job_for_Guess_schema.java:735)
org.talend.designer.core.ui.editor.properties.controllers.GuessSchemaProcess$1: Exception in component tJavaFlex_1
java.io.UnsupportedEncodingException: GBK
at sun.nio.cs.StreamEncoder.forOutputStreamWriter(Unknown Source)
at java.io.OutputStreamWriter.<init>(Unknown Source)
at scratch.mock_job_for_guess_schema_0_1.Mock_job_for_Guess_schema.tJavaFlex_1Process(Mock_job_for_Guess_schema.java:610)
at scratch.mock_job_for_guess_schema_0_1.Mock_job_for_Guess_schema.runJobInTOS(Mock_job_for_Guess_schema.java:951)
at scratch.mock_job_for_guess_schema_0_1.Mock_job_for_Guess_schema.main(Mock_job_for_Guess_schema.java:735)
at org.talend.designer.core.ui.editor.properties.controllers.GuessSchemaProcess.run(Unknown Source)
at org.talend.designer.core.ui.editor.properties.controllers.GuessSchemaController.runShadowProcess(Unknown Source)
at org.talend.designer.core.ui.editor.properties.controllers.GuessSchemaController.access$1(Unknown Source)
at org.talend.designer.core.ui.editor.properties.controllers.GuessSchemaController$4$1.run(Unknown Source)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:173)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:388)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
at org.talend.designer.core.ui.editor.properties.controllers.GuessSchemaController.useMockJob(Unknown Source)
at org.talend.designer.core.ui.editor.properties.controllers.GuessSchemaController.createButtonCommand(Unknown Source)
at org.talend.designer.core.ui.editor.properties.controllers.GuessSchemaController.access$0(Unknown Source)
at org.talend.designer.core.ui.editor.properties.controllers.GuessSchemaController$1.widgetSelected(Unknown Source)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.talend.rcp.intro.Application.start(Unknown Source)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Does anyone have any idea what could be going on?
One Star

Re: Suddenly having UnsupportedEncodingException GBK

Sorry. I didn't give a whole lot of information. My main TOS is 4.2.0M2 but I've tried it with various TOS installations on my box and they are all acting the same.
Community Manager

Re: Suddenly having UnsupportedEncodingException GBK

Hi
What's the version of your JRE? Is there a charsets.jar in jre path\lib? To do: try to upgrade your jdk.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Suddenly having UnsupportedEncodingException GBK

I had 1.6 and 1.5 installed. I uninstalled them both and reinstalled only the latest 1.6 and I have the same behavior.
One Star

Re: Suddenly having UnsupportedEncodingException GBK

Also, I looked into what GBK encoding is (seems to be Chinese something or other) - and I have no idea why my system would be trying to use this particular encoding.
And I do not have a charsets.jar in my jre/lib directory.
Additionally - here is the cmd line that is being run for the guess schema:
2011-02-10 10:19:26,057 INFO org.talend.designer.core.runprocess.Processor - Command line: C:/Program Files/Java/jre6/bin/java.exe -Xms256M -Xmx1024M -cp C:/TOS/TOS-Win32-r53829-V4.2.0M2/lib/java/javacsv.jar;C:/TOS/TOS-Win32-r53829-V4.2.0M2/lib/java/mysql-connector-java-5.1.0-bin.jar;C:/TOS/TOS-Win32-r53829-V4.2.0M2/workspace/.Java/classes;C:/TOS/TOS-Win32-r53829-V4.2.0M2/lib/java; scratch.mock_job_for_guess_schema_0_1.Mock_job_for_Guess_schema --context=TEST %*
If I run this from the command line manually, I get the same error. I've tried this with other types of databases (Oracle) and still get the same error.
One more thing, these two warnings show up in the error log at the same time I try to guess schema. I do not know if they are related (I doubt they are since this happens in all my Talend versions):
2011-02-10 10:19:19,779 WARN org.talend.core.model.metadata.MappingFileLoader - In dbms id "hive_id" mapping file, Talend types below are not bind with "java" Db types :id_Long
id_String
id_Float
id_Character
id_byte[]
id_List
id_Date
id_BigDecimal
id_Boolean
id_Short
id_Object
id_Double
id_Integer
id_Byte
2011-02-10 10:19:19,700 WARN org.talend.core.model.metadata.MappingFileLoader - In dbms id "hive_id" mapping file, Db types below are not bind with "java" Talend types :TINYINT
DOUBLE
FLOAT
INT
BOOLEAN
BIGINT
STRING
SMALLINT
NUMBER
One Star

Re: Suddenly having UnsupportedEncodingException GBK

Update: Still not working. I've installed the JDK instead of just the JRE and it came with charsets.jar. I've pointed Talend at that JRE instead of the other one (and deleted the other one out of Talend's list of installed JREs). That didn't help.
I've installed the latest TOS 4.2.0M3 and created a new workspace with a new job just to test this problem out. That didn't help.
I've changed my Windows Locale settings to different languages with reboots with Talend attempts inbetween. That didn't help.
Changed the Windows locale back to English (US). That didn't help.
Getting really desperate and installed a registry cleaner. Cleaned that junk up. No help there.
I am just completely at a loss as to what has happened.
Seventeen Stars

Re: Suddenly having UnsupportedEncodingException GBK

hi all
you are talking about "guess schema" but what is into your javaflex ...??
2011-02-09 16:50:09,227 WARN  org.talend.commons.ui.runtime.exception.ExceptionHandler  - Exception in component tJavaFlex_1
java.io.UnsupportedEncodingException: GBK

laurent
One Star

Re: Suddenly having UnsupportedEncodingException GBK

My job doesn't have a javaflex. All it has is a:
Mysql --> LogRow
My assumption concerning the javaflex is that the "guess schema" uses Talend's own javaflex component to quickly build a little java class in order to figure out the schema. I was thinking that TOS builds this in the background and then consumes the output in order to display the schema window. I didn't actually look at the java file being generated by the "guess schema" button, however - so this was just a guess.
One Star

Re: Suddenly having UnsupportedEncodingException GBK

So, that got me to thinking and now I have looked at the code produced by the "guess schema" button. In that code are these lines:
String fileName = (new java.io.File(
"C:/TOS/TOS-Win32-r54685-V4.2.0M3/temp/TempGuessSchemaDelimitedFile.csv"))
.getAbsolutePath().replace("\\", "/");
com.csvreader.CsvWriter csvWriter = new com.csvreader.CsvWriter(
new java.io.BufferedWriter(
new java.io.OutputStreamWriter(
new java.io.FileOutputStream(fileName,
false), "GBK")), ';');

Note the "GBK" in there. That seems a little weird. Especially since earlier in the file there is a UTF-8 charset that is defined
private final static String utf8Charset = "UTF-8";

I am checking to see what some others TOS installations are producing with regards to this source...
One Star

Re: Suddenly having UnsupportedEncodingException GBK

Someone I work with tested this out and his generated "guess schema" file also says "GBK". Bummer. I was hoping for something different.
One Star

Re: Suddenly having UnsupportedEncodingException GBK

Any other suggestions? I've tried everything I can think of to no avail.
The interesting thing is that the guess schema button actually does create the csv file in the temp directory and it looks like TOS just has a problem reading that csv file.
One Star

Re: Suddenly having UnsupportedEncodingException GBK

Success!!!
So, I can't really explain what happened, but I completely uninstalled Java 1.6 (SDKs and JREs) from my machine and installed Java 1.5 instead on a whim. Strangely enough, this has fixed my issue. I don't understand it because I've been running Java 1.6 for months without 1.5 on my box. The Windows Support Team at my work did install some updates just the day before my issues, so maybe that was the catalyst that destroyed my life for a week. Anyway, "guess schema" works again and I look forward to spending the rest of eternity cradled in the warm and loving arms of Java 1.5, never again falling prey to the enchanting yet beguiling siren calls of Java 1.6.
One Star

Re: Suddenly having UnsupportedEncodingException GBK

You can actually resolve this without having to re-install anything.
Studio is an eclipse-based project and behaves the same as eclipse. Placing a jre directory under the root directory (wherever the executable you launch is located) for studio will force it to use that instance over any other jre installed on the machine.
For example, if my studio root is "C:\talend\", all I need to do is copy a jre directory underneath ("C:\talend\jre").
Where do you get the contents for a jre directory? If you have java installed, it may be under "C:\Program Files\Java\". On my machine, it's "C:\Program Files\Java\jre6". I copy everything under there to c:\talend\jre, relaunch, and voila.