Configuring Oracle dataSource settings on WAS Liberty (WL ) - failure - oracle

I am receiving below exception. on Liberty console & in browser.
javax.servlet.ServletException: Worklight Console initialization failed.Logged Exception: com.worklight.server.database.api.WorklightDataSourceException: FWLSE0194E: MobileFirst Server cannot be started because of failure while getting a connection from data-source bound to resource reference: jdbc/WorklightDS. Make sure the database is up, the credentials are correct and the driver is available for the server. [project worklight]
at com.worklight.core.auth.impl.AuthenticationFilter.verifyServletInitialized(AuthenticationFilter.java:451)
at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:138)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at [internal classes]
When running/viewing an app (war) on a UAT machine having below configuration.
Environment:
WL 6.3 EE
WAS Liberty Core V8.5.5.4
Oracle 11g
Windows Server 2012 R2
worklight.properties
publicWorkLightHostname=localhost
publicWorkLightProtocol=http
publicWorkLightPort=9080
wl.db.url=jdbc:oracle:thin:#10.100.11.1:1529:gmaxem
wl.db.username=WRKLIGHT
wl.db.password=wrklight
wl.reports.db.url=jdbc:oracle:thin:#10.100.11.1:1529:gmaxem
wl.reports.db.username=WLRREPOR
wl.reports.db.password=wlrrepor
Web.xml
<resource-ref>
<description>Worklight Server Database</description>
<res-ref-name>jdbc/WorklightDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>Reports Database</description>
<res-ref-name>jdbc/WorklightReportsDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Liberty - server.xml
<application id="worklight" name="worklight" location="myapp.war" type="war" context-root="/worklight" >
<classloader delegation="parentLast">
<privateLibrary id="worklightlib_worklight">
<fileset dir="${shared.resource.dir}/lib" includes="worklight-jee-library.jar"/>
</privateLibrary>
</classloader>
</application>
<jndiEntry value="9080" jndiName="publicWorkLightPort"/>
<jndiEntry value="localhost" jndiName="publicWorkLightHostname"/>
<jndiEntry value="http" jndiName="publicWorkLightProtocol"/>
<jndiEntry value="10" jndiName="serverSessionTimeout"/>
<library id="OracleLib">
<fileset dir="${shared.resource.dir}/oracle" includes="*.jar"/>
</library>
<dataSource jndiName="jdbc/AppCenterDS" transactional="false">
<jdbcDriver libraryRef="OracleLib"/>
<properties.oracle driverType="thin" URL="jdbc:oracle:thin:#10.100.11.1:1529:gmaxem" user="WLAPPCENTER" password="wlappcenter"/>
</dataSource>
<dataSource jndiName="worklight/jdbc/WorklightDS" transactional="false">
<jdbcDriver libraryRef="OracleLib" />
<properties.oracle driverType="thin" url="jdbc:oracle:thin:#10.100.11.1:1529:gmaxem" user="WRKLIGHT" password="wrklight" />
</dataSource>
<dataSource jndiName="worklight/jdbc/WorklightReportsDS" transactional="false">
<jdbcDriver libraryRef="OracleLib" />
<properties.oracle driverType="thin" url="jdbc:oracle:thin:#10.100.11.1:1529:gmaxem" user="WLRREPOR" password="wlrrepor" />
</dataSource>
I have also copied:
jdbc jar (ojdbc6.jar) at Liberty\usr\shared\resources\oracle
worklight-jee-library.jar at Liberty\usr\shared\resources\lib
myapp.war at Liberty\usr\servers\WorklightServer\apps
The apps folder on Liberty contains only these 3 war files.
myapp.war
appcenterconsole.war
applicationcenter.war

The error message mentions jdbc/WorklightDS, therefore the configuration mistake must be in the <dataSource jndiName="worklight/jdbc/WorklightDS" ...> element.
You are using the syntax url="jdbc:oracle:thin:#//10.100.11.1:1529/WRKLIGHT" which is the syntax for a JDBC URL with a service name, but WRKLIGHT is probably not the service name but the SID of your database. (Service names usally include some dots.)
You have two options:
Use the syntax which references the SID: url="jdbc:oracle:thin:#10.100.11.1:1529:WRKLIGHT"
Look up the service name in the file ORACLE_HOME\network\admin\tnsnames.ora, and use this service name in the URL, instead of WRKLIGHT.

Error in update 2: javax.servlet.ServletException: Worklight Console initialization failed.Logged Exception: java.lang.RuntimeException: FWLSE0206E: The project /worklight failed to initialize, because the project database schema for data source jdbc:oracle:thin:#10.100.11.1:1529:gmaxem is from version N/A, which is not supported by the server from version 6.3.0.00.20141127-1357. Use the MobileFirst ant tasks to upgrade the project database schema. [project worklight
This means that the connection to the database worked but that the tables that are expected to be in the table were not found.
If you install manually, you need to create the schema of the tables.
https://www-01.ibm.com/support/knowledgecenter/SSHS8R_6.3.0/com.ibm.worklight.installconfig.doc/admin/t_config_oracle_DB_manually_for_wladmin.html

Solved
This issue has been resolved.
Unfortunately my client had not created WLADMIN database at all and I was told that it does exists. Plus app center database was having wrong tables created as I mentioned in another post.
I was not given privileges to install any db tool to interact/see the databases structure.
Note: - The above mentioned configuration is correct and is working fine.

might be useful to someone, it should be '/' separator for port name and service name
<dataSource beginTranForResultSetScrollingAPIs="true" beginTranForVendorAPIs="false" commitOrRollbackOnCleanup="rollback" connectionManagerRef="default-conn-mgr" isolationLevel="TRANSACTION_READ_COMMITTED" jndiName="jdbc/test" transactional="true" type="javax.sql.ConnectionPoolDataSource">
<jdbcDriver libraryRef="oracleJDBCJars"/>
<properties.oracle URL="jdbc:oracle:thin:#my-host.name.xxx.com:portnumber/service.name.com" password="xxx" user="test_usr"/>

Related

Error executing CICS request while deploying app into IBM liberty Profile

