glassfish
  1. glassfish
  2. GLASSFISH-20773

<data-source> defintion doesn't parse <url> correctly with Java DB/Derby

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0_dev
    • Fix Version/s: None
    • Component/s: jdbc
    • Labels:
      None
    • Environment:

      Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
      Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b17
      System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)

      Description

      For an application with the following data-source definition in the deployment descriptor:

          <data-source>
              <description>Test data source.</description>
              <name>java:app/TestDataSource</name>
              <class-name>org.apache.derby.jdbc.ClientDataSource</class-name>
              <url>jdbc:derby://localhost:1527/test;create=true</url>
          </data-source>
      

      GlassFish throws the following error on deployment:

      INFO:   EclipseLink, version: Eclipse Persistence Services - 2.5.0.v20130507-3faac2b
      WARNING:   RAR5038:Unexpected exception while creating resource for pool __SYSTEM/pools/__datasource_definition/dataSourceTest/java:app/TestDataSource. Exception : javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: Required Derby DataSource property databaseName not set.
      WARNING:   RAR5117 : Failed to obtain/create connection from connection pool [ __SYSTEM/pools/__datasource_definition/dataSourceTest/java:app/TestDataSource ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: Required Derby DataSource property databaseName not set.
      WARNING:   RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Connection could not be allocated because: Required Derby DataSource property databaseName not set.]
      SEVERE:   Local Exception Stack: 
      Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException
      Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Required Derby DataSource property databaseName not set.
      Error Code: 0
      	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:316)
      	at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:135)
      	at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
      	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:203)
      	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:734)
      	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:239)
      	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:681)
      	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)
      	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:182)
      	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:527)
      	at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:358)
      	at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199)
      	at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107)
      	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:922)
      	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:431)
      	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
      	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.security.auth.Subject.doAs(Subject.java:356)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
      	at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
      	at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
      	at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      	at java.lang.Thread.run(Thread.java:724)
      ...
      

      Replacing <url> with the following works correctly:

          <data-source>
              <description>Test data source.</description>
              <name>java:app/TestDataSource</name>
              <class-name>org.apache.derby.jdbc.ClientDataSource</class-name>
              <server-name>localhost</server-name>
              <port-number>1527</port-number>
              <database-name>test</database-name>
              <user>app</user>
              <password>app</password>
              <property>
                  <name>connectionAttributes</name>
                  <value>;create=true</value>
              </property>
          </data-source>
      

      The server should be able to correctly parse the JDBC URL, including the attributes, from within the <data-source> definition.

        Activity

        Hide
        Ian Evans added a comment -

        Maven WAR project that demonstrates the error.

        Show
        Ian Evans added a comment - Maven WAR project that demonstrates the error.

          People

          • Assignee:
            sfelts
            Reporter:
            Ian Evans
          • Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: