2 Replies Latest reply on Sep 13, 2012 7:20 AM by S Sippel

    Seam 2.1.6 + jboss 5.1: datasource not bound

    S Sippel Newbie

      Hi

       

      I have a finished example project from my company imported in my eclipse and i dont know how i could connect to the h2 databse.

       

      Hibernate config

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- Persistence deployment descriptor for dev profile -->
      <persistence 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_1_0.xsd"
                version="1.0">
                <persistence-unit name="ExampleProject"
                          transaction-type="JTA">
                          <provider>org.hibernate.ejb.HibernatePersistence</provider>
                          <jta-data-source>java:/ProjectDatasource</jta-data-source>
                          <properties>
                                    <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
                                    <property name="hibernate.hbm2ddl.auto" value="create" />
                                    <property name="hibernate.show_sql" value="true" />
                                    <property name="hibernate.format_sql" value="true" />
                                    <property name="hibernate.transaction.manager_lookup_class"
                                              value="org.hibernate.transaction.JBossTransactionManagerLookup" />
                          </properties>
                </persistence-unit> 
      
      </persistence>
      

       

      ExampleProject-ds.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE datasources PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
                                   "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
      <datasources>
       <local-tx-datasource>
        <jndi-name>ExampleProjectDatasource</jndi-name>
        <use-java-context>true</use-java-context>
        <connection-url>jdbc:h2:~/EPSDS</connection-url>
        <driver-class>org.h2.Driver</driver-class>
        <user-name>sa</user-name>
       </local-tx-datasource>
      </datasources>
      

       

       

      Jboss says

      11:48:07,606 ERROR [DatasourceConnectionProvider] Could not find datasource: java:/ProjectDatasource

      javax.naming.NameNotFoundException: ProjectDatasource not bound

       

      In standard configL

       

            <!-- The jndi name of the DataSource, it is prefixed with java:/ -->

            <!-- Datasources are not available outside the virtual machine -->

       

      If i understand that right, java:// is wrong?

      Have someone a idea?

       

      Dear

      hannibalhh