I´ve got an app that works perfectly if I deploy it (in my local) into WAS. However, I´m getting the following exception connecting to CICS services if if deploy it into Liberty Profile (WebSphere Application Server 8.5.5.8/wlp-1.0.11.cl50820151201-1942) in IBM J9 VM, version pwa6470_27sr2fp10-20141218_02 (SR2 FP10)
:
com.ibm.connector2.cics.CICSUserInputException#a71e6144
[invalidProperties=<null>,errorCode=<null>,linkedException=<null>,
detailMessage=CTG9628E InteractionSpec passed to execute() not of type ECIInteractionSpec,
cause=com.ibm.connector2.cics.CICSUserInputException#a71e6144,stackTrace=<null>,
suppressedExceptions=[]]
However the IteractionSpec IS an instance of ECIInteractionSpec:
This is my server.xml, for what is worth:
<server description="new server">
<featureManager>
<feature>jsp-2.2</feature>
<feature>jpa-2.0</feature>
<feature>jaxrs-1.1</feature>
<feature>cdi-1.0</feature>
<feature>beanValidation-1.0</feature>
<feature>ejbLite-3.1</feature>
<feature>json-1.0</feature>
<feature>apiDiscovery-1.0</feature>
<feature>managedBeans-1.0</feature>
<feature>jca-1.6</feature>
<feature>jndi-1.0</feature>
<feature>javaMail-1.5</feature>
<feature>jaxws-2.2</feature>
<feature>localConnector-1.0</feature>
<feature>jms-1.1</feature>
<feature>servlet-3.1</feature>
</featureManager>
<variable name="SHARED_LIB_ROOT" value="C:\IBM\\IBM\liberty_jars"/>
<variable name="SHARED_LIB_CONFLU" value="C:\IBM\SHARED_LIB"/>
<resourceAdapter autoStart="true" id="eciResourceAdapter" location="${SHARED_LIB_CONFLU}/cicseci-9.1.rar">
<classloader apiTypeVisibility="spec, ibm-api, third-party"/>
</resourceAdapter>
<library apiTypeVisibility="spec, ibm-api, third-party" id="gneislibrary">
<folder dir="${SHARED_LIB_CONFLU}"/>
</library>
<!-- drivers lib -->
<!-- ORACLE -->
<library id="oracle-lib">
<fileset dir="${SHARED_LIB_ROOT}\drivers\oracle" includes="oracle-ojdbc6-11.2.0.3.0.jar"/>
</library>
<!-- DB2 -->
<library id="db2-lib">
<fileset dir="${SHARED_LIB_ROOT}\drivers\db2" includes="db2jcc.jar db2jcc_license_cisuz.jar"/>
</library>
<!-- To access this server from a remote client add a host attribute to
the following element, e.g. host="*" -->
<httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/>
<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>
<applicationMonitor updateTrigger="mbean"/>
<connectionFactory id="eciTest" jndiName="eis/CICSPWAS">
<properties.eciResourceAdapter TPNName="SCTG" connectionUrl="my_hostname" portNumber="my_port_number" tracelevel="3" userName="my_user_name"/>
</connectionFactory>
<!-- external libs -->
<library id="external-lib">
<fileset dir="${SHARED_LIB_ROOT}\external-lib" includes="*"/>
<folder dir="${SHARED_LIB_ROOT}\external-lib"/>
</library>
<quickStartSecurity userName="wasadmin" userPassword="123456"/>
<webApplication contextRoot="/myapp" id="oauth" location="myapp.war" name="myapp">
<classloader apiTypeVisibility="spec, ibm-api, third-party" classProviderRef="eciResourceAdapter" commonLibraryRef="gneislibrary" delegation="parentFirst"/>
</webApplication>
<keyStore location="${server.output.dir}/resources/security/key.jks"></keyStore>
</server>
The "CTG9628E InteractionSpec passed to execute() not of type ECIInteractionSpec" message is issued when the CICS TG RAR code checks whether the Interaction Spec passed an instance of the expected ECIInteractionSpec from application. This suggests that the application is not passing the expected ECIInteractionSpec. One possibility could be CICS TG RAR file used for compiling the application is different from version of CICS TG RAR files defined the WebSphere Liberty server profile.
Can you try downloading latest version of CICS TG RAR file from:
https://developer.ibm.com/cics/2016/03/11/cics-tg-sdks
Copy (after extracting) the CICS TG RAR file from /cicstgsdk/api/jee/runtime/managed/cicseci.rar to your application and recompile the application. Also use the same CICS TG RAR in your liberty profile and verify the scenario.
I fixed it. Thanks a lot guys for your help. The project got included transitive dependencies to very old versions of cicseci library. I excluded them. I don´t understand yet why it works perfectly on WAS and it fails in WLP.

Can't find valid JDBC Driver (implementation class) for Hana in Websphere Liberty

