java.sql.SQLException: Error in allocating a connection. Cause: No PasswordCredential found Error Code: 0

Java.net JIRA | a.accioly | 6 years ago
  1. 0

    When creating a datasource like this: {code} @DataSourceDefinition(name = "java:app/jdbc/myDatasource", className = "org.h2.jdbcx.JdbcDataSource", url = "jdbc:h2:/path/to/db;AUTO_SERVER=TRUE;MVCC=TRUE", user = "sa", password="" ) {code} or {code:xml|title=web.xml|borderStyle=solid} <data-source> <description>DataSource for H2</description> <name>java:app/jdbc/cdiDS</name> <class-name>org.h2.jdbcx.JdbcDataSource</class-name> <url>jdbc:h2:/path/to/db;AUTO_SERVER=TRUE;MVCC=TRUE</url> <user>sa</user> <password></password> </data-source> {code} Throws a nasty Exception: {noformat} Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: No PasswordCredential found Error Code: 0 at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:309) at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:138) at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94) at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:592) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:233) at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:394) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:185) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:242) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:230) at org.glassfish.persistence.jpa.PersistenceUnitLoader.doJava2DB(PersistenceUnitLoader.java:373) at org.glassfish.persistence.jpa.JPADeployer$2.visitPUD(JPADeployer.java:434) at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:486) at org.glassfish.persistence.jpa.JPADeployer.iterateInitializedPUsAtApplicationPrepare(JPADeployer.java:464) at org.glassfish.persistence.jpa.JPADeployer.event(JPADeployer.java:388) at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:452) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:360) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235) at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.executeCommand(CommandExecutorImpl.java:118) at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:97) at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:88) at org.glassfish.maven.PluginUtil.doDeploy(PluginUtil.java:106) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.glassfish.maven.AbstractDeployMojo.doDeploy(AbstractDeployMojo.java:171) at org.glassfish.maven.RunMojo.execute(RunMojo.java:62) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: java.sql.SQLException: Error in allocating a connection. Cause: No PasswordCredential found at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:117) at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:126) ... 54 more Caused by: javax.resource.spi.ResourceAllocationException: Error in allocating a connection. Cause: No PasswordCredential found at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:310) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:190) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165) at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:160) at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:110) ... 55 more Caused by: com.sun.appserv.connectors.internal.api.PoolingException: No PasswordCredential found at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:103) at com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282) at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1497) at com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:940) at com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:230) at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:511) at com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381) at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:242) at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:167) at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:335) at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:304) ... 59 more Caused by: com.sun.appserv.connectors.internal.api.PoolingException: No PasswordCredential found at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:920) at com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1181) at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98) ... 69 more Caused by: com.sun.appserv.connectors.internal.api.PoolingException: No PasswordCredential found at com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(ConnectorAllocator.java:168) at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:903) ... 71 more Caused by: javax.resource.spi.SecurityException: No PasswordCredential found at com.sun.gjc.util.SecurityUtils.getPasswordCredential(SecurityUtils.java:111) at com.sun.gjc.spi.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:100) at com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(ConnectorAllocator.java:147) ... 72 more 05/06/2011 00:57:59 org.glassfish.persistence.jpa.PersistenceUnitLoader doJava2DB {noformat} The same thing happens if I don't specify a password. The funny thing is, this works as expected: {code:xml|title=glassfish-resources.xml|borderStyle=solid} <?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> <jdbc-resource enabled="true" jndi-name="jdbc/myDatasource"pool-name="connectionPool"> <description/> </jdbc-resource> <jdbc-connection-pool datasource-classname="org.h2.jdbcx.JdbcDataSource" name="connectionPool" res-type="javax.sql.DataSource"> <property name="URL" value="jdbc:h2:jdbc:h2:/path/to/db;AUTO_SERVER=TRUE;MVCC=TRUE"/> <property name="User" value="sa"/> <property name="Password" value=""/> </jdbc-connection-pool> </resources> {code} I haven't tested with other databases, but a quick search on Google lead me to believe that this bug is also database agnostic. Can you guys confirm it?

    Java.net JIRA | 6 years ago | a.accioly
    java.sql.SQLException: Error in allocating a connection. Cause: No PasswordCredential found Error Code: 0
  2. 0

    Can't deploy my project on Glassfish

    Stack Overflow | 2 years ago
    javax.resource.spi.SecurityException: No password credential found
  3. 0

    Can't deploy my project on Glassfish

    Stack Overflow | 2 years ago
    java.sql.SQLException: No password credential found Error Code: 0
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    db:: 2.86::Tomcat 7 DatabaseServerLoginModule "Transaction Manager is null" 3p

    hivmr.com | 4 months ago
    javax.resource.spi.SecurityException: No Password credentials found
  6. 0

    problem with Cics Transaction Gateway on Windows 2000 Server

    Google Groups | 1 decade ago | Max Bilato
    javax.resource.spi.SecurityException: CTG9631E: Error occurred during interactio n with CICS. Error Code=ECI_ERR_SECURITY_ERROR

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.resource.spi.SecurityException

      No PasswordCredential found

      at com.sun.gjc.util.SecurityUtils.getPasswordCredential()
    2. Embedded GlassFish Web
      XAManagedConnectionFactory.createManagedConnection
      1. com.sun.gjc.util.SecurityUtils.getPasswordCredential(SecurityUtils.java:111)
      2. com.sun.gjc.spi.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:100)
      2 frames
    3. Connectors Runtime
      ConnectionManagerImpl.allocateConnection
      1. com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(ConnectorAllocator.java:147)
      2. com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:903)
      3. com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1181)
      4. com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98)
      5. com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282)
      6. com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1497)
      7. com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:940)
      8. com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:230)
      9. com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:511)
      10. com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381)
      11. com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:242)
      12. com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:167)
      13. com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:335)
      14. com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:304)
      15. com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:190)
      16. com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
      17. com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:160)
      17 frames
    4. Embedded GlassFish Web
      DataSource.getConnection
      1. com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:110)
      1 frame
    5. EclipseLink (non-OSGi)
      EntityManagerFactoryImpl.createEntityManager
      1. org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:126)
      2. org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
      3. org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
      4. org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:592)
      5. org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:233)
      6. org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:394)
      7. org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:185)
      8. org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:242)
      9. org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:230)
      9 frames
    6. Embedded GlassFish Web
      JPADeployer.event
      1. org.glassfish.persistence.jpa.PersistenceUnitLoader.doJava2DB(PersistenceUnitLoader.java:373)
      2. org.glassfish.persistence.jpa.JPADeployer$2.visitPUD(JPADeployer.java:434)
      3. org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:486)
      4. org.glassfish.persistence.jpa.JPADeployer.iterateInitializedPUsAtApplicationPrepare(JPADeployer.java:464)
      5. org.glassfish.persistence.jpa.JPADeployer.event(JPADeployer.java:388)
      5 frames
    7. Kernel Classes
      ApplicationLifecycle.deploy
      1. org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
      2. com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:452)
      3. com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
      3 frames
    8. Embedded GlassFish Web
      DeployCommand.execute
      1. org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
      1 frame
    9. Kernel Classes
      CommandRunnerImpl$ExecutionContext.execute
      1. com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:360)
      2. com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
      3. com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067)
      4. com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
      5. com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
      6. com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
      6 frames
    10. admin-cli
      DeployerImpl.deploy
      1. com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.executeCommand(CommandExecutorImpl.java:118)
      2. com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:97)
      3. com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:88)
      3 frames
    11. org.glassfish.maven
      PluginUtil.doDeploy
      1. org.glassfish.maven.PluginUtil.doDeploy(PluginUtil.java:106)
      1 frame
    12. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    13. org.glassfish.maven
      RunMojo.execute
      1. org.glassfish.maven.AbstractDeployMojo.doDeploy(AbstractDeployMojo.java:171)
      2. org.glassfish.maven.RunMojo.execute(RunMojo.java:62)
      2 frames
    14. Maven Plugin
      DefaultBuildPluginManager.executeMojo
      1. org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
      1 frame
    15. Maven Core
      DefaultMaven.execute
      1. org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
      2. org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      3. org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      4. org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      5. org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      6. org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      7. org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      8. org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
      9. org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      9 frames
    16. M3 Interceptor
      MavenCli.main
      1. org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
      2. org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
      3. org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
      3 frames
    17. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    18. Plexus
      Launcher.main
      1. org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      2. org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      3. org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
      4. org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
      4 frames