I am following the tutorial on Java EE7
-hands on lab here. I followed the instructions as provided there to set up my WildFly Application server
. Everything works fine. The tutorial zip comes with sample data and sql load scripts
that is used to initialize the data-source. If no data-source is provided in persistence.xml
, WildFly
will provide a default data-source
as mentioned in the tutorial.
At the end of step 3 in the tutorial link, here is how my screen-shot looks like:
But what is expected (as per tutorial link: Figure 12) is this:
The difference is "showing movies in theaters!" in my case to "showing 20 movies in 7 theaters!" in expected one. The JSF template used to display these numbers makes a EJB call that fetches data from the data-source. Looking at this, I think that my data-source is not initialized. But I don't why since I followed the tutorial word-by-word. I am also having hard trouble-shooting this.
Thanks for help in advance
EDIT
the server log shows Unable to determine H2 database version, certain features may not work.
2014-10-02 18:02:50,167 INFO [org.hibernate.Version] (ServerService Thread Pool -- 50) HHH000412: Hibernate Core {4.3.5.Final}
2014-10-02 18:02:50,170 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 50) HHH000206: hibernate.properties not found
2014-10-02 18:02:50,172 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 50) HHH000021: Bytecode provider name : javassist
2014-10-02 18:02:50,330 INFO [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.4.Final
2014-10-02 18:02:50,491 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 50) JBAS011409: Starting Persistence Unit (phase 2 of 2) Service 'movieplex7.war#movieplex7PU'
2014-10-02 18:02:50,641 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 50) HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
2014-10-02 18:02:50,875 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 50) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2014-10-02 18:02:50,883 WARN [org.hibernate.dialect.H2Dialect] (ServerService Thread Pool -- 50) HHH000431: Unable to determine H2 database version, certain features may not work
2014-10-02 18:02:50,922 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 50) HHH000397: Using ASTQueryTranslatorFactory
2014-10-02 18:02:51,047 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 50) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2014-10-02 18:02:51,048 WARN [org.hibernate.dialect.H2Dialect] (ServerService Thread Pool -- 50) HHH000431: Unable to determine H2 database version, certain features may not work
2014-10-02 18:02:51,055 WARN [org.hibernate.jpa.internal.schemagen.GenerationTargetToDatabase] (ServerService Thread Pool -- 50) Unable to execute JPA schema generation drop command [DROP TABLE SALES]
2014-10-02 18:02:51,055 WARN [org.hibernate.jpa.internal.schemagen.GenerationTargetToDatabase] (ServerService Thread Pool -- 50) Unable to execute JPA schema generation drop command [DROP TABLE POINTS]
2014-10-02 18:02:51,055 WARN [org.hibernate.jpa.internal.schemagen.GenerationTargetToDatabase] (ServerService Thread Pool -- 50) Unable to execute JPA schema generation drop command [DROP TABLE SHOW_TIMING]
2014-10-02 18:02:51,055 WARN [org.hibernate.jpa.internal.schemagen.GenerationTargetToDatabase] (ServerService Thread Pool -- 50) Unable to execute JPA schema generation drop command [DROP TABLE MOVIE]
2014-10-02 18:02:51,056 WARN [org.hibernate.jpa.internal.schemagen.GenerationTargetToDatabase] (ServerService Thread Pool -- 50) Unable to execute JPA schema generation drop command [DROP TABLE TIMESLOT]
2014-10-02 18:02:51,056 WARN [org.hibernate.jpa.internal.schemagen.GenerationTargetToDatabase] (ServerService Thread Pool -- 50) Unable to execute JPA schema generation drop command [DROP TABLE THEATER]
2014-10-02 18:02:51,250 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-8) Initializing Mojarra 2.2.6-jbossorg-4 20140501-1134 for context '/movieplex7'
2014-10-02 18:02:51,867 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017534: Registered web context: /movieplex7
2014-10-02 18:02:51,905 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "movieplex7.war" (runtime-name : "movieplex7.war")
2014-10-02 18:02:51,910 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
2014-10-02 18:02:51,911 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
2014-10-02 18:02:51,911 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.1.0.Final "Kenny" started in 5525ms - Started 256 of 310 services (91 services are lazy, passive or on-demand)
I have also raised an issue in github repo here: https://github.com/javaee-samples/javaee7-hol/issues/17#issuecomment-57561731
So I got the app, and tried to run it (Netbeans, Wildfly-8.1). It didn't run at all. Problem with the data source not being found. So (with Wildfly started) I went to the admin console localhost:9990
and typed in my credentials. In the console, Selected the [Configuration] tab, then [Datasources]. There is no defaultDataSource. There was a java:jboss/datasources/ExampleDS
as a preconfigured datasource. So in the persistence.xml
, I changed the data source to that, and it worked. FYI, I ran the movieplex7 from the solution dir from the download
This is the only thing I changed to the entire project. Just changed the jndi name for the data source to <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
EDIT
So @ArunGupta is correct. In the application, in the persistence.xml
There was this commented out line
<!--<jta-data-source>java:comp/DefaultDataSource</jta-data-source>-->
I assumed I would have to uncomment that. By uncommenting it, that's what caused it to initially not work. So I commented it back out, and without specifying any data souce i.e. java:jboss/datasources/ExampleDS
, it works as specified. So your problem seems to be elsewhere.