• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC throws exception on java app detach from console  RSS feed

 
Stas Nikso
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

Having this issue I'm breaking my head on, I'd like to post it here in hope someone knows a solution:

I'm trying to run a Java application as daemon, by detaching it from the console with nohup and & like this:

nohup java -jar app.jar &

The app throws the following JDBC exception almost immediately after launch:
java.sql.SQLException: java.lang.ThreadDeath
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:430)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)

It worth saying that I also have
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at java.lang.UNIXProcess.waitFor(UNIXProcess.java:165)

When trying to launch an external tool from the app, so this might be related.

I must run it console-less in order to run a watchdog daemon over the app.

Any idea what's going on - really need to solve this one.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66304
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"SyRenity Now",please check your private messages for an important administrative matter.
 
Tim Holloway
Saloon Keeper
Posts: 18789
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Stas!

I can't deduce anything from the limited info available, but the concept itself works. My best guess is that something has decided to shut down the app while it's busy trying to connect to the database server. Does it work OK when you run it without the nohup/&?
 
Stas Nikso
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I solved the issue, eventually it was the most strangest thing:

My app used Enter to quit - apparently the command launching Enter got passed to it as well, and it exited early with the error messages.

Now, I have another issue, when the app exists after some time with the "killed" message.

Any idea what it is?

Thanks in advance.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!