为什么mysql jdbc不能在我的maven项目中工作?

syqv5f0l  于 2021-06-18  发布在  Mysql
关注(0)|答案(0)|浏览(205)

jdbc在非maven项目中运行良好。当一个用户在填写注册表单后单击submit按钮时,所有的数据都存储在数据库中,但是当我在maven项目中使用jdbc时,它抛出以下命令error:-
无法连接到上的mysql服务器google:3,306.
请确保您尝试连接的计算机/端口上运行mysql服务器,并且运行此软件的计算机能够连接到此主机/端口(即未安装防火墙)。还要确保服务器没有使用--skip networking标志启动。
我已经在pom.xml文件中添加了所有必要的依赖项,但是我仍然不知道为什么会出现这个错误。
下面是pom.xmlfile:-

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <modelVersion>4.0.0</modelVersion>
  6. <packaging>war</packaging>
  7. <version>0.1.0-SNAPSHOT</version>
  8. <groupId>com.LIB</groupId>
  9. <artifactId>LiveInBliss</artifactId>
  10. <properties>
  11. <appengine.maven.plugin.version>1.3.2</appengine.maven.plugin.version>
  12. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  13. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  14. <maven.compiler.source>1.8</maven.compiler.source>
  15. <maven.compiler.target>1.8</maven.compiler.target>
  16. <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
  17. </properties>
  18. <dependencyManagement>
  19. <dependencies>
  20. <dependency>
  21. <groupId>com.google.cloud</groupId>
  22. <artifactId>google-cloud-bom</artifactId>
  23. <version>0.67.0-alpha</version>
  24. <type>pom</type>
  25. <scope>import</scope>
  26. </dependency>
  27. </dependencies>
  28. </dependencyManagement>
  29. <dependencies>
  30. <!-- Compile/runtime dependencies -->
  31. <dependency>
  32. <groupId>javax.servlet</groupId>
  33. <artifactId>javax.servlet-api</artifactId>
  34. <version>3.1.0</version>
  35. <scope>provided</scope>
  36. </dependency>
  37. <dependency>
  38. <groupId>javax.servlet.jsp</groupId>
  39. <artifactId>javax.servlet.jsp-api</artifactId>
  40. <version>2.3.1</version>
  41. <scope>provided</scope>
  42. </dependency>
  43. <dependency>
  44. <groupId>jstl</groupId>
  45. <artifactId>jstl</artifactId>
  46. <version>1.2</version>
  47. </dependency>
  48. <!-- Test Dependencies -->
  49. <dependency>
  50. <groupId>junit</groupId>
  51. <artifactId>junit</artifactId>
  52. <version>4.12</version>
  53. <scope>test</scope>
  54. </dependency>
  55. <!-- https://mvnrepository.com/artifact/javax.mail/mail -->
  56. <dependency>
  57. <groupId>javax.mail</groupId>
  58. <artifactId>mail</artifactId>
  59. <version>1.4.7</version>
  60. </dependency>
  61. <!-- https://mvnrepository.com/artifact/javax.activation/activation -->
  62. <dependency>
  63. <groupId>javax.activation</groupId>
  64. <artifactId>activation</artifactId>
  65. <version>1.1.1</version>
  66. </dependency>
  67. <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
  68. <dependency>
  69. <groupId>mysql</groupId>
  70. <artifactId>mysql-connector-java</artifactId>
  71. <version>8.0.13</version>
  72. </dependency>
  73. </dependencies>
  74. <build>
  75. <!-- for hot reload of the web application-->
  76. <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
  77. <plugins>
  78. <plugin>
  79. <groupId>org.codehaus.mojo</groupId>
  80. <artifactId>versions-maven-plugin</artifactId>
  81. <version>2.3</version>
  82. <executions>
  83. <execution>
  84. <phase>compile</phase>
  85. <goals>
  86. <goal>display-dependency-updates</goal>
  87. <goal>display-plugin-updates</goal>
  88. </goals>
  89. </execution>
  90. </executions>
  91. </plugin>
  92. <plugin>
  93. <groupId>org.eclipse.jetty</groupId>
  94. <artifactId>jetty-maven-plugin</artifactId>
  95. <version>9.4.12.v20180830</version>
  96. </plugin>
  97. <plugin>
  98. <groupId>com.google.cloud.tools</groupId>
  99. <artifactId>appengine-maven-plugin</artifactId>
  100. <version>${appengine.maven.plugin.version}</version>
  101. </plugin>
  102. <plugin>
  103. <groupId>com.google.appengine</groupId>
  104. <artifactId>appengine-maven-plugin</artifactId>
  105. <version>1.9.67</version>
  106. </plugin>
  107. </plugins>
  108. </build>
  109. </project>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题