Closed gilbertoca closed 7 years ago
Changed the name to GaceDataSource and the results
[2016-07-11T11:26:06.310-0300] [Payara Micro 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1468247166310] [levelValue: 1000] Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
java.lang.RuntimeException: Invalid resource : GaceDataSource__pm
at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)
at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)
at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)
at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:150)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:114)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:926)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:435)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:487)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:134)
at fish.payara.micro.PayaraMicro.deployAll(PayaraMicro.java:1249)
at fish.payara.micro.PayaraMicro.bootStrap(PayaraMicro.java:905)
at fish.payara.micro.PayaraMicro.main(PayaraMicro.java:148)
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : GaceDataSource__pm
at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:82)
at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:63)
at org.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:142)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:589)
... 32 more
[2016-07-11T11:26:06.313-0300] [Payara Micro 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1468247166313] [levelValue: 1000] Exception while preparing the app
[2016-07-11T11:26:06.314-0300] [Payara Micro 4.1] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1468247166314] [levelValue: 1000] [[
Exception during lifecycle processing
java.lang.RuntimeException: Invalid resource : GaceDataSource__pm
at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:517)
at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)
at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)
at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:150)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:114)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:926)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:435)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:487)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:134)
at fish.payara.micro.PayaraMicro.deployAll(PayaraMicro.java:1249)
at fish.payara.micro.PayaraMicro.bootStrap(PayaraMicro.java:905)
at fish.payara.micro.PayaraMicro.main(PayaraMicro.java:148)
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : GaceDataSource__pm
at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:82)
at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:63)
at org.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:142)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:589)
... 32 more
]]
Full log https://gist.github.com/gilbertoca/0d2e707d76399ea81c1191763070b7e7 This time, the app is not deployed.
Have you tried java:global/gace/MyDS ?
Yes. I think we hit this issue https://java.net/jira/browse/GLASSFISH-20944
Oh, sorry! Just read all this post/discussion #510 . Maybe something related to it, no?.
Invalid resource : GaceDataSource__pm
What does it mean the sufix __pm?
Have you tried java:global/gace/MyDS ?
Ok, just to make it understandable me, when DEFINING the resource we use full namesspace
java:global --> java:global/gace/MyDS --> could be in server configuration
java:app --> java:app/gace/MyDS --> here is in our web.xml
Now, when USING/REFERENCING it we can use the component name
gace/MyDS --> java:global/gace/MyDS
gace/MyDS --> java:app/gace/MyDS
for ex.
@Resource(lookup="java:global/gace/MyDS")
DataSource myDS;
<resource-ref>
<res-ref-name>gace/MyDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<lookup-name>java:global/gace/MyDS</lookup-name>
</resource-ref>
So, in our persistence.xml file we are USING/REFERENCING it, doesn't it?
<jta-data-source>gace/MyDS</jta-data-source>
The point of confusion for me is that everyone uses both names in both situations.
PS.: We've used java:app/gace/MyDS in both places.
I notice this is Payara Micro. Are you packaging the database driver into your WEB-INF/lib or is it on the classpath?
With java:global/ExampleDataSource
it deploy and works;
With java:app/MyApp/MyDS
and our java:app/gace/MyDS
it deploy with the SEVERE issue and works;
Any other variation gace/DataSource, MyApp/MyDS, GaceDataSource, MyDS
gives the exception https://github.com/payara/Payara/issues/907#issuecomment-231751075 and doesn't deploy the app ;
The name appear with the suffix __pm
OK I think the SEVERE log is probably incorrect. I'll try with an example app.
For me java:global/myresource
does not work. I also get the Severe: java.lang.RuntimeException: Invalid resource : myresource__pm
.
EDIT: this was happening before I changed the jta-data-source
in my persistence.xml
to java:global/myresource
. After changing it there as well I run into Error while binding JNDI name java:global/myresource/MyFacade for EJB MyFacade
/ javax.naming.NameAlreadyBoundException: myresource
.
EDIT 2: changed it to java:global/myapp/ds
and now it works.
Hate to revive an old issue, but some clarification could help me. Right now I have a persistence.xml
packaged in a jar and included in WAR/WEB-INF/lib with a similar config:
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="MyAppPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/MyApp</jta-data-source>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.jpa.uppercase-column-names" value="true"/>
<property name="eclipselink.weaving" value="false"/>
</properties>
<class>com.mydomain.Class1</class>
<class>com.mydomain.Class2</class>
<class>com.mydomain.Class3</class>
</persistence-unit>
</persistence>
I also have a payara-resources.xml
defined as:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Payara.fish//DTD Payara Server 4 Resource Definitions//EN" "https://raw.githubusercontent.com/payara/Payara-Server-Documentation/master/schemas/payara-resources_1_6.dtd">
<resources>
<jdbc-resource pool-name="MyApp" jndi-name="jdbc/MyApp" enabled="true" ></jdbc-resource>
<jdbc-connection-pool datasource-classname="com.microsoft.sqlserver.jdbc.SQLServerDataSource"
name="MyApp"
res-type="javax.sql.DataSource">
<!-- Properties defined here //-->
</jdbc-connection-pool>
</resources>
Are you saying that the jndi name needs to change from jdbc/MyApp
to java:jdbc/MyApp
in both the payara-resources.xml
and persistence.xml
? I'm adding the MS driver to classpath using --addlibs /opt/payara/lib
(where I put the file):
[2019-06-03T17:10:38.110+0000] [] [INFO] [] [PayaraMicro] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1559581838110] [levelValue: 800] Added /opt/payara/lib/mssql-jdbc-7.0.0.jre8.jar to classpath
You can create the resource in your web.xml in a standard way rather than use the resources.xml
@smillidge Thanks for the suggestion. I do prefer the resources.xml. I finally got it working.
Getting SEVERE [1] information running payara micro:
The DataSource definition is here [2]. Even complaining about the deployment the app works.
[1] https://gist.github.com/gilbertoca/a45b6b74b1e48293c620eb4629d8720b [2] https://gist.github.com/gilbertoca/f2a386f52373e2826ff7b99926f9f4e7