{"record":{"id":"c3121f440bb06b5e","repo":"stanfordnlp/CoreNLP","slug":"invalid-outputformat-setting","errorCode":null,"errorMessage":"Invalid outputFormat setting.","messagePattern":"Invalid outputFormat setting\\.","errorType":"http","errorClass":"javax.servlet.ServletException","httpStatus":500,"severity":"error","filePath":"src/edu/stanford/nlp/ie/ner/webapp/NERServlet.java","lineNumber":45,"sourceCode":" **/\n\npublic class NERServlet extends HttpServlet {\n\n  private static final long serialVersionUID = 1584102147050497227L;\n\n  private String format;\n  private boolean spacing;\n  private String defaultClassifier;\n  private List<String> classifiers = new ArrayList<>();\n  private Map<String, CRFClassifier<CoreMap>> ners;\n\n  private static final int MAXIMUM_QUERY_LENGTH = 3000;\n\n  @Override\n  public void init() throws ServletException {\n    format = getServletConfig().getInitParameter(\"outputFormat\");\n    if (format == null || format.trim().isEmpty()) {\n      throw new ServletException(\"Invalid outputFormat setting.\");\n    }\n\n    String spacingStr = getServletConfig().getInitParameter(\"preserveSpacing\");\n    if (spacingStr == null || spacingStr.trim().isEmpty()) {\n      throw new ServletException(\"Invalid preserveSpacing setting.\");\n    }\n    //spacing = Boolean.valueOf(spacingStr).booleanValue();\n    spacingStr = spacingStr.trim().toLowerCase();\n    spacing = \"true\".equals(spacingStr);\n\n    String path = getServletContext().getRealPath(\"/WEB-INF/data/models\");\n    for (String classifier : new File(path).list()) {\n      classifiers.add(classifier);\n    }\n    // TODO: get this from somewhere more interesting?\n    defaultClassifier = classifiers.get(0);\n\n    for (String classifier : classifiers) {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/ie/ner/webapp/NERServlet.java#L27-L63","documentation":"Servlet initialization failure in NERServlet.init: the servlet-config init parameter outputFormat is missing or blank, so the servlet cannot determine how to render NER results and aborts startup with a ServletException.","triggerScenarios":"Deploying the webapp without an <init-param> named outputFormat in web.xml (or annotation equivalent), or declaring it with only whitespace.","commonSituations":"Hand-edited web.xml that dropped the parameter; renaming the parameter while the servlet expects the exact name; container deployments that strip empty init-params.","solutions":["Add <init-param><param-name>outputFormat</param-name><param-value>xml</param-value></init-param> to the servlet config in web.xml","Use a non-empty value such as xml, json, or tabbed as appropriate for the deployment","Redeploy the WAR after fixing web.xml so init() re-runs with the parameter","Verify with container logs / getInitParameter name spelling (case-sensitive)."],"exampleFix":"<!-- before -->\n<servlet><servlet-name>NER</servlet-name><servlet-class>...NERServlet</servlet-class></servlet>\n<!-- after -->\n<servlet><servlet-name>NER</servlet-name><servlet-class>...NERServlet</servlet-class>\n  <init-param><param-name>outputFormat</param-name><param-value>xml</param-value></init-param>\n</servlet>","handlingStrategy":"validation","validationCode":"String fmt = getServletConfig().getInitParameter(\"outputFormat\");\nif (fmt == null || fmt.trim().isEmpty()) throw new ServletException(\"outputFormat init-param required\");","typeGuard":null,"tryCatchPattern":"try { servlet.init(cfg); } catch (ServletException e) { log.severe(\"Servlet misconfigured: \" + e.getMessage()); }","preventionTips":["Declare all required init-params (outputFormat, preserveSpacing) in web.xml","Validate servlet config in a deployment smoke test","Keep param names exact and case-sensitive"],"tags":["java","servlet","config"],"backgroundTag":"missing-required-config-field","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}