Troubleshooting

Resolve common issues with your APIs.
lac42
This article identifies the following issues that you might encounter and how to resolve them: 
 
 
Discover Issues
When 
Layer7 Live API Creator
 is not working properly, you can:
  • View the logs.
For more information about viewing logs, see View Logging Information.
  • View the logs for the container, such as Apache Tomcat or Jetty.
  • (If the problem is client-only) Debug the issue that is with the web browser.
Resolve Errors
For more information about how to resolve known error conditions, see Error Codes.
Database Connections
General Connection Issues
Contact CA Support to troubleshoot your connection issues. Include the following information:
  • The main container log (
    catalina.out
     for Tomcat, console output for the single-user version of 
    Layer7 Live API Creator
    ).
  • The steps that you used to connect to the database.
  • An export of the database, if possible.
Verify Connectivity
You can encounter firewalls issues, particularly in large organizations. Verify that you can connect to the database from the machine hosting 
Layer7 Live API Creator
 using SQL Tools (for example, Toad, DbVisualizer, Razor, MySQL Workbench, and Microsoft SQL Server Management Studio).
MySQL SSL Exception
Recent versions of MySQL might require that you connect to a MySQL database using Secure Sockets Layer (SSL). The following error message indicates this requirement:
javax.net.ssl.SSLException: Unsupported record version Unknown-0.0
To avoid this error, add the following to the database URL (the
 URL
 field for the data source connection):
useSSL=false
For example:
jdbc:mysql://dbserver:3306/Chinook?useSSL=false
For more information about this field, see Database Connectivity.
Database Connects But No Tables - Ensure Active
 
Layer7 Live API Creator
 retrieves schema information only from active data sources. 
Layer7 Live API Creator
 reads the metadata from the database schema or catalog. These metadata values must be correct for the connection to succeed and the tables to be populated.
For more information about how to mark a data source as active, see Database Connectivity.
Calling PostgreSQL Functions
 
Layer7 Live API Creator
 does not expose PostgreSQL functions as REST endpoints. This is a PostgreSQL JDBC driver limitation. The driver exposes inadequate information about the parameter datatypes to 
Layer7 Live API Creator
.
External RESTFul Calls
If you are having issues invoking APIs from other servers, verify your URL and headers using REST tools, such as Postman or cURL.
For more information about how to debug using the 
rest<verb>
, see The SysUtility Object.
Large Schemas
API Server caches schemas in the admin  repository. A full load is required only initially, or when you refresh the schema. For large schemas, the time it takes for the initial load might exceed the web browser time-out time. In this case, an error appears, but API Server continues the load process.
Reload API Creator in your web browser, which loads the schema.
If you continue to have issues, contact CA Support.
Authentication Provider Not Set After you Import the API
API Creator does not store custom authentication providers in the 
.json
 file when you export your API. Specify the custom authentication provider as the authentication provider for your API after you import your API.
For more information:
Named Filters gives SQL Error
The use of named filters allows creation of named parameter values to be used in place of column attributes. However, each database has its own rules on how to handle mixed case and quotes. Ensure that the column attribute names are in single quotes ('name'), double quotes ("name"), or back-ticks (`name`) based on Derby, MySQL, and Oracle requirements.
Connect to Large Schemas
For schemas that are more than several 100 tables, you might run into browser time-outs and heap errors. Browser timeouts reflect that the time to load the schema exceeded the browser timeout. To correct this issue, log in to API Creator again.
For heap errors, increase the heap size that is provided to the API Server. For example, in the single-user demonstration package of 
Layer7 Live API Creator
 that is based on Jetty, the Start command file ( 
.sh
 or 
.bat
 ) includes the following command:
java -DSTOP.PORT=8123 -DSTOP.KEY=stop_caliveapicreator -jar ../start.jar $1 $2 $3 $4 $5 $6 $7 $8 $9
Change the command file to:
java
-Xmx1024m
-DSTOP.PORT=8123 <<< etc >>>
For more information about the default heap size, see Installation Requirements and Supported Platforms.
Run on JDK 9 and Later
You can run 
Layer7 Live API Creator
 on JDK 9 and later by passing the following option to the JVM:
--add-modules java.xml.bind
For instance, if you use Tomcat, you can set the following environment variable before starting API Server:
export CATALINA_OPTS="--add-modules java.xml.bind
API Creator is Unresponsive
You can log in to API Creator, but then it becomes unresponsive. You might encounter this issue if you are running on an Amazon Linux instance. This issue is caused by the server name (as returned by the 
hostname
 command) not resolving properly to an IP address. This triggers a known bug in some versions of Java, or possibly Linux kernel, which causes 
InetAddress.getLocalHost().getHostName()
 to hang.
For more information about this bug, see the question Java DNS resolution hangs forever in StackOverflow.
You can fix this issue using the following methods:
  • Use the following option on the Java command line when you start API Server:
    java -Djava.net.preferIPv4Stack=true ...
  • Put the host name (as determined by the 
    hostname
     command) in the 
    /etc/hosts
     file, for example:
    127.0.0.1 localhost ip-12-34-56-78
    ::1 localhost ip-12-34-56-78
