0
votes

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
4
Its either a typo or error in server.xml as you have both datasources using same JNDI jndiName="worklight/jdbc/WorklightDS", second one should be different - jndiName="worklight/jdbc/WorklightReportsDS"Gas
I couldn't understand this, both are using different sources?AAhad
You cannot have 2 data sources in the server.xml with the same JNDI name. The datasource refering to WLRREPOR should have worklight/jdbc/WorklightReportsDS jndiName.Gas
Check this page www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/… and try to configure datasource via properties not jdbc url.Gas
yes both data-sources are different. it was copy/past error made here while posting question. So the second one is worklight/jdbc/WorklightReportsDSAAhad

4 Answers

0
votes

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.
0
votes

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

0
votes

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.

0
votes

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"/>