You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Bob M <rg...@orcon.net.nz> on 2014/09/17 05:16:51 UTC

Derby Error message - explanation required

I have a java program which uses derby in embedded mode......................

Everything was working fine until my laptop had a meltdown and I have had to
go back to factory settings and reinstall software etc.

Everthing ( Derby database, tables etc.) is setup as before except that I
have added a User Name and Password to my derby database.

The error I am getting is as follows:-

DerbyApp starting in embedded mode
Loaded the appropriate driver
----- SQL Exception ------
SQL State: XJ040
Error Code: 40000
Message: Failed to start database'C:\...........' with class loader
com.dukascopy.dd2.greed.agent.compiler.c@2245f804, see the next exception
for details
----- SQL Exception ------
SQL State: XJ001
Error Code: 0
Message: Java exception:':java.lang.NullPointerException'.

Can anybody suggest what I have wrong in simple English :)

Thanks

Bob M





--
View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Re: Derby Error message - explanation required

Posted by Bob M <rg...@orcon.net.nz>.
Hi Dyre

Dukascopy is a Swiss Forex (foreign exchange) Broker
The platform I use is a java platform where I can place orders on the Swiss
Forex Market

I do not know about a 'bug'
As I said earlier, I had this all working prior to a laptop meltdown :(

Bob M



--
View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142217.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Re: Derby Error message - explanation required

Posted by Bob M <rg...@orcon.net.nz>.
Hi Knut

Thanks for your help................

With respect to my latest error (see new post) I have just spotted a
derby.log file in my Derby Database folder but I am unable to open it -
Access is denied.

I will try your pieces of code when I get some traction again :)

Bob M
Dunedin
New Zealand




--
View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142335.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Re: Derby Error message - explanation required

Posted by Knut Anders Hatlen <kn...@oracle.com>.
Bob M <rg...@orcon.net.nz> writes:

> Hi
>
> It seems that I do NEED to delete this temporary folder before each opening
> of the database
>
> As I am very unsure of derby coding would somebody care to suggest what I
> need to add and where to add it?

Hi Bob,

Since Derby fails because it is not able to access the tmp directory, I
think it's likely that your likely that your application will run into
the same problems when trying to delete it, so it might be better to see
if you can find out why it cannot be accessed and fix the underlying
problem.

I would first have checked the permissions of the tmp directory and the
database directory to see if there's something there that prevents the
application from accessing the directory.

I'm assuming that if you add the following to your application

  File f = new File("C:/Program Files/Derby Database/us_copiosus/tmp");
  System.out.println(f.list());

it will print null (since that's essentially what Derby does when it
gets the NPE). That doesn't tell us much about why the directory cannot
be accessed, though. Using NIO to access the directory might provide you
with an IOException that has more details. For example, you could add
this line and see if/how it fails:

  java.nio.file.Files.newDirectoryStream(f.toPath());

Hopefully, that will give you some clues.

-- 
Knut Anders

Re: Derby Error message - explanation required

Posted by Bob M <rg...@orcon.net.nz>.
Hi

It seems that I do NEED to delete this temporary folder before each opening
of the database

As I am very unsure of derby coding would somebody care to suggest what I
need to add and where to add it?

Relevant part of my coding is as follows:-
**********************************************
private class DerbyApp
{
private String framework = "embedded";
private String driver = "org.apache.derby.jdbc.EmbeddedDriver";
private String protocol = "jdbc:derby:";

void go(String[] args_derby)
{
parseArguments(args_derby);

myConsole.getOut().println("DerbyApp starting in " + framework + " mode");

loadDriver();

ArrayList statements = new ArrayList(); // list of Statements,
PreparedStatements
PreparedStatement psInsert = null;
PreparedStatement psUpdate = null;
PreparedStatement psDelete = null;
try
{
Properties props = new Properties(); // connection properties
props.put("user", "xxxx");
props.put("password", "yyyyyyyy");

String dbName = "C:/Program Files/Derby Database/us_copiosus"; // the name
of the database

conn = DriverManager.getConnection(protocol + dbName, props);
******************************************* 

Many thanks

Bob M
Dunedin, New Zealand



--
View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142283.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Re: Derby Error message - explanation required

Posted by Rick Hillegas <ri...@oracle.com>.
On 9/18/14 7:29 AM, Bob M wrote:
> Hi Rick and Knut
>
> Many thanks for your time and assistance :)
>
> By deleting the empty .tmp file we are in business again................
>
> Should I add any code to stop this happening in the future?
Hi Bob,

I don't have any clever advice. If this happened to one of my 
applications, I would brush off the first occurrence as a fluke. If it 
happened again, I would consider adding application startup logic to 
delete the tmp subdirectory before booting the database--now that you 
have shown that deleting the tmp subdirectory is safe.

Hope this helps,
-Rick
> Bob M
>
>
>
> --
> View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142238.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.
>


Re: Derby Error message - explanation required

Posted by Bob M <rg...@orcon.net.nz>.
Hi Rick and Knut

Many thanks for your time and assistance :)

By deleting the empty .tmp file we are in business again................

Should I add any code to stop this happening in the future?

Bob M



--
View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142238.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Re: Derby Error message - explanation required

Posted by Rick Hillegas <ri...@oracle.com>.
On 9/18/14 2:25 AM, Bob M wrote:
> Hi Knut
>
> Thanks for the advice..................
>
> My derby version is 10.11.1.1 though :)
>
> I shall come back after a trial run this evening
>
> In the meantime, a question
>
> Why is my derby.log to be found in C:\Downloads ?
Hi Bob,

