java.net.BindException: Address already in use: JVM_Bind [duplicate] - eclipse

This question already has answers here:
java.net.BindException: Address already in use: JVM_Bind
(2 answers)
Closed 6 years ago.
i having this problem in eclipse
I m running a simple project and following error appears:
SEVERE: StandardServer.await: create[8005]:
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:373)
at org.apache.catalina.startup.Catalina.await(Catalina.java:647)
at org.apache.catalina.startup.Catalina.start(Catalina.java:607)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
after this a dialog box appears showing "Server Tomcat v6.0 Server at localhost failed to start." I have searched and tried all options answered here and nothing work for me. I also searched ports and change the tomcat port but nothing helps.? what should i do?
First i was getting the error "Several ports (8080, 8009) required by Tomcat v6.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s)."
after changing port,i am getting "Server Tomcat v6.0 Server at localhost failed to start" error..

The errormessage sounds very clear - that port (8005) is already in use. Are you running two instances of tomcat in parallel? Maybe one from command line and one from eclipse?

Issue is because of 8005 port is using by some other application.
so change the port number in eclipse by
Double click on Apache Tomcat Server in server tab and open the server in eclipse
expand port panel
change HTTP/1.1, tomcat admin port and AJP/1.3(check used port by typing netstat -an in cmd)
save it
try again

Related

Unable to connect to remote PostgresSQL server with JDBC driver

I'm trying to connect to a remote PostgreSQL database using JDBC, however the connection times out.
To be able to access the remote server I'm connected to a tunnel. There is no problem when I'm trying to connect from the same network with JDBC, only remotely.
I'm able to connect to the database both remotely and locally using other tools (e.g. pgAdmin, HeidiSQL, python sqlalchemy/psycopg2), but not with JDBC. I do not need to add other options for remote connection with the other tools, simply host:port and user/pass.
Searching for solutions I have tried the following without success:
add property "ssl" with value "true" to the driver connection
add property "sslfactory" with value "org.postgresql.ssl.NonValidatingFactory"
add property "loginTimeout" with value 20
set listen_addresses = '*' in postgresql.conf on remote server
add host all all 0.0.0.0/0 md5 to pg_hba.conf on remote server
Using driver version postgresql-42.2.14. I'm attempting to connect using SQuirreL and MATLAB.
As other tools have no issue connecting I'm guessing this is about tweaking the JDBC settings.
What am I missing here?
Edit:
Trying to ping the IP of the remote server (192.168.x.x.) I get:
Reply from 10.x.x.x: Destination net unreachable.
At the same time I'm able to connect to the database on the same server IP. Is this a clue to the problem?
Connection url:
jdbc:postgresql://192.168.x.x:5432/<dbname>
Results of Test-NetConnection
PS > Test-NetConnection 192.168.x.x
WARNING: Ping to 192.168.x.x failed with status:
DestinationNetworkUnreachable
PS > Test-NetConnection 192.168.x.x -port 5432
ComputerName : 192.168.x.x
RemoteAddress : 192.168.x.x
RemotePort : 5432
InterfaceAlias : Local Area Connection 3
SourceAddress : 192.168.x.x
TcpTestSucceeded : True
Running tracert 192.168.x.x
Tracing route to 192.168.x.x over a maximum of 30 hops
1 <1 ms <1 ms <1 ms 192.168.0.1
2 10.x.x.x reports: Destination net unreachable.
Trace complete.
Stacktrace (SQuirreL):
java.net.SocketTimeoutException: connect timed out
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.postgresql.core.PGStream.<init>(PGStream.java:81)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:93)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:197)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:217)
at org.postgresql.Driver.makeConnection(Driver.java:458)
at org.postgresql.Driver.connect(Driver.java:260)
at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:147)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:136)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.lambda$execute$0(OpenConnectionCommand.java:93)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
You are pinging IP address in the range of 192.168.x.x and getting reply from 10.x.x.x. Those are two different sub-nets.
As odd as it seems, it does not go well with your initial statement about being able to connect via other means. If network was issue then other tools would have failed as well. Not getting a reply for ping "Request time out" is expected result if there is blockage.
"Destination unreachable" means there is no proper route available to the IP you are trying to get to. With that issue, no other connections to that host should be reachable from your host.
Please confirm if all connections you attempted were from same client host. Also have you tried ODBC connector to see if that works? That allows System DSNs and you do not need to do much in attempt to connect.
Please make sure you do tests either from same hosts or two machines on same network to simplify things.
With "Destination unreachable" error your client should not be talking to server in anyway if same destination IP is used.

