|
Home > Archive > SQL Anywhere for Linux > April 2005 > Re: NullPointerException with Java in DB on Linux accessing TimeZone info
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: NullPointerException with Java in DB on Linux accessing TimeZone info
|
|
| Reg Domaratzki \(iAnywhere Solutions\) 2005-04-05, 8:02 pm |
| Arthur, can you post the code for a sample Java class that shows the problem
and the SQL that is executed that causes the exception?
--
Reg Domaratzki, Sybase iAnywhere Solutions
Sybase Certified Professional - Sybase ASA Developer Version 8
Please reply only to the newsgroup
iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm
-> Choose SQL Anywhere Studio
-> Set "Platform Preview" and "Time Frame" to ALL
<Arthur Hefti> wrote in message news:41637ad6.1ec0.1681692777@sybase.com...
> Hi
> We're running a Java application in the database. As soon as
> our application tries to access time information it
> generates a NullPointerException
. Running the same DB on
> Windows works fine.
> Error: NullPointerException
> at java.util.TimeZone.getTimeZone( TimeZone.java:342)
>
> Versions:
> Linux Kernel:2.4.24
> glibc:2.3.2
> ASA: 9.0.1.1902
> We're running a debian based Linux (Linspire/Lindows)
>
> Any suggestions?
> Arthur
| |
| Arthur Hefti 2005-04-05, 8:02 pm |
| As soon as you try to access date information:
new Date().toString()
or
Calendar cal = Calendar.getInstance(new Locale("de", "ch"));
The 2nd statement gives the following error trace:
java.lang. NullPointerException
at java.util.TimeZone. getTimeZone(TimeZone
.java:342)
at java.util.TimeZone.getDefault(TimeZone.java:424)
at java.util.TimeZoneData.<clinit>(TimeZone.java:1997)
at java.util.TimeZoneData.<clinit>(TimeZone.java:630)
at java.util.TimeZone. getTimeZone(TimeZone
.java:340)
at java.util.TimeZone.getDefault(TimeZone.java:424)
at java.util.GregorianCalendar.<init>(GregorianCalendar.java:335)
at java.util.SimpleTimeZone.<clinit>(SimpleTimeZone.java:913)
at java.util.SimpleTimeZone.<clinit>(SimpleTimeZone.java:911)
at java.util.TimeZone.<clinit>(TimeZone.java:488)
at java.util.TimeZone.<clinit>(TimeZone.java:119)
at java.util.Calendar. getInstance(Calendar
.java:822)
Tested also on Suse with the following version numbers:
- SUSE Linux 9 (and others)
- Kernel: 2.4.2.1
- glibc: 2.3.2
- ASA 9.0.1 and 9.0.1 EBF 1902
Regards
Arthur
"Reg Domaratzki (iAnywhere Solutions)" < Spam_bad_rdomarat@ia
nywhere.com>
wrote in message news:41751ad5$1@foru
ms-1-dub...
> Arthur, can you post the code for a sample Java class that shows the
> problem
> and the SQL that is executed that causes the exception?
>
> --
> Reg Domaratzki, Sybase iAnywhere Solutions
> Sybase Certified Professional - Sybase ASA Developer Version 8
> Please reply only to the newsgroup
>
> iAnywhere Developer Community : http://www.ianywhere.com/developer
> iAnywhere Documentation :
> http://www.ianywhere.com/developer/product_manuals
> ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm
> -> Choose SQL Anywhere Studio
> -> Set "Platform Preview" and "Time Frame" to ALL
>
> <Arthur Hefti> wrote in message
> news:41637ad6.1ec0.1681692777@sybase.com...
>
>
| |
| Reg Domaratzki \(iAnywhere Solutions\) 2005-04-05, 8:03 pm |
| Arthur, I was able to load and execute the following simple classes using
ASA v901.1944 on a half dozen Linux and Solaris systems in our lab, so I
don't think it's a simple as just accessing data information.
TimeZoneTest.java
==============
import java.util.*;
public class TimeZoneTest {
public static String getCurDate() {
Date d1 = new Date();
return(d1.toString());
}
public static String doCalendar() {
Calendar cal = Calendar.getInstance(new Locale("de", "ch"));
return("Did The Engine GPF?");
}
}
Commands run against ASA database
====================
=======
install java new from file 'TimeZoneTest.class';
CREATE FUNCTION MyJavaDate()
RETURNS CHAR(255)
EXTERNAL NAME 'TimeZoneTest.getCurDate ()Ljava/lang/String;'
LANGUAGE JAVA;
CREATE FUNCTION MyJavaCal()
RETURNS CHAR(255)
EXTERNAL NAME 'TimeZoneTest.doCalendar ()Ljava/lang/String;'
LANGUAGE JAVA;
select MyJavaDate(), MyJavaCal();
No NullPointerException
is thrown, and the results set from my SQL query
contains the expected information. Does the class above give a
NullPointerException
on your system?
--
Reg Domaratzki, Sybase iAnywhere Solutions
Sybase Certified Professional - Sybase ASA Developer Version 8
Please reply only to the newsgroup
iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm
-> Choose SQL Anywhere Studio
-> Set "Platform Preview" and "Time Frame" to ALL
"Arthur Hefti" <-> wrote in message news:417cb62a@forums
-1-dub...
> As soon as you try to access date information:
>
> new Date().toString()
> or
> Calendar cal = Calendar.getInstance(new Locale("de", "ch"));
>
> The 2nd statement gives the following error trace:
> java.lang. NullPointerException
> at java.util.TimeZone. getTimeZone(TimeZone
.java:342)
> at java.util.TimeZone.getDefault(TimeZone.java:424)
> at java.util.TimeZoneData.<clinit>(TimeZone.java:1997)
> at java.util.TimeZoneData.<clinit>(TimeZone.java:630)
> at java.util.TimeZone. getTimeZone(TimeZone
.java:340)
> at java.util.TimeZone.getDefault(TimeZone.java:424)
> at java.util.GregorianCalendar.<init>(GregorianCalendar.java:335)
> at java.util.SimpleTimeZone.<clinit>(SimpleTimeZone.java:913)
> at java.util.SimpleTimeZone.<clinit>(SimpleTimeZone.java:911)
> at java.util.TimeZone.<clinit>(TimeZone.java:488)
> at java.util.TimeZone.<clinit>(TimeZone.java:119)
> at java.util.Calendar. getInstance(Calendar
.java:822)
>
> Tested also on Suse with the following version numbers:
> - SUSE Linux 9 (and others)
> - Kernel: 2.4.2.1
> - glibc: 2.3.2
> - ASA 9.0.1 and 9.0.1 EBF 1902
>
> Regards
> Arthur
>
> "Reg Domaratzki (iAnywhere Solutions)" < Spam_bad_rdomarat@ia
nywhere.com>
> wrote in message news:41751ad5$1@foru
ms-1-dub...
>
>
| |
| Arthur Hefti 2005-04-05, 8:03 pm |
| We compiled your class and put it into a DB (The DB was
created on the Linux Syste). It crashes on 2 different Linux
systems and runs on Windows
I send you the DB and our Java class to your email account.
Regards
Arthur
> Arthur, I was able to load and execute the following
> simple classes using ASA v901.1944 on a half dozen Linux
> and Solaris systems in our lab, so I don't think it's a
> simple as just accessing data information.
>
>
> TimeZoneTest.java
> ==============
>
> import java.util.*;
>
> public class TimeZoneTest {
> public static String getCurDate() {
> Date d1 = new Date();
> return(d1.toString());
> }
> public static String doCalendar() {
> Calendar cal = Calendar.getInstance(new
> Locale("de", "ch"));
> return("Did The Engine GPF?");
> }
> }
>
>
>
> Commands run against ASA database
> ====================
=======
>
> install java new from file 'TimeZoneTest.class';
>
> CREATE FUNCTION MyJavaDate()
> RETURNS CHAR(255)
> EXTERNAL NAME 'TimeZoneTest.getCurDate ()Ljava/lang/String
> ;' LANGUAGE JAVA;
>
> CREATE FUNCTION MyJavaCal()
> RETURNS CHAR(255)
> EXTERNAL NAME 'TimeZoneTest.doCalendar ()Ljava/lang/String
> ;' LANGUAGE JAVA;
>
> select MyJavaDate(), MyJavaCal();
>
> No NullPointerException
is thrown, and the results set
> from my SQL query contains the expected information. Does
> the class above give a NullPointerException
on your
> system?
>
> --
> Reg Domaratzki, Sybase iAnywhere Solutions
> Sybase Certified Professional - Sybase ASA Developer
> Version 8 Please reply only to the newsgroup
>
> iAnywhere Developer Community :
> http://www.ianywhere.com/developer iAnywhere Documentation
> : http://www.ianywhere.com/developer/product_manuals ASA
> Patches and EBFs :
> http://downloads.sybase.com/swx/sdmain.stm
> -> Choose SQL Anywhere Studio
> -> Set "Platform Preview" and "Time Frame" to ALL
>
> "Arthur Hefti" <-> wrote in message
> access date information: >
> "ch")); >
> java.util.GregorianCalendar.<init>(GregorianCalendar.java:
> java.util.SimpleTimeZone.<clinit>(SimpleTimeZone.java:913)
> at
> java.util.SimpleTimeZone.<clinit>(SimpleTimeZone.java:911)
> java.util.Calendar. getInstance(Calendar
.java:822) >
> Patches and EBFs :
>
>
|
|
|
|
|