{"record":{"id":"505e9966ebfe49f3","repo":"pentaho/pentaho-kettle","slug":"purrepository-loginexception-message","errorCode":"PurRepository.LoginException.Message","errorMessage":"PurRepository.LoginException.Message (localized; login failed due to unexpected error)","messagePattern":"PurRepository\\.LoginException\\.Message \\(localized; login failed due to unexpected error\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepositoryConnector.java","lineNumber":147,"sourceCode":"      RepositoryConnectResult inProcessResult = tryInProcessConnect( decryptedPassword, result );\n      if ( inProcessResult != null ) {\n        return inProcessResult;\n      }\n\n      ExecutorService executor = getExecutor();\n      Future<Boolean> authorizationFuture = buildAuthorizationFuture( executor, result );\n      Future<WebServiceException> repoFuture = buildRepoWebServiceFuture( executor, username, decryptedPassword, result );\n      Future<Exception> syncFuture = buildSyncWebServiceFuture( executor, username, decryptedPassword, result );\n      Future<String> sessionFuture = buildSessionServiceFuture( executor, username, decryptedPassword, useSessionAuth );\n\n      applyFutureResults( result, authorizationFuture, repoFuture, syncFuture, sessionFuture );\n\n      registerRepositoryServices( purRepositoryServiceRegistry, username, decryptedPassword, result );\n\n      result.setSuccess( true );\n    } catch ( NullPointerException npe ) {\n      result.setSuccess( false );\n      throw new KettleException( BaseMessages.getString( PKG, \"PurRepository.LoginException.Message\" ) );\n    } catch ( InterruptedException ie ) {\n      result.setSuccess( false );\n      serviceManager.close();\n      Thread.currentThread().interrupt();\n      throw new KettleException( ie );\n    } catch ( Exception e ) {\n      result.setSuccess( false );\n      serviceManager.close();\n      throw new KettleException( e );\n    }\n    return result;\n  }\n\n  /**\n   * Validates that a JSESSIONID is available when session-based authentication is requested.\n   *\n   * @throws KettleException if no valid JSESSIONID can be found\n   */","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepositoryConnector.java#L129-L165","documentation":"PurRepositoryConnector.connect treats a NullPointerException during repository connection setup as a fatal, unexplained login failure and throws a localized KettleException (PurRepository.LoginException.Message). The NPE is swallowed, so the actual cause (often a missing service/config) is hidden. This is a defensive catch-all inside the connect routine.","triggerScenarios":"connect() internally throws NPE anywhere between initialization and registerRepositoryServices — e.g. repository metadata null, uninitialized PentahoSystem/registry, or missing decryption result — caught by the dedicated catch (NullPointerException npe) branch.","commonSituations":"Connecting to a PUR repository with incomplete connection settings (missing server URL/user); the BI Platform context not being initialized so PentahoSystem lookups return null; testing connections from unit tests without a live server (see the testConnectWithSessionAuth_* tests).","solutions":["Verify the repository connection definition (URL, username, password) is complete and correct","Ensure the Pentaho server/BIServer context is initialized and reachable before connecting","Get the underlying NPE: enable debug logging or step through connect() since the exception text hides the cause","Call connect with a valid session/auth context (the session-auth tests show null/empty contexts throw here)"],"exampleFix":"// before\nPurRepositoryDefinition def = new PurRepositoryDefinition(); // fields unset\nrepository.connect(pmeta);\n// after\nif (pmeta.getRepositoryConnectionUser() == null || pmeta.getRepositoryConnectionUrl() == null) {\n  throw new KettleException(\"Repository URL and user must be set before connecting\");\n}\nrepository.connect(pmeta);","handlingStrategy":"validation","validationCode":"if (repoMeta == null || repoMeta.getRepositoryConnectionUrl() == null\n    || repoMeta.getRepositoryConnectionUser() == null\n    || repoMeta.getRepositoryConnectionPassword() == null) {\n  throw new KettleException(\"Incomplete PUR connection settings\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  repository.connect(repoMeta);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"login\")) {\n    log.error(\"PUR login failed (possible NPE in connect); check connection config and server context\", e);\n  } else throw e;\n}","preventionTips":["Validate all connection fields (URL, user, password) before connect","Ensure the PentahoSystem/BI platform context is initialized in embedded scenarios","Enable debug logging to expose the swallowed NPE cause"],"tags":["kettle","pentaho","login","null-pointer","configuration"],"backgroundTag":"missing-credentials","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}