Unable to connect to "Compose for PostgreSQL" DB created in bluemix through eclipse

I am not able to establish connection to Compose for PostgreSQL DB service using eclipse. Getting below error while Testing the connection.
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:122)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:116)
at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3.Jdbc3Connection.(Jdbc3Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:369)
at org.postgresql.Driver.connect(Driver.java:245)
at org.eclipse.datatools.enablement.internal.postgresql.PostgreSQLJDBCConnection.createConnection(PostgreSQLJDBCConnection.java:87)
at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:105)
at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54)
at org.eclipse.datatools.enablement.internal.postgresql.PostgreSQLJDBCConnection.(PostgreSQLJDBCConnection.java:47)
at org.eclipse.datatools.enablement.internal.postgresql.PostgreSQLConnectionFactory.createConnection(PostgreSQLConnectionFactory.java:51)
at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359)
at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
I am able to connect to the DB through the application deployed in BlueMix.
How are you populating the connection credentials? The application will have access the VCAP_SERVICES when run on Bluemix, but unless you have specifically copied that environment variable to your Eclipse environment, that information will not be available to your application.
The error indicates that the connection was refused. This most likely means that the host and port combination you've entered is incorrect. You'll want to ensure that you can connect to the host.
You can check that your local system can connect by doing nc -vz xxxxx.dblayer.com 10000 where xxxxx.dblayer.com is the full hostname provided to you within the variable and 10000 is the port, also provided.
It seems as though your syntax/configuration may not be correct as a connection being refused would indicate that it cannot connect however it's not clear from your post what hostname/port it's actually trying to connect to.

Error while attempting to connect to an Oracle 12c database using eclipse

I am trying to connect to an oracle 12c database using the eclipse IDE but I get the error "Ping Failed!" every time I try to test the connection. I have tried to disable the windows firewall as some other similar post suggested it might be network related or the fire wall blocking it. I have the following settings:
SID: XE
Host: localhost
Port Number: 1521
UserName: myusername
Password: mypassword
connection URL: jdbc:oracle:thin:#localhost:1521:XE
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:743)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566)
at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.createConnection(JDBCConnection.java:328)
at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:105)
at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54)
at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:96)
at org.eclipse.datatools.enablement.internal.oracle.JDBCOracleConnectionFactory.createConnection(JDBCOracleConnectionFactory.java:27)
at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359)
at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:470)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:506)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:595)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:230)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1452)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:496)
... 13 more
Caused by: java.net.UnknownHostException: server
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source)
at java.net.InetAddress.getAddressesFromNameService(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:120)
at oracle.net.nt.ConnOption.connect(ConnOption.java:159)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:428)
... 18 more
Any ideas of what I am doing wrong?
Change your connection url to jdbc:oracle:thin:#server:1521:db. This will work.

Bluemix remote debugging session not starting

