问题
I am trying to start an application on Glassfish 4 server but it gives me some strange exception:
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
Could it be because I don't have SQL? I am not sure how to fix it.
回答1:
You need to start the Derby Network Server, and have it listen on port 1527 on localhost (which is the default setting for the Derby Network Server, so no special configuration is required to achieve that host and port).
You can find the instructions for starting the Derby Network Server here: http://db.apache.org/derby/docs/10.11/adminguide/tadmincbdjhhfd.html
If you are just getting started with Derby, you can learn more here: http://db.apache.org/derby/docs/10.11/getstart/
来源:https://stackoverflow.com/questions/31572123/derby-java-sql-exception