I'm getting a NoSuchMethodError when I try to run derby under a J9 JVM. I
built derby from source, using the jsr169compile.classpath property, which I
believe means that the resulting derby.jar should be J2ME compliant.
However, when I run my little test app, I get an exception saying that the
method DirRandomAccessFile4.getChannel() is not found. Since this method
returns a java.nio.FileChannel, which is clearly not part of J2ME, it seems
that I must have somehow included non-J2ME stuff when I did the build (even
though I carefully followed the directions in BUILDING.txt). Can someone
tell me what I'm doing wrong?
It is my understanding that all I have to do to build J2ME is put
jsr169compile.classpath in my ant.properties file. So here is my
ant.properties file:
j14lib=d:/niagara/r3dev/tools/jdk14/jre/lib
j13lib=d:/niagara/r3dev/tools/jdk13/jre/lib
proceed=false
sane=false
jsr169compile.classpath=D:/niagara/r3dev/dist/x86-qnx-j9/ive/lib/jclMax/classes.zip
;D:/apps/java/jsr169/sun/sql.jar
and here is my test app, which fails on the ds.getConnection() call:
import java.io.*;
import java.sql.*;
import org.apache.derby.jdbc.EmbeddedSimpleDataSource;
public abstract class Foo
{
public static void main(String[] args) throws Exception
{
System.setProperty("derby.system.home", "/ffs0/derby");
EmbeddedSimpleDataSource ds = new EmbeddedSimpleDataSource();
ds.setDatabaseName("testDb");
ds.setCreateDatabase("create");
Connection conn = ds.getConnection();
System.out.println("OK!");
}
}
and here is the stack dump:
ERROR XBM01: Startup failed due to an exception. See next exception for
details.
at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)
at
org.apache.derby.iapi.services.monitor.Monitor.exceptionStartingModule(Unknown
Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
Source)
at
org.apache.derby.impl.services.monitor.BaseMonitor.createPersistentService(Unknown
Source)
at
org.apache.derby.iapi.services.monitor.Monitor.createPersistentService(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.createDatabase(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver169.getNewEmbedConnection(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.EmbeddedSimpleDataSource.getConnection(Unknown
Source)
at org.apache.derby.jdbc.EmbeddedSimpleDataSource.getConnection(Unknown
Source)
at Foo.main(Unknown Source)
============= begin nested exception, level (1) ===========
java.lang.NoSuchMethodError:
org/apache/derby/impl/io/DirRandomAccessFile4.getChannel()Ljava/nio/channels/FileChannel;
at org.apache.derby.impl.io.DirRandomAccessFile4.sync(Unknown Source)
at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB(Unknown
Source)
at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown
Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOnDB(Unknown
Source)
at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown
Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
Source)
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
Source)
at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
Source)
at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
Source)
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
Source)
at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
Source)
at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown
Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
Source)
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
Source)
at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
Source)
at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
Source)
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
Source)
at
org.apache.derby.impl.services.monitor.BaseMonitor.createPersistentService(Unknown
Source)
at
org.apache.derby.iapi.services.monitor.Monitor.createPersistentService(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.createDatabase(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver169.getNewEmbedConnection(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.EmbeddedSimpleDataSource.getConnection(Unknown
Source)
at org.apache.derby.jdbc.EmbeddedSimpleDataSource.getConnection(Unknown
Source)
at Foo.main(Unknown Source)
============= end nested exception, level (1) ===========
Thanks, Mike Jarmy