[jboss-jira] [JBoss JIRA] (WFLY-2027) EE Default DataSource is not working

Antonio Goncalves (JIRA) jira-events at lists.jboss.org
Thu Oct 17 05:19:02 EDT 2013


    [ https://issues.jboss.org/browse/WFLY-2027?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12816872#comment-12816872 ] 

Antonio Goncalves commented on WFLY-2027:
-----------------------------------------

I've used the Default Datasource with Beta1 and it doesn't work. Here is my persistence.xml :

{code}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
             version="2.1">
  <persistence-unit name="javaone2013PU" transaction-type="JTA">
    <description>Forge Persistence Unit</description>
    <jta-data-source>java:comp/DefaultDataSource</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
        <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
        <property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/>
        <property name="javax.persistence.schema-generation.scripts.create-target" value="createJavaOne2013.ddl"/>
        <property name="javax.persistence.schema-generation.scripts.drop-target" value="dropJavaOne2013.ddl"/>
        <property name="javax.persistence.sql-load-script-source" value="insert.sql"/>
    </properties>
  </persistence-unit>
</persistence>
{code}

When I deploy my war file I get the following in the console : 

{code}
Unexpected HTTP response: 500

Request
{
    "address" => [("deployment" => "javaone2013.war")],
    "operation" => "deploy"
}

Response

Internal Server Error
{
    "outcome" => "failed",
    "failure-description" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"javaone2013.war#javaone2013PU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.module.javaone2013.javaone2013.DefaultDataSource]"]},
    "rolled-back" => true
}
{code}

On the server logs

{code}
11:17:23,198 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015876: Starting deployment of "javaone2013.war" (runtime-name: "javaone2013.war")
11:17:23,406 INFO  [org.jboss.as.jpa] (MSC service thread 1-7) JBAS011401: Read persistence.xml for javaone2013PU
11:17:23,445 ERROR [org.jboss.as.controller.management-operation] (XNIO-1 task-4) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "javaone2013.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"javaone2013.war#javaone2013PU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.module.javaone2013.javaone2013.DefaultDataSource]"]}
11:17:23,445 ERROR [org.jboss.as.server] (XNIO-1 task-4) JBAS015870: Deploy of deployment "javaone2013.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"javaone2013.war#javaone2013PU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.module.javaone2013.javaone2013.DefaultDataSource]"]}
11:17:23,454 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015877: Stopped deployment javaone2013.war (runtime-name: javaone2013.war) in 8ms
{code}

                
> EE Default DataSource is not working
> ------------------------------------
>
>                 Key: WFLY-2027
>                 URL: https://issues.jboss.org/browse/WFLY-2027
>             Project: WildFly
>          Issue Type: Bug
>          Components: ConfigAdmin, Domain Management, EE, JCA, JPA / Hibernate, Web Console
>    Affects Versions: 8.0.0.Alpha4
>            Reporter: Lincoln Baxter III
>            Assignee: Eduardo Martins
>             Fix For: 8.0.0.Beta1
>
>
> The EE spec states that a default datasource must be supplied under: java:comp/DefaultDataSource, and if none is specified by the @Resource or persistence.xml, it must be assumed:
>  {code}EE 5.19
> The Java EE Platform requires that a Java EE Product Provider provide a database 
> in the operational environment (see Section EE.2.6, “Database”). The Java EE 
> Product Provider must also provide a preconfigured, default data source for use by 
> the application in accessing this database.
> The Java EE Product Provider must make the default data source accessible to 
> the application under the JNDI name java:comp/DefaultDataSource.
> The Application Component Provider or Deployer may explicitly bind a 
> DataSource resource reference to the default data source using the lookup element 
> of the Resource annotation or the lookup-name element of the resource-ref
> deployment descriptor element. For example,
> @Resource(lookup="java:comp/DefaultDataSource")
> DataSource myDS;
> In the absence of such a binding, the mapping of the reference will default to 
> the product's default data source.
> For example, the following will map to a preconfigured data source for the 
> product's default database:
> @Resource
> DataSource myDS;{code}
> This, isn't working however:
> {code}
> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd">
>    <persistence-unit name="default" transaction-type="JTA">
>    </persistence-unit>
> </persistence>{code}
> Results in: 
> {code}
> 10:41:31,002 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 50) MSC000001: Failed to start service jboss.persistenceunit."jpa-standard.war#default": org.jboss.msc.service.StartException in service jboss.persistenceunit."jpa-standard.war#default": org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
> 	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:134) [wildfly-jpa-8.0.0.Alpha4.jar:8.0.0.Alpha4]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
> 	at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
> 	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final.jar:2.1.0.Final]
> Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
> 	at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:98)
> 	at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:66)
> 	at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:193)
> 	at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:88)
> 	at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
> 	at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
> 	at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1844)
> 	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1802)
> 	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:844)
> 	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:836)
> 	at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:368)
> 	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:835)
> 	at org.jboss.as.jpa.hibernate4.management.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
> 	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:115) [wildfly-jpa-8.0.0.Alpha4.jar:8.0.0.Alpha4]
> 	... 4 more
> 10:41:31,010 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) JBAS014613: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"jpa-standard.war#default\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"jpa-standard.war#default\": org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
>     Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set"}}
> {code}
> Additionally, actually specifying the expected JDNI name of the default DS like this:
> {code}   <persistence-unit name="default" transaction-type="JTA">
>       <jta-data-source>java:comp/DefaultDataSource</jta-data-source>
>       <exclude-unlisted-classes>false</exclude-unlisted-classes>
>    </persistence-unit>{code}
> Results in this:
> {code}
> JBAS014775:    New missing/unsatisfied dependencies:
>       service jboss.naming.context.java.module.jpa-standard.jpa-standard.DefaultDataSource (missing) dependents: [service jboss.persistenceunit."jpa-standard.war#default".__FIRST_PHASE__] 
>       service jboss.persistenceunit."jpa-standard.war#default".__FIRST_PHASE__ (missing) dependents: [service jboss.deployment.unit."jpa-standard.war".POST_MODULE] 
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the jboss-jira mailing list