In case you have a portal or JEE application that connects to an SAP backend, knowing if the connection works is important, even more important can be to know WHY it isn`t working. In the following example I was developing a KM application that uses a DMS Repository Manager from SAP connected to a SAP ABAP backend. The code worked when using /documents as the repository, but failed when using the DMSRM entry path.
The log did not help much, as it only showed that the connection failed.
The error message contains some more information, but still isn`t showing why the connection failed.
Caught exception: com.sapportals.connector.connection.ConnectionFailedException: Connection Failed: A nested exception occurred. Could not initialize physical connection. at com.sapportals.connectors.SAPCFConnector.SAPConnectorException.getNewConnectionFailedLocalizedException(SAPConnectorException.java:182) at com.sapportals.connectors.SAPCFConnector.connection.SAPCFConnectorManagedConnectionFactory.createManagedConnection(SAPCFConnectorManagedConnectionFactory.java:155) at com.sap.engine.services.connector.jca.ConnectionHashSet.match(ConnectionHashSet.java:401) […]
This traces the error down to the SAP Connector Framework but isn`t helpful when trying to find out what happened exactly. It fails, but where and why exactly is not visible. The system in the portal landscape is configured for SSO using SAPLOGONTICKET and the SSO works perfectly when the connection test is run or the repository is called in the KM. As the error occurs in the CF part, it would be nice to see log messages from there. Obviously only the error messages are shown. But as I already know that an error is occurring, that log message is of little use.
Therefore, it would be nice to increase the log level of CF to see if maybe debug messages are logged. SAP NetWeaver Java comes with a powerful logging and tracing framework that can be accessed and configured using NWA. Changes are reflected immediately, making it even more easy to work with this tool. The question is now: where are the logs stored?
As can be seen in the log message, the package of the CF classes is com.sapportals.connectors.
There is no easy access to the source code to know which class name is used to write the logs into. Using the log configuration in NWA it is possible to search for classes. Searching for connector reveals the following classes.
As a ABAP system is called, the R3 class is a good hunch. Setting the log level to Debug.
Invoking the method of the Java class again shows now more log messages:
There is one error message showing an actual hint on what is not working. Expanding this entry shows what is happening.
Thread Hash: 128521575. Could not create JCO connection. Exception:Parameter containing a user ID is missing: neither user nor user alias nor external ID nor SSO ticket nor X.509 certificate is specified. Trying to connect with the default language instead.
The connection cannot be established because a parameter user ID is missing. While the ABAP system in the SAP Portal landscape is configured to use SSO and is working, the DMSRM repository manager has a problem in using SSO. It looks that as a faultback user ID logon is tried. Of course this is not working as no user / password mapping is configured for the system.
Changing the system in the portal landscape to make use of user id mapping solves the issue. Now the KM application is able to connect.
As the amount of log messages is drastically increased, the log level should be reset to default after solving the issue.