If your machine does not have a fixed IP address, these methods are not a long-term solution.
Use one of the available methods to resolving this issue. Some methods require expertise in Unix networking.
Monitor API Server Availability
You can check the health of your API Server and its availability using the 
@heartbeat
 system REST endpoint. This endpoint retrieves API Server status.
For more information about this endpoint, see System REST Endpoints.
 
Layer7 Live API Creator
 Deletes new APIs and Other Changes on Shutdown
Run only one copy of 
Layer7 Live API Creator
 in the same Java container (for example, Jetty or Tomcat) and only one Java container pointing to the same admin repository. For example, if you are running on Tomcat, ensure that only one copy of 
Layer7 Live API Creator
 is in the 
webapps
 directory. Having more than one copy can result in 
Layer7 Live API Creator
 deleting the APIs you create and your other changes in the admin repository since starting your Java container when you shut down the Java container.
Data Explorer
Data Explorer Does Not Show Tables
Ensure that you have logged on to API Creator as a user with at least one assigned role and the role has at least one table with read access. If you have changed your URL fragment or your API name, clear the internal API cache by switching to another API.
Follow these steps:
 
  1. In API Creator, on the APIs page, select a different API.
  2. Repeat the process selecting your original API.
 
Layer7 Live API Creator
 rebuilds the new URL endpoints.
Data Explorer Does Not Load Tables and Display Data
If you change the value of the 
Metadata name
 field on the Settings tab in API Creator, Data Explorer does not load tables and display data.
For more information about this setting, see API Properties.
Swagger Documentation Not Showing After Import
API Creator includes the API Documentation role. You must be assigned this role, with access to read, insert, update, and delete. You can also allow the discovery of the API Swagger doc without authentication.
For more information about how to allow the discovery of the API Swagger doc without authentication, see API Properties.
Authentication Provider - Cannot Find Custom JS Library for Create Function
If you get an error the first time that you access a JavaScript library for an authentication provider, you must complete the following.
Follow these steps:
 
  1. Ensure that you have defined your JavaScript library (for your authentication provider in API Creator) as available to JavaScript event programming.
    For more information, see Logic Libraries.
  2. Ensure that you have defined the 
    create
     function in your authentication provider.
Allow Slash in Primary Key for Tomcat Installations
If you are running 
Layer7 Live API Creator
 on Tomcat, and you have a slash in your primary key, 
Layer7 Live API Creator
 returns an error saying it cannot find the row. The Tomcat server attempts to decode the "/" before sending on to 
Layer7 Live API Creator
.
For example, your key is 
P5/P5A
 and the href URL appears as (encoded):
/P5%2FP5A
You can enable Tomcat to accept encoded path separators, such as a slash in the primary key. Change the 
CATALINA_OPTS
 environment variable. Add the following to the JVM args of the system (setenv):
-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
Update Amazon EBS - Apache Proxy Server in the AWS Beanstalk Instance
Follow these steps:
 
  1. SSH into the machine.
  2. Issue the following command:
    cd /etc/httpd/conf.d
  3. Edit the 
    elasticbeanstalk.conf
     file to have the following data: (Overwrite the file)
    <VirtualHost *:80> <Proxy *> Order deny,allow Allow from all </Proxy> AllowEncodedSlashes On ProxyPass / http://localhost:8080/ retry=0 nocanon ProxyPassReverse / http://localhost:8080/ ProxyPreserveHost on ErrorLog /var/log/httpd/elasticbeanstalk-error_log </VirtualHost>
  4. Change the Tomcat config to allow encoded slashes (
    /usr/share/tomcat8/conf/tomcat8.conf
    ):
    export CATALINA_OPTS="$CATALINA_OPTS -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
  5. Restart Tomcat and Apache HTTP Server (httpd):
    sudoservice <servicename> restart
The Apache service can take a minute or two to be up.
Import API with Null Password Can Cause Database Issues
Migrating APIs from a previous version of 
Layer7 Live API Creator
 can cause issues with some databases. These databases attempt to connect, fail, and then lock out the connection. To solve this, export your API and mark your data source to inactive. Because 
Layer7 Live API Creator
 does not export the password, when you import the API (the JSON file), you can then enter the password, test the connection, and then activate your data source.
For more information:
Resource Properties not Visible
Resource properties are not visible if your web browser is set to auto-fill values. API Creator disables this functionality, though certain browsers ignore the disabling. Correct the browser from ignoring the disabling.
Google Chrome
 
For more information about how to disable autofill in the Google Chrome web browser, see Google Chrome help.
Safari
 
For more information about how to disable autofill in the Sarari web browser, see Apple Safari help.
Extensibility Issues
The following issues relate to invoking Java/JavaScript from your logic.
Class Cast invoking JavaScript - ScriptObjectMirror
The following issue is caused by passing a string instead of an object (or vice versa):
caused by: java.lang.ClassCastException: Cannot cast java.lang.String tojdk.nashorn.api.scripting.ScriptObjectMirror
To solve this issue, you can do one of the following:
  • Convert a JSON string to an object using the 
    JSON.parse()
     method.
  • Convert an object to a JSON string using the 
    JSON.stringify()
     method.