java - Can't find valid JDBC driver when deploying Liberty app in Bluemix with ElephantSQL -


i have websphere liberty 16.0.0.2 webapp develop , run locally on laptop derby db using jpa work database. used deploy bluemix sqldb (retired ibm in may 2016) , worked fine automatic wiring of service. since sqldb no longer available, free sql able find on bluemix elephantsql, autowiring not seem work. here error after deployment:

program error occured: cwwjp0013e: server cannot locate java:comp/env/jdbc/trireplicatordb data source trireplicatorpersistenceunit persistence unit because has encountered following exception: javax.naming.namingexception: cwnen1001e: object referenced java:comp/env/jdbc/trireplicatordb jndi name not instantiated. if reference name maps jndi name in deployment descriptor bindings application performing jndi lookup, make sure jndi name mapping in deployment descriptor binding correct. if jndi name mapping correct, make sure target resource can resolved specified name relative default initial context. [root exception com.ibm.wsspi.injectionengine.injectionexception: cwnen0030e: server unable obtain object instance java:comp/env/jdbc/trireplicatordb reference. exception message was: cwnen1006e: server unable obtain object jdbc/trireplicatordb binding javax.sql.datasource type. exception message was: java.sql.sqlnontransientexception: dsra4000e: valid jdbc driver implementation class not found jdbcdriver jdbcdriver[myderbyjdbcdriver] using library com.ibm.ws.classloading.sharedlibrary_79. [/home/vcap/app/wlp/usr/servers/triserver/lib/postgresql-jdbc-9.4.1209.jar]].  

the way upload web app packaging server , using cf push command. here resulting server.xml file:

<server description="new server"> <!-- enable features --> <featuremanager>     <feature>jsp-2.3</feature>     <feature>concurrent-1.0</feature>     <feature>jaxrs-2.0</feature>     <feature>jaxrsclient-2.0</feature>     <feature>jpa-2.1</feature>     <feature>appsecurity-2.0</feature>     <feature>localconnector-1.0</feature>     <feature>icap:managementconnector-1.0</feature>     <feature>appstate-1.0</feature>     <feature>jdbc-4.1</feature>     <feature>cloudautowiring-1.0</feature> </featuremanager> <httpendpoint httpport="${port}" id="defaulthttpendpoint" host="*"/> <webcontainer deferservletload="false" trusthostheaderport="true" extracthostheaderport="true"/> <applicationmonitor updatetrigger="mbean"/> <!-- application --> <webapplication contextroot="/" id="tri-replicator" location="tri-replicator.war" name="tri-replicator"> </webapplication> <jdbcdriver id="myderbyjdbcdriver">     <library name="derbylib">         <fileset dir="c:\projects_c\tri-replicator-16\db\db-derby-10.11.1.1-bin\lib" includes="derby.jar"/>         <fileset dir='${server.config.dir}/lib' includes='postgresql-jdbc-9.4.1209.jar'/>     </library> </jdbcdriver> <!-- use local derby db local testing on laptop, when deployed bluemix automatically rewired use sql db instance --> <datasource id="derbyconnection" jdbcdriverref="myderbyjdbcdriver" jndiname="jdbc/trireplicatordb">     <properties createdatabase="create" databasename="${cloud.services.elephantsql-tri-replicator.connection.name}" user="${cloud.services.elephantsql-tri-replicator.connection.user}" password="${cloud.services.elephantsql-tri-replicator.connection.password}" servername="${cloud.services.elephantsql-tri-replicator.connection.host}" portnumber="${cloud.services.elephantsql-tri-replicator.connection.port}"/> </datasource> <include location='runtime-vars.xml'/> <httpdispatcher enablewelcomepage='false'/> <config updatetrigger='mbean'/> <appstate appname='tri-replicator' markerpath='${home}/../.liberty.state'/> 

as alternative question - can suggest other small free plan sql database in bluemix? postgresql , db2 not provide free plans.

the exception reported states following:

a valid jdbc driver implementation class not found  jdbcdriver jdbcdriver[myderbyjdbcdriver] 

this exception saying unable locate connection pooling datasource class within postgresql-jdbc-9.4.1209.jar.

wlp working design , requires additional configuration in server.xml since wlp able locate implementation classes number of known databases[1]. reviewed postgresql-jdbc-9.4.1209.jar driver , found implementation class following:

org.postgresql.ds.pgpoolingdatasource 

you should update server.xml file following:

javax.sql.datasource="org.postgresql.ds.pgpoolingdatasource" 

[1]https://www.ibm.com/support/knowledgecenter/was_beta_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/twlp_dep_configuring_ds.html


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -