lbehnke / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

gcj compile h2 database can not run. #148

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1.i have a class test.Test.java
package test;

import java.sql.Connection;
import java.sql.DriverManager;

public class Test {

    /**
     * @param args
     * @throws Exception 
     */
    public static void main(String[] args) throws Exception {
        Class.forName("org.h2.Driver");
        Connection connection = DriverManager.getConnection("jdbc:h2:~/test",
"sa", "");
        System.out.println(connection);
        connection.close();
    }

}

2.then compile it to test.exe with gcj , 
classpath:
org.eclipse.osgi_3.5.1.R35x_v20090827.jar;servlet-api-2.5.jar;lucene-core-2.9.1.
jar(not
support 3.0);slf4j-api-1.5.10.jar;slf4j-nop-1.5.10.jar

3.run test.exe at cmd window;

the expected output:
Exception in thread "main" java.lang.ExceptionInInitializerError
   at java.lang.Class.initializeClass(test.exe)
   at java.util.Currency.getInstance(test.exe)
   at java.text.DecimalFormatSymbols.<init>(test.exe)
   at java.text.DecimalFormatSymbols.getInstance(test.exe)
   at java.text.NumberFormat.computeInstance(test.exe)
   at java.text.NumberFormat.getNumberInstance(test.exe)
   at java.text.SimpleDateFormat.<init>(test.exe)
   at java.text.SimpleDateFormat.<init>(test.exe)
   at com.ibm.icu.text.SimpleDateFormat.<init>(test.exe)
   at org.h2.message.TraceSystem.<init>(test.exe)
   at org.h2.engine.Database.open(test.exe)
   at org.h2.engine.Database.openDatabase(test.exe)
   at org.h2.engine.Engine.openSession(test.exe)
   at org.h2.engine.Engine.openSession(test.exe)
   at org.h2.engine.Engine.getSession(test.exe)
   at org.h2.engine.SessionFactoryEmbedded.createSession(test.exe)
   at org.h2.engine.SessionRemote.connectEmbeddedOrServer(test.exe)
   at org.h2.jdbc.JdbcConnection.<init>(test.exe)
   at org.h2.jdbc.JdbcConnection.<init>(test.exe)
   at org.h2.Driver.connect(test.exe)
   at java.sql.DriverManager.getConnection(test.exe)
   at test.Test.main(test.exe)
Caused by: java.lang.NullPointerException
   at java.io.InputStreamReader.read(test.exe)
   at java.io.BufferedReader.fill(test.exe)
   at java.io.BufferedReader.readLine(test.exe)
   at java.util.Properties.load(test.exe)
   at java.util.Currency.<clinit>(test.exe)
   at java.lang.Class.initializeClass(test.exe)
   ...21 more

Environment:

h2 version : 1.2.125 (2009-12-06)
windows 7 
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)

I replace the 
java.text.SimpleDateFormat with com.ibm.icu.text.SimpleDateFormat;
java.text.Collator with com.ibm.icu.text.Collator
java.util.TimeZone with com.ibm.icu.util.TimeZone

then it's ok!

out put is : conn0: url=jdbc:h2:~/test user=SA

Original issue reported on code.google.com by haoks...@gmail.com on 9 Dec 2009 at 9:16

GoogleCodeExporter commented 9 years ago
Hi,

This sounds like a bug in gcj. java.text.SimpleDateFormat, java.text.Collator, 
and
java.util.TimeZone should be available.

I'm closing this bug.

Regards,
Thomas

Original comment by thomas.t...@gmail.com on 11 Dec 2009 at 5:31