Glassfish 5.1.0 error when adding resources from web console

时光毁灭记忆、已成空白 提交于 2021-01-29 13:26:12

问题


Glassfish server up and running. I want to add some data source, and do it from web console->Resources.

Click button "Add Resources" then choose file from my computer (same to the file from server) and click OK. GUI gives me error:

An error has occurred The system cannot find the path specified:

In log I get:

[2019-11-20T12:26:23.149+0300] [glassfish 5.1] [INFO] [] [org.glassfish.admingui] [tid: _ThreadID=69 _ThreadName=admin-listener(3)] [timeMillis: 1574241983149] [levelValue: 800] [[ GUI deployment: uploadToTempfile]]

[2019-11-20T12:26:23.165+0300] [glassfish 5.1] [SEVERE] [] [org.glassfish.admingui] [tid: _ThreadID=69 _ThreadName=admin-listener(3)] [timeMillis: 1574241983165] [levelValue: 1000] [[ RestResponse.getResponse() gives FAILURE. endpoint = 'https://localhost:4848/management/domain/resources/add-resources'; attrs = '{id=, target=mdmcluster}']]

Please, give any ideas how to fix this issue.


回答1:


The correct format for the glassfish-resources.xml file is outlined in the Glassfish Application Deployment Guide page 191. It can be downloaded here: https://javaee.github.io/glassfish/doc/5.0/application-deployment-guide.pdf

Here is an example for defining a JDBC connection pool:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>

    <!-- Connects to MySql database called 'test' on a server called 'database' -->
    <jdbc-connection-pool name="jdbc/testConnPool"
                          res-type="javax.sql.DataSource"
                          datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
                          pool-resize-quantity="2"
                          max-pool-size="32"
                          steady-pool-size="8">
        <property name="URL" value="jdbc:mysql://database:3306/test"/>
        <property name="User" value="root"/>
        <property name="Password" value="password"/>
    </jdbc-connection-pool>

    <jdbc-resource enabled="true" jndi-name="jdbc/testDS" object-type="user" pool-name="jdbc/testConnPool">
        <description>Test DataSource jdbc/testDS for Connection Pool jdbc/testConnPool</description>
    </jdbc-resource>

</resources>

Taken from https://github.com/payara/Payara-Examples/blob/master/payara-micro/database-ping/src/main/webapp/WEB-INF/glassfish-resources.xml



来源:https://stackoverflow.com/questions/58951607/glassfish-5-1-0-error-when-adding-resources-from-web-console

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!