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

setUrl not working in 2020.4 #4864

Closed
dempile opened this issue Aug 31, 2020 · 7 comments
Closed

setUrl not working in 2020.4 #4864

dempile opened this issue Aug 31, 2020 · 7 comments
Assignees

Comments

@dempile
Copy link

dempile commented Aug 31, 2020

Just changed the server from 5.201 to 5.2020.4 and @DatasourceDefinition is giving me this error

👍 Exception while preparing the app : Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.6.payara-p1): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Access denied to execute this method : setURL
Error Code: 0
Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.6.payara-p1): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Access denied to execute this method : setURL
Error Code: 0
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:318)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:150)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:172)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:225)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:809)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:256)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:772)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:222)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:200)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:542)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactoryImpl(PersistenceProvider.java:388)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:316)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:207)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.(PersistenceUnitLoader.java:114)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:225)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:525)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:240)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:170)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:1101)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:503)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:561)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:552)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:551)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:582)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:574)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:573)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1497)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:120)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1879)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1755)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:564)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:251)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:166)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.sql.SQLException: Error in allocating a connection. Cause: Access denied to execute this method : setURL
at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:119)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:138)
... 55 more
Caused by: javax.resource.spi.ResourceAllocationException: Error in allocating a connection. Cause: Access denied to execute this method : setURL
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:319)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:196)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:166)
at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:113)
... 56 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Access denied to execute this method : setURL
at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:103)
at com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:287)
at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1532)
at com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:957)
at com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:235)
at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:528)
at com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:386)
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:244)
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:171)
at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:360)
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:307)
... 60 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Access denied to execute this method : setURL
at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:937)
at com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1209)
at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98)
... 70 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Access denied to execute this method : setURL
at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:110)
at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:920)
... 72 more
Caused by: javax.resource.ResourceException: Access denied to execute this method : setURL
at com.sun.gjc.util.MethodExecutor.runMethod(MethodExecutor.java:157)
at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:118)
at com.sun.gjc.spi.ManagedConnectionFactoryImpl.getDataSource(ManagedConnectionFactoryImpl.java:1384)
at com.sun.gjc.spi.CPManagedConnectionFactory.getDataSource(CPManagedConnectionFactory.java:91)
at com.sun.gjc.spi.CPManagedConnectionFactory.createManagedConnection(CPManagedConnectionFactory.java:123)
at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
... 73 more
]]

@khasunuma
Copy link

Hi @dempile, could you please provide a simple to follow scenario how to reproduce this on the latest version? A reproducer should ideally follow the SSCCE rules: http://www.sscce.org/. It will greatly help us to find the cause and fix it.

@dempile
Copy link
Author

dempile commented Sep 1, 2020

I just configure the database connection with this class and set the MicroProfile properties of course in the server (db_url_test, db_user, db_password ), I already got this problem wirth Payara Micro so i got to explicitely set the databaseName and the portNmber and delete the url property. But i never get this problem in the full version until the version of the new release system of 2020.x

package dz.test.appconfig;

import javax.annotation.PostConstruct;
import javax.annotation.sql.DataSourceDefinition;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@DataSourceDefinition(
name = "java:global/testJNDI",
minPoolSize = 0,
initialPoolSize = 0,
className = "org.postgresql.ds.PGConnectionPoolDataSource",
properties = {"connectionAttributes=;create=true"},
url = "${MPCONFIG=db_url_test}",
user = "${MPCONFIG=db_user}",
password = "${MPCONFIG=db_password}"
)
@startup
@singleton
public class DatabaseSetup {

@PersistenceContext(name = ConfigUtils.ADMINPU)
private EntityManager em;

@PostConstruct
public void init() {
    em.getEntityManagerFactory().getCache().evictAll();
}

}

@rdebusscher rdebusscher self-assigned this Sep 7, 2020
@rdebusscher
Copy link

Hi @dempile,

Can you indicate which version of the PostgreSQL driver you are using? There are reports that this is an iqssue with the driver itself, version 9.4 https://www.postgresql.org/message-id/CANPkoZTJWS2Uh9zYFLEDNzE94XrF-270PtdJ6O8=ogf4f=H3kQ@mail.gmail.com.

Or did you just did an update of the Payara Version and didn't change the driver?

Regards
Rudy

@dempile
Copy link
Author

dempile commented Sep 10, 2020

Hi @rdebusscher ,

The problem occurs when I try to deploy from the IDE, but when I deploy the war from the Payara GUI, it works ! !
I use postgresql-42.2.16 with postgresql 10.

Thanks

@rdebusscher
Copy link

Hi Omar,

Which IDE gives a problem? It seems it is not a problem of Payara Server but with an IDE or a plugin.

Regards
Rudy

@dempile
Copy link
Author

dempile commented Sep 18, 2020

Hi @rdebusscher ;

Im using IntelliJ , and I have triend Netbeans 12 with the same problem.

thanks

@dempile dempile closed this as completed Oct 20, 2020
@GeraldoTchimua
Copy link

Estou a usar o EclipseLink (JPA 2.1) e recebi tambem esse erro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants