Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法使用eclipselink配置与我的DDB的JPA连接_Java_Jpa_Eclipselink - Fatal编程技术网

Java 无法使用eclipselink配置与我的DDB的JPA连接

Java 无法使用eclipselink配置与我的DDB的JPA连接,java,jpa,eclipselink,Java,Jpa,Eclipselink,我曾使用JDBC测试我的项目,现在我生成了我的实体以使用JPA,但连接无法使用它: javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/test" javax.servlet.jsp.JspException: Un

我曾使用JDBC测试我的项目,现在我生成了我的实体以使用JPA,但连接无法使用它:

javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/test"
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/test"
my persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  <persistence-unit name="TestPU" transaction-type="JTA">
    <jta-data-source>java:app/jdbc/test</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="eclipselink.logging.level" value="FINEST"/>
    </properties>
  </persistence-unit>
</persistence>

java:app/jdbc/test
假的
我刚刚在我的web.xml中对此进行了评论:

<!-- <resource-ref>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.ConnectionPoolDataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> -->


我搜索了3个小时,知道吗?

我已经输入了C:\Program Files\glassfish-4.1.1\glassfish\lib\mysql-connector-java-5.1.40-bin.jar似乎是正确的位置完成了,它不起作用了,但无论如何谢谢我删除了连接,在新连接中添加了jar的路径,重新启动服务器等等。。但我记得我打开了一个jpa项目,它没有添加.jar,我想这只是我的配置,但我不知道该驱动程序可以作为依赖项打包到project war中。你可以检查一下这个项目是如何完成的。现在我们将驱动程序放在lib/ext folder中,这应该标记为glassfish,而不是JPA/EclipseLink,因为问题在于服务器和设置数据源。您正在连接到哪个数据库-在哪里定义了连接详细信息?