我收到此错误:
Error connecting to server localhost on port 1'527 with message Connection refused
详细:
cannot Deploy TestGlassFish
deploy is failing=Error occurred during deployment: Exception while deploying the app [TestGlassFish] : Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.0.v20170811-d680af5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1'527 with message Connection refused: connect.
Error Code: 0. Please see server.log for more details.
我有:
将persistence.xml添加到META-INF文件夹中,我已经证明可以识别出该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="TestPersistence" transaction-type="RESOURCE_LOCAL">-->
<persistence-unit name="TestPersistence" transaction-type="JTA">
<!-- <persistence-unit name="TestPersistence">-->
<!-- <class>javax.persistence.EntityManager</class>-->
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/world?serverTimezone=UTC" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="xxx" />
</properties>
</persistence-unit>
</persistence>
为什么我的应用程序尝试连接到1527,我该如何解决呢?