I'm trying to connect a Websphere Liberty v16.0.0.4 to a HANA datasource, but I'm unable to find the right driver.
Currently in my server.xml I have the following:
<xml version="1.0" encoding="UTF-8">
<server description="o01-cls-pega-static-prpc02-appsrv03">
<!-- Enable features -->
<featureManager>
<feature>webProfile-7.0</feature>
<feature>localConnector-1.0</feature>
<feature>jdbc-4.1</feature>
<feature>ssl-1.0</feature>
<feature>servlet-3.1</feature>
<feature>ejb-3.2</feature>
<feature>ejbLite-3.2</feature>
<feature>ejbRemote-3.2</feature>
<feature>jndi-1.0</feature>
<feature>jms-2.0</feature>
<feature>jaxws-2.2</feature>
<feature>jaxb-2.2</feature>
<feature>restConnector-2.0</feature>
<feature>wmqJmsClient-2.0</feature>
<feature>jmsMdb-3.2</feature>
</featureManager>
<httpEndpoint id="defaultHttpEndpoint"
host="localhost"
httpPort="28740"
httpsPort="28741" />
<!-- JDBC Hana Driver -->
<jdbcDriver id="myHanaDriver" javax.sql.DataSource="com.ibm.ws.jdbc.jdbcDriver">
<library>
<fileset dir="${wlp.user.dir}/shared/resources/hana" includes="*.jar" id="HANALib"/>
</library>
</jdbcDriver>
<!-- HANA JDBC Databases -->
<dataSource
type="javax.sql.DataSource"
containerAuthDataRef="PegaDBUserSAPHANA"
id="hanaDataSource"
jdbcDriverRef="myHanaDriver"
jndiName="jdbc/hanaDataSource">
<properties serverName="localhost" port="35315"/>
</dataSource>
<applicationManager autoExpand="true"/>
</server>
This is the error I get:
[5/6/19 14:24:24:735 CEST] 00000038 LogService-156-com.ibm.ws.jdbc
E CWWKE0701E: FrameworkEvent ERROR Bundle:com.ibm.ws.jdbc(id=156) org.osgi.framework.ServiceException:
Exception in com.ibm.ws.resource.internal.ResourceFactoryTrackerData$1.getService()
Caused by: java.lang.RuntimeException: java.sql.SQLNonTransientException:
DSRA4000E: A valid JDBC driver implementation class was not found for the jdbcDriver jdbcDriver[myHanaDriver] using the library com.ibm.ws.classloading.sharedlibrary_587. [/opt/wlp/usr/shared/resources/hana/ngdbc.jar]
Caused by: java.sql.SQLNonTransientException:
DSRA4000E: A valid JDBC driver implementation class was not found for the jdbcDriver jdbcDriver[myHanaDriver] using the library com.ibm.ws.classloading.sharedlibrary_587. [/opt/wlp/usr/shared/resources/hana/ngdbc.jar]
Caused by: java.lang.ClassNotFoundException: com.ibm.ws.jdbc.jdbcDriver
Any one that can help me, get the right implementation class that I need?
You are correct that javax.sql.DataSource="com.ibm.ws.jdbc.jdbcDriver" is misconfigured. This should either point to the JDBC driver's implementation of javax.sql.DataSource, for example, javax.sql.DataSource="com.sap.dbtech.jdbcext.DataSourceSapDB"
or, for many JDBC drivers, newer versions of Liberty (but not the older 16.0.0.4 level that this question asks about) are often able to infer the correct implementation class if you omit this configuration attribute altogether.
I have it working now, I changed this:
javax.sql.DataSource="com.ibm.ws.jdbc.jdbcDriver"
into
javax.sql.ConnectionPoolDataSource="com.sap.db.jdbcext.ConnectionPoolDataSourceSAP"
And type="javax.sql.DataSource" into this type="javax.sql.ConnectionPoolDataSource".

Application is not working in WebSphere

