Discussion:
[jetty-users] Starting Jetty without http connector and equinox jetty service
Harald Kornmayer
2018-07-24 12:47:18 UTC
Permalink
Dear Jetty supporters



With the migration to photon I found the following situation.



We start Jetty to use https only. We don’t create any HTTP connector.

We use Equinox as the runtime and the org.eclipse.equinox.http.jetty bundle.



Starting our server runtime, I got the following message:



2018-07-24 14:42:34.274:INFO::Start Level: Equinox Container: bb6dc872-7353-4bdd-9511-a5529a94cf2c: Logging initialized @5168ms to org.eclipse.jetty.util.log.StdErrLog

osgi> !SESSION 2018-07-24 14:42:29.351 -----------------------------------------------

eclipse.buildId=unknown

java.version=1.8.0_151

java.vendor=Oracle Corporation

BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE

Framework arguments: -application

Command-line arguments: -application -data G:\EclipsePhoton\Workspaces\aquasi-devel/../runtime-11_ServerNurHolz.product -dev file:G:/EclipsePhoton/Workspaces/aquasi-devel/.metadata/.plugins/org.eclipse.pde.core/11_ServerNurHolz.product/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -console -clean



!ENTRY org.eclipse.equinox.http.jetty 4 0 2018-07-24 14:42:34.548

!MESSAGE FrameworkEvent ERROR

!STACK 0

org.osgi.framework.BundleException: Exception in org.eclipse.equinox.http.jetty.internal.Activator.start() of bundle org.eclipse.equinox.http.jetty.

at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:800)

at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:729)

at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1002)

at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:354)

at org.eclipse.osgi.container.Module.doStart(Module.java:581)

at org.eclipse.osgi.container.Module.start(Module.java:449)

at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1682)

at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1662)

at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1624)

at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1555)

at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)

at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)

at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

Caused by: java.lang.NullPointerException

at org.eclipse.equinox.http.jetty.internal.HttpServerManager.updated(HttpServerManager.java:134)

at org.eclipse.equinox.http.jetty.internal.Activator.start(Activator.java:62)

at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:779)

at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)

at java.security.AccessController.doPrivileged(Native Method)

at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:772)

... 12 more

Root exception:

java.lang.NullPointerException

at org.eclipse.equinox.http.jetty.internal.HttpServerManager.updated(HttpServerManager.java:134)

at org.eclipse.equinox.http.jetty.internal.Activator.start(Activator.java:62)

at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:779)

at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)

at java.security.AccessController.doPrivileged(Native Method)

at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:772)

at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:729)

at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1002)

at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:354)

at org.eclipse.osgi.container.Module.doStart(Module.java:581)

at org.eclipse.osgi.container.Module.start(Module.java:449)

at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1682)

at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1662)

at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1624)

at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1555)

at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)

at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)

at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)





Having a look into the class org.eclipse.equinox.http.jetty.internal.HttpServerManager and the updated function I recognized the following:



In this class there is command sequence starting from line 129:



if (httpsConnector != null) {

int port = httpsConnector.getLocalPort();

if (port == -1)

port = httpsConnector.getPort();

holder.setInitParameter(JettyConstants.HTTPS_PORT, Integer.toString(port));

String host = httpConnector.getHost();

if (host != null)

holder.setInitParameter(JettyConstants.HTTPS_HOST, host);

}



The problem is the line: String host = httpconnector.getHost();



That create a null string (as we did not configure anything for http)



Changing this line to: String host = httpsconnector.getHost;

solves the problem. The one “s” missing is important.



I don’t know if this is an issue with jetty or with equinox?



What is the best way to correct the line in the repo?



Harald
Joakim Erdfelt
2018-07-24 12:59:29 UTC
Permalink
The Eclipse Jetty project does not maintain the Eclipse Equinox layers.

There is an open bug for this at Eclipse Equinox -
https://bugs.eclipse.org/bugs/show_bug.cgi?id=537160

