java - Configuring Liberty Profile to use H2 database -
i have embedded h2 database running have been connecting such: browser h2 interface
this works desired. i'm using jpa/ejb/jsf build ear run on liberty profile. i've configured liberty profile work several different databases in past, having no luck h2. server.xml looks this:
<!-- enable features --> <featuremanager> <feature>ejblite-3.1</feature> <feature>servlet-3.0</feature> <feature>localconnector-1.0</feature> <feature>managedbeans-1.0</feature> <feature>cdi-1.0</feature> <feature>jpa-2.0</feature> <feature>jaxrs-1.1</feature> <feature>jsf-2.0</feature> <feature>jaxws-2.2</feature> </featuremanager> <httpendpoint host="*" httpport="9080" httpsport="9443" id="defaulthttpendpoint"/> <library description="xxxx" id="xxxx" name="xxxx"> <fileset dir="${shared.resource.dir}/xxxx" includes="*.jar"/> </library> <datasource type="javax.sql.datasource" id="xxxx" jndiname="jdbc/xxxx"> <jdbcdriver javax.sql.datasource="org.h2.jdbcx.jdbcdatasource"> <library> <fileset casesensitive="false" dir="${shared.resource.dir}/xxxx"/> </library> </jdbcdriver> <properties password="gg" url="jdbc:h2:~/xxxx" user="sa" databasename="xxxxdb"/> </datasource>
<applicationmonitor updatetrigger="mbean"/>
this method never finds database. i've tried using 192.168.2.13:8087
, gives
org.apache.openjpa.persistence.persistenceexception: no suitable driver found http://192.168.2.13:8087 dsra0010e: sql state = 08001, error code = 8,001 @ org.apache.openjpa.jdbc.sql.dbdictionaryfactory.newdbdictionary(dbdictionaryfactory.java:102) @ org.apache.openjpa.jdbc.conf.jdbcconfigurationimpl.getdbdictionaryinstance(jdbcconfigurationimpl.java:603).
i've spent considerable amount of time searching google proper configuration, have been unsuccessful. guidance appreciated.
thanks in advance.
this working h2 configuration in server.xml of wlp:
<datasource id="mydb" jndiname="jdbc/mydb" type="javax.sql.connectionpooldatasource"> <jdbcdriver javax.sql.connectionpooldatasource="org.h2.jdbcx.jdbcdatasource" javax.sql.datasource="org.h2.jdbcx.jdbcdatasource" javax.sql.xadatasource="org.h2.jdbcx.jdbcdatasource" libraryref="sharedlibrary_h2"/> <properties url="jdbc:h2:c:/apps/db/h2/mydb.db;mv_store=false;auto_server=true" databasename="my_db" user="sa" password="sa" /> </datasource> <library id="sharedlibrary_h2"> <fileset dir="${shared.resource.dir}/h2" id="fileset_h2"/> </library>
the h2.jar must available at:
c:\path\to\wlp\usr\shared\resources\h2\h2-1.4.187.jar
in persistence unit of peristence.xml:
<jta-data-source>jdbc/mydb</jta-data-source>
java jpa h2 websphere-liberty
No comments:
Post a Comment