I deployed WAR file on Websphere console and mapped it to datasource. I am able to test the datasource which I configured with PostgreSQL server details. But my application is not connecting to the server. I am new to WebSphere and could anyone please help me to configure the datasource based on the below context.xml file. My application works well in tomcat but not in Websphere.
I think am doing something wrong in the datasource configuration.
<Resource
name="jdbc/domains/ABC" url="jdbc:postgresql://localhost:5432/postgres"
initConnectionSqls="SET search_path TO my_schme;"
username="abccc"
password="******"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
validationQuery="select 1"
initialSize="5"
maxActive="20"
maxIdle="10"
maxWait="-1"
/>
Here is an example based on the most common way to configure data sources in WebSphere Application Server Liberty -- in server.xml (it is also possible to define within the application via the standard #DataSourceDefinition annotation or deployment descriptor, which would be a separate example)
In server.xml,
<featureManager>
<feature>jdbc-4.2</feature>
<feature>jndi-1.0</feature>
... other features
</featureManager>
<dataSource id="ABC" jndiName="jdbc/domains/ABC" type="javax.sql.ConnectionPoolDataSource" validationTimeout="30s">
<jdbcDriver libraryRef="PostGreLib" javax.sql.ConnectionPoolDataSource="org.postgresql.ds.PGConnectionPoolDataSource"/>
<properties url="jdbc:postgresql://localhost:5432/postgres"/>
<containerAuthData user="abccc" password="******"/>
<connectionManager maxPoolSize="20" connectionTimeout="-1"/>
<!-- no equivalents for initialSize and maxIdle -->
<onConnect>SET search_path TO my_schme;</onConnect>
</dataSource>
<library id="PostGreLib">
<file name="C:/PostGreSQL/postgresql-42.1.4.jar"/>
</library>
Here are some helpful knowledge center articles on data source configuration in WebSphere Application Server Liberty,
https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/twlp_dep_configuring_ds.html
https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.liberty.autogen.base.doc/ae/rwlp_feature_jdbc-4.2.html

Unable to use JCA CICS resource with IBM WebSphere Application Server Liberty Profile

I'm trying to setup WLP for an existing EAR application.
This setup works fine with WAS 9 traditional.
The problem is the JCA CICS Resource Adapter call.
The server.xml :
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>javaee-7.0</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" />
<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>
<library id="sharedLibs">
<fileset dir="/work/sharedlibs" includes="*.jar"/>
<folder dir="/work" />
</library>
<resourceAdapter
autoStart="true"
id="eciResourceAdapter"
location="/work/cicseci.rar">
</resourceAdapter>
<connectionFactory id="CTGDV06" jndiName="jca/CTGDV06" >
<properties.eciResourceAdapter.javax.resource.cci.ConnectionFactory
connectionUrl="tcp://*******"
serverName="*******"
userName="*******"
portNumber="2006"
/>
</connectionFactory>
<application type="ear" id="app" location="app.ear" name="app">
<classloader
commonLibraryRef="sharedLibs"
classProviderRef="eciResourceAdapter" />
</application>
</server>
in ibm-web-bnd.xml :
<resource-ref name="cicsjca" binding-name="jca/CTGDV06"></resource-ref>
in web.xml :
<resource-ref id="ResourceRef_Cics_Jca">
<description>Acces CICS</description>
<res-ref-name>cicsjca</res-ref-name>
<res-type>javax.resource.cci.ConnectionFactory</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
Startup is Ok, but access to JCA fail with :
java.lang.Exception: Lookup for java:comp/env/cicsjca failed. Exception: javax.naming.NamingException: CWNEN1001E: The object referenced by the java:comp/env/cicsjca JNDI name could not be instantiated. If the reference name maps to a JNDI name in the deployment descriptor bindings for the application performing the JNDI lookup, make sure that the JNDI name mapping in the deployment descriptor binding is correct. If the JNDI name mapping is correct, make sure the target resource can be resolved with the specified name relative to the default initial context.
[Root exception is com.ibm.wsspi.injectionengine.InjectionException: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/cicsjca reference. The exception message was: CWNEN1003E: The server was unable to find the jca/CTGDV06 binding with the javax.resource.cci.ConnectionFactory type for the java:comp/env/cicsjca reference.]
I don't understand what's wrong with this setup, any help would be apreciated !
The correct configuration depends on how many connection factory implementations are provided by the resource adapter.
If the resource adapter provides only a single connection factory (which is commonly the case for many resource adapters), then configuration would be:
<connectionFactory id="CTGDV06" jndiName="jca/CTGDV06" >
<properties.eciResourceAdapter
connectionUrl="tcp://*******"
serverName="*******"
userName="*******"
portNumber="2006"
/>
</connectionFactory>
Full detail on how to specify configuration for JCA resource adapters in Liberty can be found here in the knowledge center.

WL6.1 Deploying sql adapter with dataSourceJNDIName give error Runtime: Datasource not found in jndi

i am deploying an sql adapter on was liberty 8.5.5. i'm trying to connect to the APPCNTR database installed with WL.
the datasource name declared in server.xml :
<dataSource jndiName="jdbc/AppCenterDS" transactional="false">
<jdbcDriver libraryRef="MySQLLib"/>
<properties URL="jdbc:mysql://127.0.0.1:3306/APPCNTR" user="ibmappcenter" password="xxxx"/>
</dataSource>
the adapter xml :
<connectivity>
<connectionPolicy xsi:type="sql:SQLConnectionPolicy">
<dataSourceJNDIName>java:comp/env/jdbc/AppCenterDS</dataSourceJNDIName>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="5" />
</connectivity>
the error in javascript console : Runtime: Datasource java:comp/env/jdbc/AppCenterDS not found in jndi
what is the correct syntax ?
do i miss something while deploying the application?
thanks for your help
regards,
I know that the generated files has
<dataSourceJNDIName>java:/data-source-jndi-name</dataSourceJNDIName>
as the model, but I've never been able to get that to work. It should work with the simple name:
<dataSourceJNDIName>jdbc/AppCenterDS</dataSourceJNDIName>

Resources