Reputation: 1875
So, my first example using Wildfly 9.0.2 and I have deployed one webapp with the settings:
context: app-estoque-ws-server-wildfly
src/main/resources/META-INF
-> import.sql
-> persistence.xml
WebContent/WEB-INF
-> knight-estoque-ds.xml
persistence.xml:
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="primario">
<jta-data-source>java:jboss/datasources/KnightDS</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
knight-estoque-ds.xml:
<datasources xmlns="http://www.jboss.org/ironjacamar/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<datasource jndi-name="java:jboss/datasources/KnightDS"
pool-name="knight-datasource" enabled="true"
use-java-context="true">
<connection-url>jdbc:h2:file:knight-estoque;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
</datasources>
This is what I get on startup log:
21:52:31,043 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) WFLYJCA0001: Bound data source [java:jboss/datasources/KnightDS]
But how can I accomplish:
1- Accessing H2 knight-estoque on H2 web console, I can't see the any created or previously imported tables.
2- Also, I can't see in the Wildfly log the execution of import.sql that was previously added on META-INF folder.
3- And finally, how to locate the knight-estoque DS on Wildfly web console? Tried the following paths and didn't find the DS setup:
[RUNTIME] -> Standalone Server -> Subsystems -> Datasources (only shows ExampleDS)
[CONFIGURATION] -> Subsystems -> Datasources -> Non-XA -> (only shows ExampleDS)
[CONFIGURATION] -> Subsystems -> Datasources -> XA -> nothing here
The knight-estoque DS setup only shows on the structure bellow:
What I'm missing? I just want to execute the import.sql on DS so I can start using the application and also navigate through tables using H2 web console.
Thanks.
Upvotes: 2
Views: 5238
Reputation: 17790
The import.sql
file needs to be up one level in the src/main/resources/
directory not the META-INF
directory.
Upvotes: 2