I have followed the Bluemix/Eclipse instructions to setup the Liberty servers in eclipse. Able to do everything with the Bluemix/eclipse tools except for remote debugging.
Receiving the following exceptions/errors when I select the "Enable Debug Mode" on my application under the servers.
Tried a longer Debug timeout but that has not helped. Any pointers?
TIA
[2015-11-30 07:16:56.832] bluemixMgmgClient - ???? [pool-1-thread-1]
.... ERROR --- ClientProxyImpl: Cannot create the websocket
connections for JavaMemcachedApp
com.ibm.ws.cloudoe.management.client.exception.ApplicationManagementException:
javax.websocket.DeploymentException: The HTTP request to initiate the
WebSocket connection failed at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl.onNewClientSocket(ClientProxyImpl.java:161)
at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl$RunServerTask.run(ClientProxyImpl.java:267)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown
Source) at java.util.concurrent.FutureTask.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
java.lang.Thread.run(Unknown Source) Caused by:
javax.websocket.DeploymentException: The HTTP request to initiate the
WebSocket connection failed at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:315)
at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl.onNewClientSocket(ClientProxyImpl.java:158)
... 7 more Caused by: java.util.concurrent.TimeoutException at
org.apache.tomcat.websocket.AsyncChannelWrapperSecure$WrapperFuture.get(AsyncChannelWrapperSecure.java:505)
at
org.apache.tomcat.websocket.WsWebSocketContainer.processResponse(WsWebSocketContainer.java:542)
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:296)
... 8 more [2015-11-30 07:17:56.868] bluemixMgmgClient - ????
[pool-1-thread-1] .... ERROR --- ClientProxyImpl: Cannot create the
websocket connections for JavaMemcachedApp
com.ibm.ws.cloudoe.management.client.exception.ApplicationManagementException:
javax.websocket.DeploymentException: The HTTP request to initiate the
WebSocket connection failed at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl.onNewClientSocket(ClientProxyImpl.java:161)
at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl$RunServerTask.run(ClientProxyImpl.java:267)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown
Source) at java.util.concurrent.FutureTask.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
java.lang.Thread.run(Unknown Source) Caused by:
javax.websocket.DeploymentException: The HTTP request to initiate the
WebSocket connection failed at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:315)
at
com.ibm.ws.cloudoe.management.client.impl.ClientProxyImpl.onNewClientSocket(ClientProxyImpl.java:158)
... 7 more Caused by: java.util.concurrent.TimeoutException at
org.apache.tomcat.websocket.AsyncChannelWrapperSecure$WrapperFuture.get(AsyncChannelWrapperSecure.java:505)
at
org.apache.tomcat.websocket.WsWebSocketContainer.processResponse(WsWebSocketContainer.java:542)
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:296)
... 8 more
You need to ensure that you've done the following:
Enabled & configured the debug App Management utility as indicated here (1).
Ensure that dev mode for Eclipse Tools is enabled as indicated here (2).
Enable Remote Debug in Eclipse Tools as indicate here (3).
(1) https://www.ng.bluemix.net/docs/manageapps/app_management.html#Utilities
(2) https://www.ng.bluemix.net/docs/manageapps/app_management.html#devmode
(3) https://www.ng.bluemix.net/docs/manageapps/eclipsetools/eclipsetools.html#remotedebug
Do you happens to be using IBM JDK to launch the workbench? There is an existing problem that we are tracking on the debug support using that combination. If you happens to be using that, can you try using an Orcale JDK 8 to see if that resolves the problem?
The issue was with the JDK in use .... replaced the ORACLE JDK 7 with ORACLE JRE 8 and that resolved the issue.
Regards
RS

Tomcat not running

For some reasons tomcat does not run. I've looked at various tutorials and (as usual) the solutions won't work, I've put the log output below. I have done a fresh install of tomcat as well as linking it to eclipse however when trying to start the service in eclipse this is the output before the server stops.
INFO: Server startup in 488 ms
08-Apr-2013 09:42:23 org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[8005]:
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:406)
at org.apache.catalina.startup.Catalina.await(Catalina.java:676)
at org.apache.catalina.startup.Catalina.start(Catalina.java:628)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
08-Apr-2013 09:42:23 org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
08-Apr-2013 09:42:24 org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
08-Apr-2013 09:42:24 org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
This exception tells you, that some other application is listening on the same port (8005).
The challenge for you is to find the other process that is using the port.
You don't specify what OS you use.
On Windows you could use netstat, under Linux you could give nmapa try to find the other process.
The issue can happen on Windows when nobody don't use port. Namely, Windows TCP engine sometime keep time-wait port for a long time. Solution is wait to Windows release the port or restart.
On Linux the Issue can happen only if there is other process. It can be found with lsof