0

I recently installed the H2 database in Windows7. To start the H2 command line, I faced the following problem. There is already a process running on 8082 port. To resolve this I need to stop this process.

The Web Console server could not be started. Possible cause: another server is a
lready running at http://169.254.216.99:8082
Root cause: Exception opening port "8082" (port may be in use), cause: "java.net
.BindException: Address already in use: JVM_Bind" [90061-184]
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Exception opening port
"8082" (port may be in use), cause: "java.net.BindException: Address already in
use: JVM_Bind" [90061-184]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
    at org.h2.message.DbException.get(DbException.java:168)
    at org.h2.util.NetUtils.createServerSocketTry(NetUtils.java:194)
    at org.h2.util.NetUtils.createServerSocket(NetUtils.java:160)
    at org.h2.server.web.WebServer.start(WebServer.java:357)
    at org.h2.tools.Server.start(Server.java:474)
    at org.h2.tools.Console.runTool(Console.java:231)
    at org.h2.tools.Console.main(Console.java:99)
Caused by: java.net.BindException: Address already in use: JVM_Bind
    at java.net.DualStackPlainSocketImpl.bind0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)
    at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
    at java.net.PlainSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at org.h2.util.NetUtils.createServerSocketTry(NetUtils.java:190)
    ... 5 more
    Press any key to continue . . .

Now I checked which process is running on 8082 port.

netstat -a -n -o | find "8082"

 TCP    0.0.0.0:8082           0.0.0.0:0              LISTENING       4472
 TCP    [::]:8082              [::]:0                 LISTENING       4472

I find it that the javaw.exe process is running on port 8082.

tasklist

javaw.exe 4472

I found out few info about java/javaw/javaws from this link Java/Javaw/Javaws.

Now my question is if I closed the 'javaw.exe' process, will I face any further problem to run other applications/program ?

Or can I run the javaw.exe on different port or change H2 port (vice versa) ? How?

EDIT I know to kill the process -(in command line) Taskkill /PID 4472 /F

Community
  • 1
  • 1
royki
  • 1,593
  • 3
  • 25
  • 45

2 Answers2

1

javaw is a similar to java, but it does not shown the black ("DOS") window. You can use the process monitor to find out which process is it, but it can be just another H2 instance running...

In any case, if you want to run your H2 you should either

  • Kill the other process
  • Choose another port
David Rabinowitz
  • 29,904
  • 14
  • 93
  • 125
0

I assumed that you had H2 server start already (somehow), and the first server used the 8082 port. So when you try to start another H2 server, it noticed the port was already taken by the first H2 server.

You can check if H2 server already started or not by accessing http://localhost:8082/.

If you would like to change H2 port anyway, you can change it by editing a file called .h2.server.properties which is usually placed at C:\Users\[username] or C:\Documents and Settings\[username].

If you can't find the file .h2.server.properties there, you can create one at C:\Users\[username] by simply copying the code below.

#H2 Server Properties
#Wed Aug 01 16:26:15 JST 2018
0=Generic JNDI Data Source|javax.naming.InitialContext|java\:comp/env/jdbc/Test|sa
1=Generic Firebird Server|org.firebirdsql.jdbc.FBDriver|jdbc\:firebirdsql\:localhost\:c\:/temp/firebird/test|sysdba
10=Generic Derby (Server)|org.apache.derby.jdbc.ClientDriver|jdbc\:derby\://localhost\:1527/test;create\=true|sa
11=Generic Derby (Embedded)|org.apache.derby.jdbc.EmbeddedDriver|jdbc\:derby\:test;create\=true|sa
12=Generic H2 (Server)|org.h2.Driver|jdbc\:h2\:tcp\://localhost/~/test|sa
13=Generic H2 (Embedded)|org.h2.Driver|jdbc\:h2\:~/test|sa
2=Generic SQLite|org.sqlite.JDBC|jdbc\:sqlite\:test|sa
3=Generic DB2|COM.ibm.db2.jdbc.net.DB2Driver|jdbc\:db2\://localhost/test|
4=Generic Oracle|oracle.jdbc.driver.OracleDriver|jdbc\:oracle\:thin\:@localhost\:1521\:XE|sa
5=Generic MS SQL Server 2000|com.microsoft.jdbc.sqlserver.SQLServerDriver|jdbc\:microsoft\:sqlserver\://localhost\:1433;DatabaseName\=sqlexpress|sa
6=Generic MS SQL Server 2005|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc\:sqlserver\://localhost;DatabaseName\=test|sa
7=Generic PostgreSQL|org.postgresql.Driver|jdbc\:postgresql\:test|
8=Generic MySQL|com.mysql.jdbc.Driver|jdbc\:mysql\://localhost\:3306/test|
9=Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc\:hsqldb\:test;hsqldb.default_table_type\=cached|sa
webAllowOthers=true
webPort=8082
webSSL=false

If you would like to change H2 port, edit webPort=8082.

keito
  • 1
  • 2