我在本地和用Windows服务器启动都是没问题的,
但是在Linux使用 java -jar启动jar包时
这个问题查了好久,看到有人说pom.xml某些东西版本过低,然后我升级了一下还是不行,也可能JDBC的pom配置
出了问题
com.mongodb.MongoSocketOhttps://img-mid.csdnimg.cn/release/static/image/mid/ask/648140388236182.png "=600 #left")
penException: Exception opening socket
at com.mongodb.connection.SocketStream.open(SocketStream.java:62) ~[mongo-java-driver-3.6.3.jar!/:na]
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:126) ~[mongo-java-driver-3.6.3.jar!/:na]
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:114) ~[mongo-java-driver-3.6.3.jar!/:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_144]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_144]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_144]
at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:59) ~[mongo-java-driver-3.6.3.jar!/:na]
at com.mongodb.connection.SocketStream.open(SocketStream.java:57) ~[mongo-java-driver-3.6.3.jar!/:na]
... 3 common frames omitted
2021-09-29 10:18:29.722 ERROR 27585 --- [ost-startStop-1] com.alibaba.druid.pool.DruidDataSource : init datasource error, url: jdbc:oracle:thin:@115.29.xxx.xxx:15522:ORCL (此为数据库地址,为避免一些不必要的麻烦就不打出来了)
java.sql.SQLException: The Network Adapter could not establish the connection
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) ~[ojdbc6-11.1.0.7.0.jar!/:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133) ~[ojdbc6-11.1.0.7.0.jar!/:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199) ~[ojdbc6-11.1.0.7.0.jar!/:Oracle JDBC Driver version -
我是用的ojdbc6
升级到ojdbc8编译直接
升级到8直接报这个错,改回来之后还是这个错,不过这个问题无伤大雅,现在就想知道上面的问题怎么解决?