db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonas <jrom...@logic-factory.com>
Subject Re: java.lang.NoClassDefFoundError: java.math.BigDecimal
Date Wed, 27 Dec 2006 09:52:28 GMT
Rajesh Kartha <kartha02@...> writes:

> 
> Jonas wrote:
> 
> >Hello. 
> >I'm trying to use Derby 10.2.2 with IBM WSDD and it does not work for me.
> >I always get a 
> >java.lang.NoClassDefFoundError: java.math.BigDecimal
> >	at java.lang.Class.verifyImpl(Native Method)
> >	at java.lang.Class.verify(Class.java:253)
> >	at java.lang.Class.initialize(Class.java:315)
> >	at org.apache.derby.jdbc.Driver20.newEmbedResultSet(Driver20.java:149)
> >	at ....jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1197)
> >	at ..jdbc.EmbedStatement.execute(EmbedStatement.java:585)
> >	at ..jdbc.EmbedStatement.executeQuery(EmbedStatement.java:154)
> >	at com.lf.MiniBD.main(MiniBD.java:64)
> > 
> >when using a simple resultset like 
> >
> >   rs = stt.executeQuery("SELECT * FROM TEST");.
> >
> >
> >I use EmbeddedSimpleDataSource to obtain a jdbc Connection and can create and
> >insert data in a new database. However, when i use a resultset to query the
> >database, i get the BigDecimal error.
> >
> >
> >Thank you in advance.
> >
> >
> >
> >  
> >
> Hi Jonas,
> 
> Is it possible to reproduce this outside of WSDD ? Which JVM are you using ?
> 
> Under a simple scenario I could not reproduce this with 10.2.2 on IBM 
> 142 and IBM 15 JVMs.
> 
>             EmbeddedDataSource ds = new EmbeddedDataSource();
>             ds.setDatabaseName("testdb");
>             Connection conn=ds.getConnection();
>             Statement stmt=conn.createStatement();
>             ResultSet rs=stmt.executeQuery("select * from  testbigdecimal");
>             while(rs.next()){
>                 System.out.println("Row "+rs.getInt(1)+" 
> "+rs.getBigDecimal(2));
>             }}
> 
> The table columns in 'testbigdecimal' were: (intcol integer, decimalcol 
> decimal(12,7));
> 
> it returned the valid rows:
> Row 1 1234.5678902
> Row 2 2323.8727837
> 
> Not sure what could be wrong in your scenario (JVM ?, security policy ? 
> ).  In any case I would suggest
> if you are able to see  the issue consistently, do post the reproduction 
> test case with steps to the list.
> 
> -Rajesh
> 
> 



Hi Rajesh, 

I'm using  IBM  WSDD version 5.7.1
that ships with IBM J9 JDK, i think,  compatible with JDK1.3.
J9 has an implementation of this JVM for Microsoft Windows 2003 PDA.
The idea is to run java on this PDA and of course JDBC :)

Derby is compatible with JSR169, a jdbc optional package for microedition CDC/
Foundation Profile 1.0.
Using the EmbeddedSimpleDataSource from Derby i think i get JSR169 compatibility
but FP1.0 not comes with java.math.BigDecimal and derby seems it need it.

WSDD uses Eclipse as editor.
I create a new project for a CDC / JCL Foundation profile 1.0.
This add to te bootstrap classes the files 
classes.zip,locale.zip and charconv.zip located at 
.....\runtimes\win32\x86\foundation10\lib\jclFoundation10 that 
corresponds to the Foundation Profile.

In order to run the app, in the Eclipse Run configuration, 
i added the following arguments:
-jcl:foun10 -Dij.dataSource=org.apache.derby.jdbc.EmbeddedSimpleDataSource
-Xbootclasspath/a:"...\bootjdbc.jar"

I order to not use SMF (OSGi) from the ibm WSDD, i create a bootjdbc.jar that
includes the classes from jsr169.jar and database_enabler.jar needed to use JDBC.

I use EmbeddedSimpleDataSource (not EmbeddedDataSource)

	EmbeddedSimpleDataSource ds=new EmbeddedSimpleDataSource();
	ds.setUser("sa");
	ds.setPassword("");
	ds.setConnectionAttributes("create=true;");		
	ds.setDatabaseName("...../IBM/wsdd571/workspace/TestDB/bd/derby");
	Connection con = ds.getConnection();

Also i added the derby.jar (debug version) to the classpath.
and a Environment Variable JAVA_HOME that links to the
J9 installation directory (D:\...\IBM\DeviceDeveloper\wsdd5.0\ive-2.2)

Outside of WSDD, i use Eclipse, added a new J9 JDK and create a new project.
I get the same result: NoClassDefFoundError: java.math.BigDecimal.

I think Derby detects the JVM and if it's for microedition then it does not use
BigDecimal. but.. Do i need to use any arguments to the JVM?

Any idea?

Thank you in advance Rajesh.






Mime
View raw message