請幫我解決這個錯誤,我是春天的新手。因此,當我嘗試在沒有 Spring MVC Web 結構的情況下運行測試數據源時,我無法理解此錯誤cd F:\NetBeansProjects\SpringContactApp; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_131" cmd /c "\"\"C:\\Program Files\\NetBeans 8.0.1\\java\\maven\\bin\\mvn.bat\" -Dexec.args=\"-classpath %classpath in.ezeon.capp.test.TestDataSource\" -Dexec.executable=java -Dexec.classpathScope=test -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.0.1\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\"" Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts. Scanning for projects... ------------------------------------------------------------------------ Building SpringContactApp 1.0-SNAPSHOT ------------------------------------------------------------------------ --- exec-maven-plugin:1.2.1:exec (default-cli) @ SpringContactApp --- Feb 04, 2019 12:15:40 PM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@531d72ca: startup date [Mon Feb 04 12:15:40 IST 2019]; root of context hierarchy Feb 04, 2019 12:15:40 PM org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor <init> INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring下面的代碼是 SpringRootConfig.java 類和 TestDataSource.java 類我使用的是 netbeans 8 和 spring 框架。
2 回答

呼喚遠方
TA貢獻1856條經驗 獲得超11個贊
在你的情況下:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
Could not create connection to database server. Attempted reconnect 3 times. Giving up.
檢查您的 jdbc 網址。
檢查您的數據庫的可用性(在該 url 上,服務器正在運行?端口?數據庫?理想情況下,相同的驅動程序,相同的網絡 ..eg 使用 Netbeans“服務”選項卡>“數據庫”)
檢查網絡/代理/防火墻,你在里面。
添加回答
舉報
0/150
提交
取消