I agree, it's a bad assumption to assume that HTTP will always be there.
It also seems like a bug to be looking at the HTTP connector for the
hostname when you have a valid connector already in the httpsConnector.
Post by Harald Kornmayer
Dear Jetty supporters
With the migration to photon I found the following situation.
We start Jetty to use https only. We don’t create any HTTP connector.
We use Equinox as the runtime and the org.eclipse.equinox.http.jetty bundle.
org.eclipse.jetty.util.log.StdErrLog
osgi> !SESSION 2018-07-24 14:42:29.351 ------------------------------
-----------------
eclipse.buildId=unknown
java.version=1.8.0_151
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments: -application
Command-line arguments: -application -data G:\EclipsePhoton\Workspaces\
aquasi-devel/../runtime-11_ServerNurHolz.product -dev
file:G:/EclipsePhoton/Workspaces/aquasi-devel/.
metadata/.plugins/org.eclipse.pde.core/11_ServerNurHolz.product/dev.properties
-os win32 -ws win32 -arch x86_64 -consoleLog -console -clean
!ENTRY org.eclipse.equinox.http.jetty 4 0 2018-07-24 14:42:34.548
!MESSAGE FrameworkEvent ERROR
!STACK 0
*org.osgi.framework.BundleException*: Exception in
org.eclipse.equinox.http.jetty.internal.Activator.start() of bundle
org.eclipse.equinox.http.jetty.
at org.eclipse.osgi.internal.framework.BundleContextImpl.
startActivator(*BundleContextImpl.java:800*)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(
*BundleContextImpl.java:729*)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(
*EquinoxBundle.java:1002*)
at org.eclipse.osgi.internal.framework.EquinoxBundle$
EquinoxModule.startWorker(*EquinoxBundle.java:354*)
at org.eclipse.osgi.container.Module.doStart(*Module.java:581*)
at org.eclipse.osgi.container.Module.start(*Module.java:449*)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.
incStartLevel(*ModuleContainer.java:1682*)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.
incStartLevel(*ModuleContainer.java:1662*)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.
doContainerStartLevel(*ModuleContainer.java:1624*)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.
dispatchEvent(*ModuleContainer.java:1555*)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.
dispatchEvent(*ModuleContainer.java:1*)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(
*EventManager.java:230*)
at org.eclipse.osgi.framework.eventmgr.EventManager$
EventThread.run(*EventManager.java:340*)
Caused by: *java.lang.NullPointerException*
at org.eclipse.equinox.http.jetty.internal.
HttpServerManager.updated(*HttpServerManager.java:134*)
at org.eclipse.equinox.http.jetty.internal.Activator.start(
*Activator.java:62*)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(
*BundleContextImpl.java:779*)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(
*BundleContextImpl.java:1*)
at java.security.AccessController.doPrivileged(*Native Method*)
at org.eclipse.osgi.internal.framework.BundleContextImpl.
startActivator(*BundleContextImpl.java:772*)
... 12 more
*java.lang.NullPointerException*
at org.eclipse.equinox.http.jetty.internal.
HttpServerManager.updated(*HttpServerManager.java:134*)
at org.eclipse.equinox.http.jetty.internal.Activator.start(
*Activator.java:62*)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(
*BundleContextImpl.java:779*)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(
*BundleContextImpl.java:1*)
at java.security.AccessController.doPrivileged(*Native Method*)
at org.eclipse.osgi.internal.framework.BundleContextImpl.
startActivator(*BundleContextImpl.java:772*)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(
*BundleContextImpl.java:729*)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(
*EquinoxBundle.java:1002*)
at org.eclipse.osgi.internal.framework.EquinoxBundle$
EquinoxModule.startWorker(*EquinoxBundle.java:354*)
at org.eclipse.osgi.container.Module.doStart(*Module.java:581*)
at org.eclipse.osgi.container.Module.start(*Module.java:449*)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.
incStartLevel(*ModuleContainer.java:1682*)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.
incStartLevel(*ModuleContainer.java:1662*)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.
doContainerStartLevel(*ModuleContainer.java:1624*)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.
dispatchEvent(*ModuleContainer.java:1555*)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.
dispatchEvent(*ModuleContainer.java:1*)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(
*EventManager.java:230*)
at org.eclipse.osgi.framework.eventmgr.EventManager$
EventThread.run(*EventManager.java:340*)
Having a look into the class org.eclipse.equinox.http.jetty.internal.HttpServerManager
if (httpsConnector != null) {
int port =
httpsConnector.getLocalPort();
if (port == -1)
port =
httpsConnector.getPort();
holder.setInitParameter(JettyConstants.HTTPS_PORT,
Integer.toString(port));
String host =
httpConnector.getHost();
if (host != null)
holder.setInitParameter(JettyConstants.HTTPS_HOST, host);
}
The problem is the line: String host = httpconnector.getHost();
That create a null string (as we did not configure anything for http)
Changing this line to: String host = httpsconnector.getHost;
solves the problem. The one “s” missing is important.
I don’t know if this is an issue with jetty or with equinox?
What is the best way to correct the line in the repo?
Harald
_______________________________________________
jetty-users mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Loading...