Glassfish-resources.xml ignored with NetBeans 8.0.1?

I just used NetBeans 8.0.1 and GlassFish 4.1 for 2 old projects that worked well with NetBeans 8.0 and GlassFish 4.0.

Now (with NetBeans 8.0.1) I get the error message "tInvalid resource: jdbc / nameOfTheSource__pm" during project deployment.

The JDBC resource and connection pool are defined by glassfish-resources.xml (generated by NetBeans when I defined a new object with the option "Create Permanent Unit" and "New Data Source").

If I use glassfish resources directly with the add-resource asadmin command, everything works on the server: a connection pool and JDBC resources are created. Therefore, the problem does not arise from this file.

As if glassfish-resources.xml were ignored during deployment.

Did anyone have the same problem (and have an explanation)?

My environment: NetBeans 8.0.1, GlassFish 4.1, Java DB 10.10.1.2 - (1495037) (from Java 8.0).

A related question: how are glass fish used during deployment? It is not included in EAR or WAR files.

Thanks in advance for your help.

+4
source share
2 answers

This is a GlassFish bug: https://netbeans.org/bugzilla/show_bug.cgi?id=243034

I define my data source in the application using @DatasourceDefinition instead of using glassfish-resources.xml, but this is a workaround for the data source and not for other types of resources.

+2
source

NetBeans, , , , , -, . glassfish-resources.xml @DataSourceDefinition.

DataSourceBean.java @DataSourceDefinition:

@Singleton
@Startup
@DataSourceDefinition(name="java:global/jdbc/myDataSource",
    className="com.microsoft.sqlserver.jdbc.SQLServerDataSource",
    url="jdbc:sqlserver://127.0.0.1:1433;databaseName=myDB",
    user="myuser",
    password="mypassword"
)
public class DataSourceBean {
}

persistence.xml :

<?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
             version="2.1">
    <persistence-unit name="myUnit" transaction-type="JTA">
        <jta-data-source>java:global/jdbc/myDataSource</jta-data-source>
        <properties>
            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
        </properties>
    </persistence-unit>
</persistence>
0