How to solve the issue of the File-Delimited adapter failing to introspect the files on an FTP Server?

How to solve the issue of the File-Delimited adapter failing to introspect the files on an FTP Server?

book

Article ID: KB0137650

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization All Supported Versions

Description

The error is caused by an invalid group reference in a String.replaceFirst() call, specifically, the replacement string includes something like $1, but the regex pattern doesn't define a matching capture group or the $ is unescaped when it's meant to be a literal character.After encountering this issue, firstly confirm that the connection to and the FIles on the FTP server are accessible outside TDV (using a third-party client tool like WinSCP, FileZilla, etc.). If it works then we can confirm that there is no issue with the FTP Server and proceed, as below.
Another suggestion is to test using the CDATA FTP adapter, but if the above test is successful, this step can be skipped.

 

Environment

All Supported Environments

Resolution

There are 2 resolutions:

1. Check if the password used to log in to the FTP Server contains any special characters like @,$,&, etc.. If yes, then remove them by creating a new password and then retry from TDV using the File-Delimited adapter.

2. a. Uncheck the checkbox for 'Use credentials to access the shared file system' and remove the username and password given on the adapter (as below image).

    b. Change the FTP URL as per the below syntax:

ftp://[username]:[password]@[ftp_host_name]/[path_to_file]

image.png

Issue/Introduction

When using the File-Delimited adapter, the "Test Connection" to the FTP Server is successful, but the introspection fails.

The error stack is as below:

ERROR [IntrospectResourcesTask Introspect Datasource] 2025-03-28 15:48:01.825 +0900 IntrospectionStatus - null
java.lang.IllegalArgumentException: Illegal group reference
    at java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1067) ~[?:?]
    at java.util.regex.Matcher.appendReplacement(Matcher.java:997) ~[?:?]
    at java.util.regex.Matcher.replaceFirst(Matcher.java:1407) ~[?:?]
    at java.lang.String.replaceFirst(String.java:2898) ~[?:?]
    at com.compositesw.common.net.URLReader.readFtpURL(URLReader.java:292) ~[cscommon.jar:?]
    at com.compositesw.common.net.URLReader.readURL(URLReader.java:212) ~[cscommon.jar:?]
    at com.compositesw.cdms.ds.file.FileIntrospector2.introspectDelimitedFile(FileIntrospector2.java:585) ~[?:?]
    at com.compositesw.cdms.ds.file.FileIntrospector2.introspectTables(FileIntrospector2.java:402) ~[?:?]
    at com.compositesw.cdms.datasource.introspect.Introspector2Wrapper.introspectTables(Introspector2Wrapper.java:579) ~[csserver.jar:?]
    at com.compositesw.cdms.datasource.introspect.AbstractIntrospector2.introspectResources(AbstractIntrospector2.java:441) ~[csserver.jar:?]
    at com.compositesw.cdms.datasource.introspect.IntrospectionDriver.processResourceBatchToAddInternal(IntrospectionDriver.java:905) ~[csserver.jar:?]
    at com.compositesw.cdms.datasource.introspect.IntrospectionDriver.processResourceBatchesToAdd(IntrospectionDriver.java:753) ~[csserver.jar:?]
    at com.compositesw.cdms.datasource.introspect.IntrospectionDriver.processResourcesToAdd(IntrospectionDriver.java:594) ~[csserver.jar:?]
    at com.compositesw.cdms.datasource.introspect.IntrospectionDriver.introspect(IntrospectionDriver.java:141) ~[csserver.jar:?]
    at com.compositesw.cdms.datasource.introspect.IntrospectionHandler.runIntrospectResources(IntrospectionHandler.java:342) ~[csserver.jar:?]
    at com.compositesw.cdms.datasource.introspect.task.IntrospectResourcesTask.doTaskWithResultsRun(IntrospectResourcesTask.java:169) ~[csserver.jar:?]
    at com.compositesw.server.task.TaskWithResults.run(TaskWithResults.java:77) ~[csserver.jar:?]
    at com.compositesw.server.task.TaskManager$TaskRunner.run(TaskManager.java:146) ~[csserver.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]