日期:2014-05-16  浏览次数:20897 次

提示java.net.ConnectException: Connection refused,mysql和tomcat连接不上
点击右边红色标题查看本文完整版:提示java.net.ConnectException: Connection refused,mysql和tomcat连接不上。

? 请问这是什么错误?ps:mysql数据库已经启动了,并且用的是root帐号,没设密码,tomcat启动正常,可是两者一连接,就提示:
? javax.servlet.ServletException: javax.jdo.JDODataStoreException: Unable to connect:
? URL 'jdbc:mysql://192.168.1.1/digi_campus?useUnicode=true&characterEncoding=GBK':
? java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused: connect
?
? ** BEGIN NESTED EXCEPTION **
?
? java.net.ConnectException
? MESSAGE: Connection refused: connect
?
? STACKTRACE:
?
? java.net.ConnectException: Connection refused: connect
? at java.net.PlainSocketImpl.socketConnect(Native Method)
? at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
? at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
? at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
? at java.net.Socket.connect(Socket.java:452)
? at java.net.Socket.connect(Socket.java:402)
? at java.net.Socket.<init>(Socket.java:309)
? at java.net.Socket.<init>(Socket.java:124)
? at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:124)
? at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:225)
? at com.mysql.jdbc.Connection.createNewIO(Connection.java:1783)
? at com.mysql.jdbc.Connection.<init>(Connection.java:450)
? at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)
? at za.co.hemtech.jdo.server.jdbc.conn.JDBCConnectionPool.createRealCon(JDOGenie_3.0.3_:762)
? at za.co.hemtech.jdo.server.jdbc.conn.JDBCConnectionPool.createRealConWithRetry(JDOGenie_3.0.3_:199)
? at za.co.hemtech.jdo.server.jdbc.conn.JDBCConnectionPool.createPooledConnection(JDOGenie_3.0.3_:789)
? at za.co.hemtech.jdo.server.jdbc.conn.JDBCConnectionPool.check(JDOGenie_3.0.3_:180)
? at za.co.hemtech.jdo.server.jdbc.metadata.JdbcStore.check(JDOGenie_3.0.3_:206)
? at za.co.hemtech.jdo.server.jdbc.JdbcDataStore.check(JDOGenie_3.0.3_:193)
? at za.co.hemtech.jdo.server.JDOServerImp.checkDataStores(JDOGenie_3.0.3_:708)
? at za.co.hemtech.jdo.server.JDOServerImp.<init>(JDOGenie_3.0.3_:368)
? at za.co.hemtech.jdo.server.LocalPersistenceManagerFactoryImp.getPersistenceManagerFactory(JDOGenie_3.0.3_:38)
? at za.co.hemtech.jdo.client.BootstrapPMF.getPersistenceManagerFactory(JDOGenie_3.0.3_:35)
? at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
? at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
? at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
? at java.lang.reflect.Method.invoke(Method.java:324)
? at javax.jdo.JDOHelper.getPersistenceManagerFactory(Unknown Source)
? at javax.jdo.JDOHelper.getPersistenceManagerFactory(Unknown Source)
? at com.qiyee.util.jdo.JDOContext.initialize(JDOContext.java:57)
? at com.qiyee.util.jdo.JDOPlugIn.init(JDOPlugIn.java:103)
? at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:839)
? at org.apache.struts.action.ActionServlet.init(ActionServlet.java:332)
? at javax.servlet.GenericServlet.init(GenericServlet.java:211)
? at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1019)
? at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:687)
? at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:144)
? at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
? at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
? at org.apache.catalina.core.StandardContextValve.invokeInternal(Standa