By default, the diagnostic log is written to the current directory of 
your program, that is, the directory in which the JVM was booted. You 
can configure this by setting the derby.stream.error.file system 
property. For more information, please see 
http://db.apache.org/derby/docs/10.11/devguide/cdevdvlp25889.html

Hope this helps,
-Rick
> Bob M
>
>
>
> --
> View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142231.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.
>


Re: Derby Error message - explanation required

Posted by Bob M <rg...@orcon.net.nz>.
Hi Knut

Thanks for the advice..................

My derby version is 10.11.1.1 though :)

I shall come back after a trial run this evening

In the meantime, a question

Why is my derby.log to be found in C:\Downloads ?

Bob M



--
View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142231.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Re: Derby Error message - explanation required

Posted by Knut Anders Hatlen <kn...@oracle.com>.
Dyre Tjeldvoll <Dy...@oracle.com> writes:

> So, I have never heard about Dukascopy's Forex
> Platform before… what is that? 
>
> Based on the callstack you provided it looks like none of Derby’s
> heuristics for locating a tmp directory works on this platform.
> Arguably it is a bug that you get an NPE, but the alternative would
> have been something like “Unable to locate tmp dir”, I think.

The NPE is probably https://issues.apache.org/jira/browse/DERBY-6396,
which is fixed in Derby 10.10.2.0 and Derby 10.11.1.1. The underlying
issue is that the tmp directory of the database has become inaccessible
somehow.

Here's what I would try in order to make the database bootable again:

1. Take a copy of the database directory, so that you have a way to go
back if something goes wrong.

2. Manually delete the following directory:
      C:\Program Files\Derby Database\us_copiosus\tmp

3. Start your application.

Hopefully, this should be enough to get it going again. The code that
runs into the NPE, is trying to clear out temporary files from the
previous run. By manually deleting the tmp directory, you prevent that
code from running. The tmp directory will be recreated automatically
when the database is booted.

>
>
> On 17. sep. 2014, at 19:39, Bob M <rg...@orcon.net.nz> wrote:
>
>> Hi Rick
>> 
>> derby.log
>> <http://apache-database.10148.n7.nabble.com/file/n142209/derby.log>  
>> 
>> attempting to upload derby.log
>> 
>> Bob M
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142209.html
>> Sent from the Apache Derby Users mailing list archive at Nabble.com.

Re: Derby Error message - explanation required

Posted by Dyre Tjeldvoll <Dy...@oracle.com>.
So, I have never heard about Dukascopy's Forex
Platform before… what is that? 

Based on the callstack you provided it looks like none of Derby’s heuristics for locating a tmp directory works on this platform. Arguably it is a bug that you get an NPE, but the alternative would have been something like “Unable to locate tmp dir”, I think.


On 17. sep. 2014, at 19:39, Bob M <rg...@orcon.net.nz> wrote:

> Hi Rick
> 
> derby.log
> <http://apache-database.10148.n7.nabble.com/file/n142209/derby.log>  
> 
> attempting to upload derby.log
> 
> Bob M
> 
> 
> 
> --
> View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142209.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Derby Error message - explanation required

Posted by Bob M <rg...@orcon.net.nz>.
Hi Rick

derby.log
<http://apache-database.10148.n7.nabble.com/file/n142209/derby.log>  

attempting to upload derby.log

Bob M



--
View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142209.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Re: Derby Error message - explanation required

Posted by Bob M <rg...@orcon.net.nz>.
Hi Rick

Please explain in greater detail what I need to
do...........................

At the moment I am simply running my java application on Dukascopy's Forex
Platform
I do not know where or how to implement what you require

Sorry :(

Bob M



--
View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183p142207.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Re: Derby Error message - explanation required

Posted by Rick Hillegas <ri...@oracle.com>.
On 9/16/14 8:16 PM, Bob M wrote:
> I have a java program which uses derby in embedded mode......................
>
> Everything was working fine until my laptop had a meltdown and I have had to
> go back to factory settings and reinstall software etc.
>
> Everthing ( Derby database, tables etc.) is setup as before except that I
> have added a User Name and Password to my derby database.
>
> The error I am getting is as follows:-
>
> DerbyApp starting in embedded mode
> Loaded the appropriate driver
> ----- SQL Exception ------
> SQL State: XJ040
> Error Code: 40000
> Message: Failed to start database'C:\...........' with class loader
> com.dukascopy.dd2.greed.agent.compiler.c@2245f804, see the next exception
> for details
> ----- SQL Exception ------
> SQL State: XJ001
> Error Code: 0
> Message: Java exception:':java.lang.NullPointerException'.
>
> Can anybody suggest what I have wrong in simple English :)
Hi Bob,

Can you send us the complete stack trace of the error? Setting the 
following command line properties will dump plenty of diagnostics to 
derby.log:

-Dderby.language.logStatementText=true 
-Dderby.stream.error.logSeverityLevel=0

Thanks,
-Rick
> Thanks
>
> Bob M
>
>
>
>
>
> --
> View this message in context: http://apache-database.10148.n7.nabble.com/Derby-Error-message-explanation-required-tp142183.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.
>