This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 178598 - connecting to Java DB tries to start derby even if already running
Summary: connecting to Java DB tries to start derby even if already running
Status: REOPENED
Alias: None
Product: db
Classification: Unclassified
Component: Derby (show other bugs)
Version: 6.x
Hardware: Macintosh Mac OS X
: P4 normal with 1 vote (vote)
Assignee: Libor Fischmeistr
URL:
Keywords:
: 147510 178500 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-12-14 08:15 UTC by bbissett
Modified: 2016-03-16 20:04 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bbissett 2009-12-14 08:15:10 UTC
I've started GFv3 from the command line: asadmin start-domain --debug

...along with Java DB like this: asadmin start-database --dbhome <some_path>

In NetBeans, I have my Java DB properties set so that the Java DB Installation is <v3_home>/javadb and DatabaseLocation is the same path used above in the asadmin call. When I try to make a connection under Services->Databases NetBeans tries to start the db before connecting to it. Since it's already started, this just leads to errors. This is from the derby log:

--- begin ---
2009-12-10 19:26:20.773 GMT : Apache Derby Network Server - 10.5.3.0 - (802917) started and ready to accept connections on port 1527
2009-12-10 19:26:21.082 GMT Thread[DRDAConnThread_3,5,main] Cleanup action starting
java.sql.SQLException: Failed to start database 'MvnEE6Tester', see the next exception for details.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
[...]
	at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)
Caused by: java.sql.SQLException: Failed to start database 'MvnEE6Tester', see the next exception for details.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
	... 17 more
Caused by: java.sql.SQLException: Another instance of Derby may have already booted the database /Users/bobby/servers/derby_db/MvnEE6Tester.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	... 14 more
Caused by: ERROR XSDB6: Another instance of Derby may have already booted the database /Users/bobby/servers/derby_db/MvnEE6Tester.
	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
[...]	at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown Source)
	... 14 more

[etc]

Cleanup action completed
2009-12-10 19:26:21.105 GMT Thread[DRDAConnThread_3,5,main] (DATABASE = MvnEE6Tester), (DRDAID = {1}), Failed to start database 'MvnEE6Tester', see the next exception for details.
2009-12-10 19:26:21.105 GMT Thread[DRDAConnThread_3,5,main] (DATABASE = MvnEE6Tester), (DRDAID = {1}), Another instance of Derby may have already booted the database /Users/bobby/servers/derby_db/MvnEE6Tester.
---end---

From Petr:

--- begin ---
thanks for the report; this does not sound like a known issue. Auto-starting JavaDB is a "feature", i.e. the IDE expects that most of the time it is not started yet, so it starts it for you so you don't get a "can not connect" error. But of couse, it should correctly detect the cases when JavaDB is already started.
-- end ---
Comment 1 Antonin Nebuzelsky 2009-12-15 02:33:39 UTC
I cannot reproduce the reported behavior. Works for me correctly.

Jirko, evaluate the bug ASAP. Thanks.
Comment 2 Jiri Skrivanek 2009-12-15 04:35:34 UTC
What driver do you use? If "Java DB (Embedded)" then it allows just one connection in time. With "Java DB (Network)" driver I am not able to reproduce it.
Comment 3 bbissett 2009-12-15 08:41:13 UTC
Good thought on the driver; I should have included that info (it was Network driver).

With NB 6.8 RC1 and RC2 I was seeing the problem, but with the final release I do not. NetBeans is still starting a new derby_db process (the "server" according to the GUI), but this and the original process do not compete with each other, so there are no errors. I've also moved from GFv3_b74b to the final version, so maybe there was a change in derby.

I think it's still an issue that NB starts a new instance of the server, but it's only a confusing matter and not a high priority issue. For instance, after making the connection, there is an option in NB to stop the server, but this only stops the new NB-started instance. The db is still running after this and accepting connections.

This video shows the whole behavior:
http://mediacast.sun.com/users/bbissett/media/bug178598.swf

I would say it's still a bug that NB starts a new process, or maybe it's a bug that NB is calling it a "server" and is merely something to document to not confuse the user. Either way, it's not urgent, at least not with NB 6.8 final and GFv3 final. I'll try NB6.8 with GFv2.1 just to check.
Comment 4 bbissett 2009-12-15 09:22:06 UTC
With GFV2.1 I see the same behavior as I last reported. NB is starting up another instance of derby_db, but there are no errors. I don't know what the consequences are of having two instances running at the same time sharing the same db tables. It does seem like it shouldn't start this process -- maybe there should be a "refresh" button on the Java DB node like there is for servers. Or simply creating a connection does what it says and doesn't start any new processes.

Either way, I'd like to hear some confirmation that you're seeing a new instance started like I am. If that's a feature and not a bug, fine, but the bug as filed is that NB is trying to start derby when creating a connection and that's still what I'm seeing, even though it's not causing any errors.
Comment 5 Jiri Rechtacek 2009-12-16 02:21:34 UTC
*** Bug 178500 has been marked as a duplicate of this bug. ***
Comment 6 Jiri Skrivanek 2009-12-16 04:11:24 UTC
Yes, I can confirm a new instance is started if you connect from the IDE to a URL starting with jdbc:derby://localhost. It should check whether other instance is already running. It will be changed with issue 143588.
Comment 7 bbissett 2009-12-16 07:52:16 UTC
Should I reopen the issue then?
Comment 8 Jiri Skrivanek 2009-12-17 01:12:14 UTC
Up to you. We know about the problem.
Comment 9 bbissett 2009-12-17 08:14:36 UTC
Sure, I always like getting those emails about "the following bugs have been fixed in release X" emails. :)
I've dropped the priority on it since I don't believe it affects functionality that much. But obviously you can make it whatever priority you'd like.
Comment 10 bernd_zedv 2010-01-19 05:40:14 UTC
Problem with misleading message when starting a second Java DB Server:

1. asadmin start-database --dbhome <glassfish-path-to-db>

   Message: .... on 0.0.0.0 port 1527 ....

2. start NB 6.8
   * Java DB - Database Location: <netbeans-path-to-db>

3. NB 6.8 |Services| Databases | Java DB
   * rightclick "Start Server"

   Message: .... running on port 1527 .....

The second message is misleading and can produce a lot of confusion because NB 6.8 will not connect to the <netbeans-path-to-db> location but to the <glassfish-path-to-db> from step 1.

Trying to start a second Java DB server instance on the same port number should indicate that there is already a process listening on port 1527 and a new server could not be startet.

(I am not sure but think this was the behavior with former NB Releases)
Comment 11 matthias42 2016-03-16 20:04:12 UTC
*** Bug 147510 has been marked as a duplicate of this bug. ***