Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-6686

Avoid stacktrace logging and NPE

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • http.jetty-5.1.8
    • None
    • HTTP Service
    • None

    Description

      Hi,

      When the Jetty service cannot bind the desired port there is an error message, and that's perfectly normal. But could we but could we avoid printing a stacktrace ?

      Additionally this situation leads to a NullPointerException with the printing of a second stacktrace.

      These stacktraces can be useful in debug mode but are not desirable in production.


      13/02/2024 11:27:48.813 org.apache.felix.http SEVERE [T25 JettyService.startConnector()]: Failed to start Connector: ServerConnector@4b5a8f16{HTTP/1.1, (http/1.1)}

      {0.0.0.0:8989}

      java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8989
          at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
          at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:304)
          at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:74)
          at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:228)
          at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
          at org.apache.felix.http.jetty.internal.JettyService.startConnector(JettyService.java:598)
          at org.apache.felix.http.jetty.internal.JettyService.initializeHttp(JettyService.java:428)
          at org.apache.felix.http.jetty.internal.JettyService.initializeJetty(JettyService.java:326)
          at org.apache.felix.http.jetty.internal.JettyService.startJetty(JettyService.java:174)
          at org.apache.felix.http.jetty.internal.JettyService.start(JettyService.java:111)
          at org.apache.felix.http.jetty.internal.JettyActivator.doStart(JettyActivator.java:66)
          at org.apache.felix.http.base.internal.AbstractActivator.start(AbstractActivator.java:35)
          at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:849)
          at org.apache.felix.framework.Felix.activateBundle(Felix.java:2429)
          at org.apache.felix.framework.Felix.startBundle(Felix.java:2335)
          at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1566)
          at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:297)
          at java.base/java.lang.Thread.run(Thread.java:829)
      Caused by: java.net.BindException: Address already in use: bind
          at java.base/sun.nio.ch.Net.bind0(Native Method)
          at java.base/sun.nio.ch.Net.bind(Net.java:455)
          at java.base/sun.nio.ch.Net.bind(Net.java:447)
          at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
          at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:339)
          ... 17 more

      13/02/2024 11:27:48.874 org.apache.felix.http SEVERE [T25 JettyService.initializeJetty()]: Jetty stopped (no connectors available)
      13/02/2024 11:27:48.882 org.apache.felix.http SEVERE [T25 JettyService.startJetty()]: Exception while initializing Jetty
      java.lang.NullPointerException
          at org.apache.felix.http.jetty.internal.JettyService.initializeJetty(JettyService.java:371)
          at org.apache.felix.http.jetty.internal.JettyService.startJetty(JettyService.java:174)
          at org.apache.felix.http.jetty.internal.JettyService.start(JettyService.java:111)
          at org.apache.felix.http.jetty.internal.JettyActivator.doStart(JettyActivator.java:66)
          at org.apache.felix.http.base.internal.AbstractActivator.start(AbstractActivator.java:35)
          at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:849)
          at org.apache.felix.framework.Felix.activateBundle(Felix.java:2429)
          at org.apache.felix.framework.Felix.startBundle(Felix.java:2335)
          at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1566)
          at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:297)
          at java.base/java.lang.Thread.run(Thread.java:829)

      Attachments

        Activity

          People

            Unassigned Unassigned
            andre.freyssinet@scalagent.com André Freyssinet
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: